[Thread Prev][Thread Next][Index]

Re: [ferret_users] color of multiple x-axis

Perhaps a better way to do this would be to draw 2 overlapping plots, and have the left-side axis be black and the right side red. Here's an example:

yes? let xx=x[gx=0:10:1]	  ! define x-values for the example
yes? set vi full			  ! independent viewport
yes? ppl axset,1,1,1,0		  ! draw only the top,bottom,left axes
yes? plot/nolab sin(xx)	  ! make a plot
yes? def vi/xli=0,1/yli=0,1 full2   ! define a second identical viewport
yes? set vi full2			  ! use full2 to make an overlapping plot
yes? ppl axset,0,0,0,1		  ! draw only the right-side axis
yes? ppl pen,0,2			  ! set the axis pen to be red
yes? ppl axlabp,,1		  ! labels on the right
yes? plot/nolab/col=2 cos(xx)+6	  ! plot the second curve with a red pen
yes? ppl axset,1,1,1,1;ppl axlabp,,-1;ppl pen,0,1   ! clean up

You may need to make the plot narrower to fit y-axis labels on both sides:

def vi/xli=0,.95/yli=0,1 narrow1
def vi/xli=0,.95/yli=0,1 narrow2

Billy K

On Dec 28, 2006, at 1:37 PM, Ansley Manke wrote:

Hi Jang,
Probably the simplest way to do this is to draw over the x axis with a colored line, using the PLOT/VS command. Here is how to do this on a single plot: Draw the plot. When it is drawn, Ferret defines symbols xaxis_min, xaxis_max, yaxis_min, yaxis_max.

yes? plot my_var ! draw your plot. This can use any plot, shade, fill commands

yes? plot/over/vs/line/color=red/nokey {($xaxis_min), ($xaxis_max)}, {($yaxis_min), ($yaxis_min) }

The { } syntax creates a variable out of a list of values; in this case the x and y coordinates of the start and end of the x axis.

I think you should be able to do something similar with your multiple plots, using the same method.


Chan Joo Jang wrote:
Dear Ferret users:

I wonder if ferret can have different colors of each axis line when I use multiple x-axis.

In other words, how can I have, say, a red  x-axis line?


------------------------------------------------ Currently at Dep. of Oceanography, Texas A&M Univ Chan Joo Jang, Ph.D., researcher Korea Ocean Research and Development Institute 1270 Sa2-dong, SangRok-gu, Ansan 426-744, Korea Tel: +82-31-400-6317 Fax: +82-31-408-5827 cjjang@xxxxxxxxxxx, http://ogcm.kordi.re.kr ------------------------------------------------

-- ~> ~> ~> ~> ~> ~> ~> ~> ~> ~> ~> Ansley Manke, NOAA/PMEL ansley.b.manke@xxxxxxxx 7600 Sand Point Way NE, Seattle WA Phone 206-526-6246, FAX 206-526-6744

William S. Kessler
NOAA / Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle WA 98115 USA

Tel: 206-526-6221
Fax: 206-526-6744
Home page: http://www.pmel.noaa.gov/people/kessler/

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement