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

Home » Public Forums » archive » Multiple axes and plots with NG
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 axes and plots with NG [message #87159 is a reply to message #87158] Sun, 12 January 2014 19:20 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Matthew,

Well, first of all, your final plot looks really nice. Just like David Fanning's. Second, I don't think you can really improve the code much. By definition, once a plot is created, then all other plots that go on top of it (using say /overplot) must share the same "data space". In other words, they are all assumed to have the same data units. So your method of doing a new plot with /current is more or less correct. I was able to simplify your code a little bit by avoiding the original "empty" plot, and also by suppressing the axes for the later plots:

data_1 = cgScaleVector(cgDemodata(17), 0.0, 1.0)
data_2 = cgScaleVector(cgDemodata(17), 0.0, 1000.0)
data_3 = (Findgen(101)+1) / 5

position = [0.15, 0.15, 0.7, 0.820]
thick = 2

;Add the first set of data and the left axes.
Plot1 = Plot(data_1, Color='red', Thick=thick, Position=position, Ytitle='Data 1')
ay1 = Plot1['Axis 1']
ay1.Color = 'red'
ay3 = Plot1['Axis 3']
ay3.hide = 1

;Add the second set of data. Turn off the axes.
Plot2 = Plot(data_2, /Current, AXIS_STYLE=0, Position=position, Color='green', LineStyle=2, Thick=thick)

;Add the right axis
Axis2 = Axis('Y', Location=[(Plot2.xrange)[1], 0, 0], Target=Plot2, TextPos=1, $
Color='green', Title='Data 2')

;Add the third set of data. Turn off the axes
Plot3 = Plot(data_3, /Current, AXIS_STYLE=0, Position=position, Color='blue', LineStyle=1, Thick=thick)

;Add a third axis
xr = Plot3.xrange
Axis3 = Axis('Y', Location=[xr[1]+0.25*(xr[1]-xr[0]),0,0], Target=Plot3, TextPos=1, $
Color='blue', Title='Data 3', /Log)



Hope this helps!

Cheers,
Chris
ExelisVIS
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mann-Kendall test. Here
Next Topic: Why are you still here?

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

Current Time: Wed Oct 08 18:29:22 PDT 2025

Total time taken to generate the page: 0.00550 seconds