overplot on the right panel in multipanel figure

38 views
Skip to first unread message

Matteo Ottaviani

unread,
Mar 2, 2024, 7:46:34 PM3/2/24
to idl-pvwave
Hi,

I'm pasting below a simplified version of some code I have, where I do not seem to get the Overplot keyword to work correctly. Why is the text not being printed in the right panels, but only in the first plot although I instruct ortherwise? Many thanks in advance to anyone who might help out :)

PRO TESTPANELS

  COMPILE_OPT IDL2

  lambda = [385., 410., 470., 550., 670., 865.]

  xleg = 350

  p1 = PLOT(lambda,findgen(6), POSITION=[.1,.55,.45,.9], /NoData)

  p1a = PLOT(lambda,findgen(6), /Overplot)

  leg2 = TEXT(xleg, 0.5, 'a)', /Data, Overplot=p1) 


  p2 = PLOT(lambda,findgen(6), POSITION=[.55,.55,.9,.9], /NoData, /Current)

  p2a = PLOT(lambda,findgen(6), /Overplot)

  leg2 = TEXT(xleg, 0.585, 'b)', /Data, Overplot=p2) 


  p3 = PLOT(lambda,findgen(6), POSITION=[.1,.1,.45,.45], /NoData, /Current)

  p3a = PLOT(lambda,findgen(6), /Overplot)

  leg3 = TEXT(xleg, 4, 'item 1', color = 'red', /Data, Overplot=p3)

  leg3b = TEXT(xleg, 3, 'item2', color = 'blue', /Data, Overplot=p3)

  leg3c = TEXT(xleg, 1, 'c)',  /Data, Overplot=p3)


  p4 = PLOT(lambda,findgen(6), POSITION=[.55,.1,.9,.45], /NoData, /Current)

  p4a = PLOT(lambda,findgen(6), /Overplot)

  leg4 = TEXT(xleg, 1, 'd)', /Data, Overplot=p4)

 

 END



Chris Torrence

unread,
Mar 4, 2024, 2:08:15 PM3/4/24
to idl-pvwave
Hi,

The TEXT function doesn't have an OVERPLOT keyword. Instead, you want to use TARGET to tell it what graphic you want it to appear on:

lambda = [385., 410., 470., 550., 670., 865.]
xleg = 350
p1 = PLOT(lambda,findgen(6), POSITION=[.1,.55,.45,.9], /NoData)
p1a = PLOT(lambda,findgen(6), /Overplot)
leg2 = TEXT(xleg, 0.5, 'a)', /Data, target=p1)
 
p2 = PLOT(lambda,findgen(6), POSITION=[.55,.55,.9,.9], /NoData, /Current)
p2a = PLOT(lambda,findgen(6), /Overplot)
leg2 = TEXT(xleg, 0.585, 'b)', /Data, target=p2)
 
p3 = PLOT(lambda,findgen(6), POSITION=[.1,.1,.45,.45], /NoData, /Current)
p3a = PLOT(lambda,findgen(6), /Overplot)
leg3 = TEXT(xleg, 4, 'item 1', color = 'red', /Data, target=p3)
leg3b = TEXT(xleg, 3, 'item2', color = 'blue', /Data, target=p3)
leg3c = TEXT(xleg, 1, 'c)', /Data, target=p3)
 
p4 = PLOT(lambda,findgen(6), POSITION=[.55,.1,.9,.45], /NoData, /Current)
p4a = PLOT(lambda,findgen(6), /Overplot)
leg4 = TEXT(xleg, 1, 'd)', /Data, target=p4)

Cheers,
Chris
NV5 Geospatial
p.s. The TEXT function should probably throw an error if you use overplot - I'm not sure why it doesn't...

Matteo Ottaviani

unread,
Mar 4, 2024, 3:49:57 PM3/4/24
to idl-pvwave
AAhhh, the culprit! Thanks much, Chris!
Reply all
Reply to author
Forward
0 new messages