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
Multiple axes and plots with NG [message #87158] Sat, 11 January 2014 11:17 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
Hi,

I am trying to reproduce the following plot from the coyote library using function graphics, as it similar to a plot of my own that I need to make.

http://www.idlcoyote.com/gallery/#ADDITIONAL_AXES_PLOT

My attempt is below.

Everything seems fine, except for the blue axis, which did not obey the axis range I gave it. I was hoping to use "emptyPlot" as the target for the y-axes, then use the axes as the targets for the plots. This did not work, though, since each additional axis reset the axis ranges of the others...

Can anyone help improve this?.... I was hoping to use the Target and Overplot keywords more, and not just position one plot on top of the other, then hide their axes...

Thanks in advance

--------------

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

;Create the empty plot. Hide the y-axes.
emptyPlot = Plot(data_1, Position=position, /NoData)
emptyAxes = emptyPlot.AXES
emptyAxes[1].HIDE = 1
emptyAxes[3].HIDE = 1

;Add the first set of data and the left axes.
location = emptyPlot.ConvertCoord(position[0:1], /Normal, /To_Data)
Plot1 = Plot(data_1, /Current, Overplot=emptyPlot, Color='red', Thick=thick)
Axis1 = Axis('Y', Location=location, Target=emptyPlot, Color='red', Title='Data 1')

;Add the second set of data. Turn off the axes.
Plot2 = Plot(data_2, /Current, Position=position, Color='green', LineStyle=2, Thick=thick)
Plot2Axes = Plot2.AXES
ForEach ax, Plot2Axes do ax.HIDE=1

;Add the right axis
location = Plot2.ConvertCoord(position[2:3], /Normal, /To_Data)
Axis2 = Axis('Y', Location=location, Target=Plot2, TextPos=1, Color='green', Title='Data 2', Axis_Range=[0,1000])

;Add the third set of data. Turn off the axes
Plot3 = Plot(data_3, /Current, Position=position, Color='blue', LineStyle=1, Thick=thick)
Plot3Axes = Plot3.AXES
ForEach ax, Plot3Axes do ax.HIDE=1

;Add a third axis
location = Plot3.ConvertCoord([0.85, 0.15], /Normal, /To_Data)
Axis3 = Axis('Y', Location=location, Target=Plot3, TextPos=1, Color='blue', Title='Data 3', Axis_Range=[0.1,100], /Log)
[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 14:08:13 PDT 2025

Total time taken to generate the page: 0.00264 seconds