|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81636 is a reply to message #81595] |
Thu, 04 October 2012 15:33   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
sasha.mozgova@gmail.com writes:
> Do you by any chance see what am I doing wrong?
I would do it like this:
PS_START, filename = work_path+'profiles_correlation_on_map.ps', $
/LANDSCAPE, /EUROPEAN
levels = cgConLevels(Float(data), NLevels=nlevels+1, $
MinValue=Floor(Min(data)), STEP=step, Factor=1)
LoadCT, 0
cgLoadCT, 2, /Reverse, /Brewer, NColors=nlevels-1, Bottom=1
TVLCT, cgColor('white', /Triple), nlevels
map = Obj_New('cgMap', 'Equirectangular', Ellipsoid=19, $
XRange=xrange, YRange=yrange, /LatLon_Ranges, $
CENTER_LON=center_lon, $
Position=[0.1, 0.1, 0.9, 0.8], $
Limit=[Min(lat), Min(lon), Max(lat), Max(lon)])
map -> Draw
cgContour, data, lon, lat, /Cell_Fill, /Overplot, /Outline, $
C_Colors=Indgen(nlevels)+1, Levels=levels, $
Map=map, OutColor='White'
cgMap_Grid, Map=map, /Box
cgMap_Continents, Map=map, Color='tomato'
cgColorbar, Range=[Min(levels), Max(levels)-step], OOB_High=nlevels, $
NColors=nlevels-1, Bottom=1, /Discrete, $
Title='Temperature $\deg$') + 'K', $
Position=[0.1, 0.91, 0.9, 0.95]
PS_END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81637 is a reply to message #81595] |
Thu, 04 October 2012 14:52   |
Alexandra Laeng
Messages: 20 Registered: July 2011
|
Junior Member |
|
|
Ok, here is what I'm doing (after defining data, lon, lat and nlevels) in order to simply plot a data projected on map directly into PostScript file:
=======
set_plot, 'PS'
PageParam = PSWINDOW(/LANDSCAPE, /CM, PAGESIZE='A4')
PS_START, filename = work_path+'profiles_correlation_on_map.ps'
levels = cgConLevels(Float(data), NLevels=nlevels+1, MinValue=Floor(Min(data)), STEP=step, Factor=1)
LoadCT, 0
cgLoadCT, 2, /Reverse, /Brewer, NColors=nlevels-1, Bottom=1
TVLCT, cgColor('white', /Triple), nlevels
map = Obj_New('cgMap', 'Equirectangular', Ellipsoid=19, $
XRange=xrange, YRange=yrange, /LatLon_Ranges, CENTER_LON=center_lon, $
Position=[0.1, 0.1, 0.9, 0.8], Limit=[Min(lat), Min(lon), Max(lat), Max(lon)])
map -> AddCmd, Method='Erase'
map -> AddCmd, Method='Draw'
cgContour, data, lon, lat, /Cell_Fill, /Overplot, /Outline, C_Colors=Indgen(nlevels)+1, Levels=levels, Map=map, OutColor='White', /AddCmd
cgMap_Grid, Map=map, /Box, /AddCmd
cgMap_Continents, Map=map, Color='tomato', /AddCmd
cgColorbar, Range=[Min(levels), Max(levels)-step], OOB_High=nlevels, $
NColors=nlevels-1, Bottom=1, /Discrete, $
Title='Temperature ' + cgSymbol('deg') + 'K', $
Position=[0.1, 0.91, 0.9, 0.95], /AddCmd
cgControl, Execute=1
PS_END
set_plot, 'X'
==========
and here is what I get:
CGMDWINDOW::INIT-> WSET: Routine is not defined for current graphics device
Do you by any chance see what am I doing wrong?
Alex
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81662 is a reply to message #81595] |
Wed, 10 October 2012 19:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
sasha.mozgova@gmail.com writes:
> The missing longitude grid labels and latitude lines have however nothing to do with !p.multi. Is it possible that it only works for [0,360] and not [-180,180] longitudes?
No, this is a long story and involves what I think is
a bug in the Map_Grid program, that I have been unable
to fix successfully so far. It rears its ugly head
often when working with global map projections in
projected meter space. I should write an article
about it. I've been struggling with it for a long time.
I have been trying to avoid writing my own Map_Grid
program, but I'm thinking that may be the only way out
of this problem.
As far as doing map projections as multi-plots is concerned,
there are some definite problems with my code, that I am
not going to be able to solve until who knows when. I am
WAY behind on my real work, and need to get some of that
done before I lose my job. :-(
I'll work on this as I can.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81667 is a reply to message #81595] |
Wed, 10 October 2012 05:34  |
Alexandra Laeng
Messages: 20 Registered: July 2011
|
Junior Member |
|
|
Thank you for he quick answer, David.
There is always a way to work-around the machine when you are not educated enough:
I will create the plots one by one, then combine them with convert +/-append into 2x2 panels. :)
The missing longitude grid labels and latitude lines have however nothing to do with !p.multi. Is it possible that it only works for [0,360] and not [-180,180] longitudes?
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81668 is a reply to message #81595] |
Wed, 10 October 2012 05:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
sasha.mozgova@gmail.com writes:
> Does not work for me: when setting !p.multpi=[0, 2, 2, 0, 0] and running it for just one panel, I get the contour plot on the first panel, empty second panel, the grid on the third one, and the map - on the fourth. When I try to go through cgControl (put it = 0 before this three commands, add them as /AddCnd and set it 1at the end), it accept /AddCmd in cgContour, but crashes ("X connection to localhost:11.0 broken (explicit kill or server shutdown") when
I try to add /AddCmd to cgMap_Grid and cgMap_Continents.
>
> In plus, in grid, among [-180,180] longitudes only the positive ones are labeled, and the latitude lines are missing.
>
> Would I also be damned by some IDL Gods?..
Well, this is the first I've heard about !P.Multi.
It helps to write code if you have all the pertinenet
informaton when you start. :-)
I'm teaching a class for the next couple of days, so
I have limited time, but I'll see if I can get to
this. You will have to remove all POSITION keywords
if you are going to use !P.Multi, though, or all will
be confusion of the type you are experiencing. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81669 is a reply to message #81595] |
Wed, 10 October 2012 04:56  |
Alexandra Laeng
Messages: 20 Registered: July 2011
|
Junior Member |
|
|
Ooups, forgot the code producing all that fron the previous post.
=====
set_plot, 'PS'
PageParam = PSWINDOW(/LANDSCAPE, /CM, PAGESIZE='A4')
PS_START, filename = 'name.ps', /LANDSCAPE, /EUROPEAN
!P.MULTI=[0, 2, 2, 0, 0]
step = 1.0
levels = cgConLevels(NLevels=nlevels, MinValue=minimum, MaxValue=maximum)
LoadCT, 0
cgLoadCT, 25, /Reverse, /Brewer, NColors=nlevels-1, Bottom=1
TVLCT, cgColor('white', /Triple), nlevels
map = Obj_New('cgMap', 'Equirectangular', Ellipsoid=19, $
XRange=xrange, YRange=yrange, /LatLon_Ranges, $
Position=[0.1, 0.1, 0.9, 0.8], $
Limit=[Min(lat), Min(lon), Max(lat), Max(lon)])
;map -> Erase
map -> Draw
cgContour, data, lon, lat, /Fill, /Overplot, /Outline, $
missingvalue=!Values.F_NAN, C_Colors=Indgen(nlevels)+1, label =0, Levels=levels, Title='title.ps', Map=map, OutColor='white'
cgMap_Grid, Map=map, /Box
cgMap_Continents, Map=map, Color='black', thick=5
cgColorbar, Range=[Min(levels), Max(levels)+step], OOB_High=nlevels, $
NColors=nlevels-1, Bottom=1, /Discrete, /Top, $
Tlocation='TOP', Position=[0.1, 0.96, 0.9, 0.99]
PS_END
|
|
|
Re: contour plots on map with Coyote Graphics System in postscript [message #81670 is a reply to message #81595] |
Wed, 10 October 2012 04:48  |
Alexandra Laeng
Messages: 20 Registered: July 2011
|
Junior Member |
|
|
>> 2. Ideally, I need multiple panels, each on its own copy of the map. Would >>your procedure work by just setting !p.Multi varialbles?
> It is as simple as that! :-)
Does not work for me: when setting !p.multpi=[0, 2, 2, 0, 0] and running it for just one panel, I get the contour plot on the first panel, empty second panel, the grid on the third one, and the map - on the fourth. When I try to go through cgControl (put it = 0 before this three commands, add them as /AddCnd and set it 1at the end), it accept /AddCmd in cgContour, but crashes ("X connection to localhost:11.0 broken (explicit kill or server shutdown") when I try to add /AddCmd to cgMap_Grid and cgMap_Continents.
In plus, in grid, among [-180,180] longitudes only the positive ones are labeled, and the latitude lines are missing.
Would I also be damned by some IDL Gods?..
|
|
|