BookmarkSubscribeRSS Feed
CEB
Calcite | Level 5 CEB
Calcite | Level 5

Using gcontour to create a plot with grid lines showing, I get plots in which the grid lines appear in front of the contour lines. Since the grid lines are light gray and the contours are black, this visually looks like the contour lines have breaks in them. Depending on the shape of the contours, the pattern of breaks is quite obvious and distracting, and can even create a Moire effect. I have also tried href and vref lines, but they also break contour lines. Is there a way to put the grid (or ref) lines behind the contours?

I'm also using grid lines with gplot and i=join, in which case the grid appears behind the plotted curves and it looks fine.

Code example:

proc gcontour data=example;

plot y*x=z / nolegend autolabel levels=0 to 5 by 0.5 grid;

run;

Thank you!

2 REPLIES 2
GraphGuy
Meteorite | Level 14

One work-around would be to annotate the grid/reflines, using when='b' to draw them before/behind the rest of the graph...

data anno_grid;
when='b'; color='graydd';
do x_loop=0 to 10 by 2.5;
xsys='2'; ysys='1';
function='move'; x=x_loop; y=0; output;
function='draw'; y=100; output;
end;
do y_loop=0 to 7 by 1.75;
ysys='2'; xsys='1';
function='move'; y=y_loop; x=0; output;
function='draw'; x=100; output;
end;
run;

proc gcontour data=sashelp.lake anno=anno_grid;
plot length*width=depth / nolegend autolabel
  levels=-10 to 0 by 2;
run;

CEB
Calcite | Level 5 CEB
Calcite | Level 5

Yes, and it is probably worth doing if there is not an easier way. Thanks - it was kind of you to take the trouble to write it out, too.

I am going to wait a little while to see if somebody comes up with an easier way, but if not, I will annotate the graph. I was already wondering if I had to use annotation to solve another problem about uneven tick marks, which I will post in another thread.

Thank you!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 788 views
  • 3 likes
  • 2 in conversation