Hi
I have been working on generating a line plot with error bars. I have defined the graph styles in proc template. I have also used proc template followed by sgrender to generate my graph. The lines generated by using series plot in proc template have the colors that I have defined, but the error bars don't seem to take up the same color. I was hoping that someone could help me with it. Any help would be greatly appreciated. Below is the code that I have used along with the output produced:
Code:
PROC TEMPLATE;
define style mystyle;
parent=styles.rtf;
style GraphData1 from GraphData1 / contrastcolor=black linestyle=1 MarkerSymbol="circle" color=black ;
style GraphData2 from GraphData2 / contrastcolor=BLUE linestyle=2 MarkerSymbol="Triangle" color=BLUE;
style GraphData3 from GraphData3 / contrastcolor=ORANGE linestyle=3 MarkerSymbol="square" color=ORANGE;
style GraphData4 from GraphData4 / contrastcolor=green linestyle=4 MarkerSymbol="PLUS" color=green ;
style GraphData5 from GraphData5 / contrastcolor=MAGENTA linestyle=5 MarkerSymbol="CircleFilled" ;
;
style GraphError /LineThickness = 1px;
END;
run;
*******************************************************************************;
proc template;
define statgraph line;
begingraph / designwidth=12in designheight=8.5in ;
entrytitle ' ';
layout lattice /columndatarange=union rowweights=(0.40 0.60);
*--------------------------------------------------------------------*
| Line Plot
*--------------------------------------------------------------------*;
layout overlay / yaxisopts=(label='Drug Concentration (mg/L)' linearopts=(viewmin=0 viewmax=60 tickvaluelist=(&yvals)))
xaxisopts=(linearopts=(viewmin=0 viewmax=250 tickvaluelist=(&xvals))
display=none label="");
scatterplot x=ndy y=mean/yerrorlower=lower yerrorupper=upper ;
seriesplot x=ndy y=mean / group=treat name="treat" lineattrs=(thickness=2 pattern=1 /*color=red symbol=square*/);
blockplot x=ndy block=ndy/datatransparency=.8 extendblockonmissing=true;
endlayout;
*--------------------------------------------------------------------*
| Bottom Line Plot
*--------------------------------------------------------------------*;
layout overlay / yaxisopts=(label='FeNO Concentration (mg/L)' linearopts=(viewmin=-80 viewmax=160 tickvaluelist=(&yvals)))
xaxisopts=(label="Nominal Time (Days)" offsetmin=0.01 offsetmax=0.01
linearopts=(viewmin=0 viewmax=250 tickvaluelist=(&xvals)));
scatterplot x=ndy y=mean33/yerrorlower=lower33 yerrorupper=upper33 ;
seriesplot x=ndy y=mean33 /group=treat name="treat" lineattrs=(thickness=2 pattern=1) ;
blockplot x=ndy block=ndy/datatransparency=.8 extendblockonmissing=true;
discretelegend 'treat' / location=outside halign=left valign=bottom
order=columnmajor border=false valueattrs=(size=10pt);
endlayout;
endlayout;
endgraph;
end;
run;
ods rtf file="C:/lineplot.rtf" style=smystyle nogfootnote nogtitle bodytitle toc_data headery=720 footery=720 style=mystyle;
ods pdf file="C:/lineplot.pdf" style=mystyle;
proc sgrender data=final template=line ;
run;
Output: