[Thread Prev][Thread Next][Index]

Re: [ferret_users] 2nd Y-scale/lablel color?



hi -
I was thinking I should write some documentation and an FAQ on the viewport trick, and so checked to see what demo scripts and so forth are already around.  Try this, which is based on the first example in multi_variable_demo.jnl
yes? use levitus_climatology

yes? set region/y=0/z=0/x=130e:80w
yes? go left_axis_plot temp

yes? ppl pen 0 3
yes? go right_axis_plot salt
 
The script right_axis_plot already makes a red line plot and a labeled axis on the right. Just changing pen 0 to 3 makes the label and the axis in red.  So if red is the color you want, this is the quickest answer. 

The viewport thing is very flexible. Because it's so flexible, it means the person making the script has to make sure the lines drawn on the plot really make sense to look at together.  You could draw a temperature vs time plot in the first viewport, then a salinity vs longitude plot in the second one, and they'd appear in the same plot space, but without the horizontal axis being labeled on the second plot the person seeing it wouldn't know what they were looking at.

-Ansley

On 12/4/2013 2:36 PM, Luke M wrote:
Hi Hein and Ansley

thank you for your invaluable feedback. Your explanations were very helpful. I should have know that it mostly came down to the old trick of the viewport...







On Tue, Dec 3, 2013 at 8:09 AM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi,
Hein almost has it.  The vertical limits from the example in the FAQ are as he says not what we want on the plot.  For that example, we can leave those arguments to ppl %yaxis blank and let Ferret/PPLUS fill in the right numbers,
ppl pen,0,1
ppl axset,1,1,1,0
plot /x=-100:100 sin(x/10)
plot /over/col=6 /x=-100:100 cos(x/10)
ppl pen,0,6
ppl %yaxis ,,,100,1,2,1,+1
The first 3 values there are the low, high, and delta-y, so you could do this, for instance,
ppl pen,0,1
ppl axset,1,1,1,0
plot /x=-100:100 sin(x/10)
plot /over/col=6 /x=-100:100 cos(x/10)
ppl pen,0,6
ppl %yaxis -1,1,0.05,100,1,2,1,+1

However if the second line plot has an entirely different scale, the plot/over won't draw the second line on the plot.  What I'd use is the two-viewport trick.  Define two identical viewports and make two plots, each in its own viewport.
yes? define view/x=0:1/y=0:1 vfull1
yes? define view/x=0:1/y=0:1 vfull2

yes? set view vfull1
yes? plot/axes=1,1,1,0/x=-100:100/title=" "/set sin(x/10)
yes? ppl ylab sin(x/10)
yes? ppl plot

yes? set view vfull2
yes? ppl pen,0,6
yes? plot/axes=0,0,0,1/x=-100:100/color=6/title=" "  30-cos(x/10)
yes? ppl ylab 30-cos(x/10)
yes? ppl plot


You'd probably want to CANCEL MODE LOGO first...



On 12/3/2013 12:24 AM, Hein Zelle wrote:
Dear Luke,

I'm trying to make an XY plot with 2 y-axis. I was wondering... is there a
way I can change the color for the label & scale of one of the y-axis I am
plotting? In my case, I am trying to make the Y-axis scale & label for the
variable "lux" have a red color.
The label and axis colors are controled by pen 0.  If you
change that one, you'll see the effect.

 ppl pen 0,6
 plot /x=-100:100 sin(x/100)

That makes them all purple.  It becomes easy if you combine this with 

http://ferret.pmel.noaa.gov/Ferret/faq/how-can-i-draw-a-second-vertical-axis-on-a-contour-plot

ppl pen,0,1
ppl axset,1,1,1,0
plot /x=-100:100 sin(x/10)
plot /over/col=6 /x=-100:100 cos(x/10)
ppl pen,0,6
ppl %yaxis 0,60,5,100,1,2,1,+1

I get confused when trying to put the second plot command after ppl
%yaxis command: ferret uses the new yaxis but it seems to use the old
vlimits.  Someone else can probably explain how to do that.

Kind regards,
	
	Hein





[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement