Data visualization with SAS programming

Varying colours in vaxis

Reply
Contributor
Posts: 71

Varying colours in vaxis

I use gplot (SAS 9.4.3) with unevenly spaced axis values (see attached) as 3 ranges: -2 to +2, 4.24 to 4.36 and 20 to 42. While I can specify different colours for the axis labels, is there a way to apply different colours to axis values as well?

Thanks. 

SAS Super FREQ
Posts: 1,108

Re: Varying colours in vaxis

It is not clear what your objective is.  Your Y axis has three distince ranges - "-2.0 to 2.0",  "4.24 to 4.36" and "20 to 42".  These are not drawn with a consistent linear scale.  Are they really one graph?  Why not separate it into three graphs, one each for "MD Taps", "Volts" and "Auxiliary MW".

 

Alternatively, you could use bands in the graph to display the three regions, especially if each region does not end exactly at the value on the axis.  With SGPLOT, you can use the BAND statement.

Contributor
Posts: 71

Re: Varying colours in vaxis

Sanjay,

Thanks for your comments. I overlay 5 different graphs with different value ranges on the 2 vertical axises, i.e. 2 graphs on the left axis and 3 graphs on the right axis. I had to split the axis value ranges into non linear groups and was just looking at a way to have the axis value ranges the same colour as the corresponding graphs.

I'll have a look at SGPLOT and BAND as you suggested.

SAS Super FREQ
Posts: 1,108

Re: Varying colours in vaxis

What ius the benefit of multiple plots with different value ranges on one Y axis?  Could you not gain the same insight if the plots were stacked on a common x-axis?  Can you provide a non-confidential example?

Contributor
Posts: 71

Re: Varying colours in vaxis

Hi Sanjay,

Attached is my code and the graph output, haven't been able to attach the dataset, won't accept it.

 

I actually plot 6 variables on a shared x axis and 2 vertical axes. You'll notice the uneven axis ranges in the axis statements for the vertical axes, my aim was to be able to specify different colours for each range so it makes the graph more readable. E.g. in the right vertical axis, to have -2 to 2 in red, 4.24 to 4.36 in purple and the rest in green.


FN graph.gif
Ask a Question
Discussion stats
  • 4 replies
  • 405 views
  • 1 like
  • 2 in conversation