comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Multiple plot with mapCoord
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Multiple plot with mapCoord [message #88914 is a reply to message #88909] Thu, 03 July 2014 06:15 Go to previous messageGo to previous message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Wednesday, July 2, 2014 3:21:03 PM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> Good article. I'm still missing something though. I'd like to use coyote graphics because I'm trying to make publication figures and from my understanding better quality can be gotten using cgWindow and ImageMagick. When I run my code I see the maps then they flash away and i'm left with just 4 colored lines that should be overlaid on the maps. I've tried with the mapCoord statements both inside and outside the loop both with the same results.
>
>
>
> Well, there are a lot of things are wrong with your code. :-)
>
>
>
> I would try something like this:
>
>
>
> ;*********************************************************** ********
>
> PRO Map_Test
>
>
>
> cities = ['Denver','Omaha','Atlanta','Portland','Seattle','Trenton']
>
> city_lats = [ 39.75, 41.29, 33.84, 45.49, 47.62, 40.22]
>
> city_lons = [ -105.00, -95.92, -84.38, -122.69, -122.34, -74.78]
>
>
>
> cgLoadCT, 33, NColors=6, Bottom=1
>
>
>
> lonmin = -125
>
> lonmax = -65
>
> latmin = 25
>
> latmax = 60
>
> centerlon = (lonmax-lonmin)/2.0 + lonmin
>
> centerlat = (latmax-latmin)/2.0 + latmin
>
> limit = [latmin, lonmin, latmax, lonmax]
>
> xrange = [lonmin, lonmax]
>
> yrange = [latmin, latmax]
>
> mapCoord = Obj_New('cgmap', 'Stereographic', Ellipsoid='WGS 84', $
>
> Limit=limit, Center_Lat=centarlat, center_lon=centerlon)
>
>
>
> ; Convert city locations to projected meters.
>
> xy = mapCoord->Forward(city_lons, city_lats)
>
> city_x = Reform(xy[0,*])
>
> city_y = Reform(xy[1,*])
>
>
>
> ; Set up 3-col by 2-row grid.
>
> p = cgLayout([3,2], Aspect=0.5, YGAP=4, XGAP=6, $
>
> OXMargin=[4,4], OYMargin=[4,6])
>
>
>
> ; Draw the plots.
>
> FOR j=0,5 DO BEGIN
>
> pos = p[*,j]
>
> mapCoord -> SetProperty, Position=pos, /Draw
>
> cgMap_Grid, MAP=mapCoord, /Box
>
> cgMap_Continents, MAP=mapCoord, /Continents, /Countries, /USA
>
> cgPlotS, city_x[j], city_y[j], Color=Byte(j+1), PSYM=16, SYMSize=2.0
>
> x = (pos[2]-pos[0])/2.0 + pos[0]
>
> y = pos[3] + (!D.Y_CH_SIZE * 2) / Float(!D.Y_Size)
>
> cgText, x, y, cities[j], /Normal, Alignment=0.5
>
> ENDFOR
>
> END
>
>
>
> ; Run the program in a cgWindow.
>
> cgWindow, 'Map_Test', WXSize=800, WYSize=400, WBackground='White'
>
> END
>
> ;*********************************************************** ********
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

I'm sorry for all the trouble but I tried modifying your code to work with my data and I get both a black background IDL window (which didn't happen in your Map_Test) and a white background resizable graphics window that creates an infinite number of windows until I hard quite IDL. I think this is because Avg2000Lon=float(73) so my code is trying to create 73 windows. Map_Test is based on 6 discrete city lat/lons. How do I modify this to work with my array of values. I'm plotting trajectories so each window has several different trajectories plotted in each graph. Thanks.

Pro Plot6PanelTraj_MOZAICpaper
restore, './DAQPadonia_AvgBackTraj_Flight7.sav'

lonmin = -125
lonmax = -65
latmin = 25
latmax = 60
centerlon = (lonmax-lonmin)/2.0 + lonmin
centerlat = (latmax-latmin)/2.0 + latmin
limit = [latmin, lonmin, latmax, lonmax]
xrange = [lonmin, lonmax]
yrange = [latmin, latmax]
mapCoord = Obj_New('cgmap', 'Stereographic', Ellipsoid='WGS 84', Limit=limit, $
center_lat=centarlat, center_lon=centerlon)

; Convert trajectory locations to projected meter space
xy = mapCoord->Forward(Avg2000Lon, Avg2000Lat)
locx = Reform(xy[0,*])
locy = Reform(xy[1,*])

; Set up 2-col by 3-row grid
p = cgLayout([2,3], Aspect=0.5, YGap=4, XGap=6, OXMargin=[4,4], OYMargin=[4,6])

; Draw plots
for j=0,5 do begin
pos = p(*,j)
mapCoord->SetProperty, Position=pos, /Draw
cgMap_Grid, map=mapCoord, /box
cgMap_Continents, map=mapCoord, /continents, /countries, /usa
cgplotS, locx, locy, color='blue', thick=4
end

; Run the program in a cgWindow.
cgWindow, 'Plot6PanelTraj_MOZAICPaper', WXSize=800, WYSize=400, WBackground='White'
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: make_array function bug
Next Topic: Getting WIDGET_TABLE Number of rows and columns

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 02:35:07 PDT 2025

Total time taken to generate the page: 1.44570 seconds