|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Graph note label ("Graphs by")
Hi,
I have a follow-up question to a question answered helpfully by people
on this list a few days ago.
My goal is simply to put a P value on a graph either in a text box or
in the caption using *code*, not the Graph Editor.
I have a graph with one plot region with two separate graphs, based on
the value of a certain grouping variable.
At the bottom of the graph, there is a note stating "Graphs by..."
followed by the variable's label. I would like to replace this whole
bit of text with the P value, but I cannot find out how. Each time I
try to add a note or caption, the note or caption is repeated for each
"instance" of the graph (see example code below). The text I want to
replace is the "Graphs by..." bit. That is, instead of " P = 0.5"
showing up below each graph in the code snippet below, I would like it
to replace the very bottom text.
Does anyone know how to do this? Many thanks!
Phil Jones
Code to replicate the issue:
--------------------------------------
clear *
input group ease
1 1
1 2
1 3
1 3
1 3
1 3
1 4
1 5
1 5
2 2
2 2
2 2
2 3
2 3
2 4
2 4
2 5
2 5
end
label variable group "Group to which the patient was randomized"
label define group 1 "GSS" 2 "Malleable"
label values group group
graph twoway ///
(histogram ease if group==1, by(group, legend(off)) discrete
frequency xtick(1(1)5) xlabel(1(1)5) ymtick(##5) gap(5) color(navy))
|| ///
(histogram ease if group==2, by(group) discrete frequency xtick(1(1)
5) xlabel(1(1)5) gap(5) color(maroon) note("P = 0.5"))
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/