BookmarkSubscribeRSS Feed
tal83
Calcite | Level 5
Hi!
I'm running this code, (It's a density plot).
what I want is to have the background grey, and the inside-blue. what I get is the background -grey and the inside -black!! Where can I change it? The "c=blue" option doesn't seem to affect anything.

Thanks in Advance!
Tal
GOPTIONS RESET=all;
axis1 order=(0 to .1 by 0.01) label=(f=swiss h=0.35 cm a=90 'Density') value=(h=2) minor=none;
axis2 label=(f=swiss h=0.35 cm'O3') order=(-10 to 140 by 10) length=6 in offset=(.5 cm) value=(h=1.5) minor=none origin=(1.5 in, 1.5 in);

pattern1 v=solid c=grey;
symbol1 v=none i=join c=blue;
proc gplot data=dens_hh.densplot_O3_&stat. gout=work.b
;
plot density * o3/
name="&stat.o3" areas=2;

run;
7 REPLIES 7
GraphGuy
Meteorite | Level 14
Not sure I'm following, but if you're meaning the background of the whole page gray & the background inside the plot axes blue, then here's what you'd want...

goptions cback=gray;

symbol1 color=yellow value=dot interpol=none;

proc gplot data=sashelp.class;
plot height*age / cframe=blue;
run; Message was edited by: Robert Allison @ SAS
GraphGuy
Meteorite | Level 14
Or, if you're wanting an area plot, with the color under the line blue, and the area not under the line gray, something like this...


goptions cback=white;

pattern1 v=solid c=blue;

symbol1 color=blue value=none interpol=join;

proc gplot data=sashelp.stocks (where=(stock="IBM"));
plot close*date / areas=1 cframe=gray;
run;
tal83
Calcite | Level 5
Thanks for your answers!
What I want is the second option you mentioned, but the symbol's specified color doesn't seem to actually affect the graph's color
Thanks again!

GOPTIONS RESET=all
cback=white
;
pattern1 v=solid c=grey;
symbol1 v=none i=join
c=purple ( I tried all kind of colors. I want it to be blue- but none actually affects it, they all produced the same graph).
;
axis1 order=(0 to .1 by 0.01) label=(f=swiss h=0.35 cm a=90 'Density') value=(h=2) minor=none;
axis2 label=(f=swiss h=0.35 cm'O3') order=(-10 to 140 by 10) length=6 in offset=(.5 cm) value=(h=1.5) minor=none origin=(1.5 in, 1.5 in);


proc gplot data=dens_hh.densplot_O3_&stat. gout=work.c;
plot density * o3/
name="&stat.o3" areas=2;

run;
GraphGuy
Meteorite | Level 14
Generally, the shaded area covers/obscures the line.

If you want a visible line, you can plot a 2nd line (in addition to the area), and overlay that on top of the first one. Something like this, where I added "close*date=2 / overlay" (and specify the desired line color in the symbol2 statement) ...


goptions cback=white;

pattern1 v=solid c=blue;

symbol1 color=blue value=none interpol=join;
symbol2 color=yellow value=none interpol=join;

proc gplot data=sashelp.stocks (where=(stock="IBM"));
plot close*date=1 close*date=2 / overlay areas=1 cframe=gray;
run;
tal83
Calcite | Level 5
Hi!
Thanks again. I'm sorry, i think i misunderstood your second option (English is not my native language).
what i want is a plot like in here:

http://images.google.co.il/imgres?imgurl=http://www.statmethods.net/advstats/images/cdplot.jpg&imgrefurl=http://www.statmethods.net/advstats/glm.html&usg=__5R-Bv_UWJVNz0YjQ9_S547i7tjU=&h=689&w=689&sz=51&hl=iw&start=339&sig2=EggoXZR5PB4a8QPP4b9Txg&tbnid=H8IzCcBt-ZAUNM:&tbnh=139&tbnw=139&prev=/images%3Fq%3Ddensity%2Bplot%26gbv%3D2%26ndsp%3D20%26hl%3Diw%26sa%3DN%26start%3D320&ei=20QES4aaH8ua_QaTx-jhDQ

where the dark-grey area is blue.

GOPTIONS- CBACK=white makes what I want. (white, like in the picture)
so does the color in the pattern statement. (light grey, like in the picture)
but the color in the symbol statement doesn't make the density plot area blue (in the picture it's dark grey)
Thanks,
Tal

PS For some reason i don't have the sashelp.stocks file in my sashelp library.
GraphGuy
Meteorite | Level 14
Hmm ... I guess you're using a version older than v9.2, and sashelp.stocks is a new v9.2 sample data set [note - I *strongly* encourage everyone to upgrade to v9.2, because it has _lots_ of neat new features, etc!]

Ok - there are basically *three* colors you want to control ...

1 - The background of the entire page (goptions cback='white')

2 - The background/area within the axes (cframe=gray)

3 - The area under the line (pattern1 v=s color=blue)

(the color of the symbol statement really has no impact, since the line generated by the symbol statement is obscured/covered by the solid-filled area.)


Here's an example (using v9.1.3 sample data) that demonstrates this:

goptions cback=white;

pattern1 v=solid color=blue; /* color of area below line */
symbol1 value=none interpol=join color=blue; /* not really visible */

axis1 label=(angle=90);
proc gplot data=sashelp.citiday (where=(date le '01jan1990'd));
plot snydjcm*date / areas=1
vaxis=axis1
cframe=graydd /* color of area above line */
;
run; Message was edited by: Robert Allison @ SAS
tal83
Calcite | Level 5
It's working 🙂

Thanks a lot!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1079 views
  • 0 likes
  • 2 in conversation