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 #88909 is a reply to message #88908] Wed, 02 July 2014 12:21 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
[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: Sat Oct 11 15:41:28 PDT 2025

Total time taken to generate the page: 2.48000 seconds