PDA

View Full Version : !p.multi and MAP



Unregistered
12-07-2005, 08:08 AM
Is there a way of plotting multiple map projections on the same plot in PVWAVE (!P.multi does not appear to work).

brian
12-07-2005, 08:35 AM
Hello,

As a quick example (not much use) I've attached some code. The important point here is the /NoErase keyword on the second MAP command.

--brian

!P.position = [0.3, 0.1, 0.7, 0.9]

TEK_COLOR

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5

!P.position = [0.5, 0.1, 0.9, 0.9]

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /NoErase

brian
12-07-2005, 11:15 AM
Hello,

This, perhaps, is a little more useful.

--brian


!P.position = [0.1, 0.1, 0.45, 0.45]

TEK_COLOR

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5

!P.position = [0.55, 0.55, 0.9, 0.9]

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5, /NoErase

!P.position = [0.1, 0.55, 0.45, 0.9]

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5, /NoErase

!P.position = [0.55, 0.1, 0.9, 0.45]

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5, /NoErase

Unregistered
12-08-2005, 03:58 AM
Thanks Brian,

Specifying the position using !p.position and the /noerase keyword as you suggest works fine.

Having to specify the position of each map projection is a bit tedious though and it would be useful to be able to use the !P.multi command to do this automatically. Perhaps in a future version of PVWAVE!

Bricey
12-09-2005, 08:48 AM
I would agree that this is tedious. I will file a change request.

Can you please email your contact information to support@vni.com so the change request can be associated with your site?

Thanks,
Erika
PV-WAVE Technical Support

brian
12-09-2005, 01:27 PM
Hello,

If calculating the position values are the issue, you may want to try the following. splitscreen() calculates an array of positions (actually the return value is a matrix). The positions are in the same order !P.Multi would generate them, row by row starting in the upper left.

I added a simple driver here to illustrate it's use (all arguments are optional. Default: rows=1, columns=1, margins=.07 and space=.14)

I hope this is of some use.

Regards,

brian



FUNCTION splitscreen, Rows=Rows, Columns=Columns, Margins=Margins, Space=Space

IF KEYWORD_SET(Rows) THEN nr=Rows ELSE nr=1
IF KEYWORD_SET(Columns) THEN nc=Columns ELSE nc=1
IF KEYWORD_SET(Margins) THEN m=Margins ELSE m=.07
IF KEYWORD_SET(Space) THEN s=Space ELSE s=.14


narea=nc*nr
posdata = FINDGEN(4, narea)
harea=(1.0-2.0*m-s*(nc-1))/nc
varea=(1.0-2.0*m-s*(nr-1))/nr

x1=FINDGEN(nc)
x1=m+x1*(harea+s)
x2=x1+harea

y1=nr-FINDGEN(nr)-1
y1=m+y1*(varea+s)
y2=y1+varea

xi=INDGEN(narea) mod nc
yi=INDGEN(narea) / nc

FOR i=0,nc-1 DO BEGIN
index=WHERE(xi EQ i)
posdata(0,index)=x1(i)
posdata(2,index)=x2(i)
ENDFOR
FOR i=0,nr-1 DO BEGIN
index=WHERE(yi EQ i)
posdata(1,index)=y1(i)
posdata(3,index)=y2(i)
ENDFOR

return, posdata
END

PRO mappos

TEK_COLOR

r=2
c=3

pos=splitscreen(row=r,col=c,mar=.07, space=.14)
plot,[0,0],/NoData,XStyle=4,YStyle=4

FOR i=0,(r*c)-1 DO BEGIN

!P.position = pos(*,i)

MAP, Range = [-118.0, 40.5, -110.0, 50.0],$
Data = 'usgs_db', Select = {, state:'ID', county:-1}, $
Thick = 2, /Axes, /Gridlines, Gridcolor = WoColorConvert(10), $
Gridstyle = 1, Gridlong = 1, Gridlat = 0.5,/Noerase
ENDFOR
END