turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Varying colours in vaxis

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-22-2016 12:24 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-12-2016 09:58 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-12-2016 07:00 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-14-2016 11:39 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-14-2016 09:35 PM

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.