Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Graph note label ("Graphs by")


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: Graph note label ("Graphs by")
Date   Mon, 09 Nov 2009 09:28:11 -0500

Note the placement of the two notes in this command:

sysuse auto
gr twoway scatter mpg price, by(foreign, note("Note for overall graph")) note("Note for each plot")


That is, the -note()- for the overall graph is a suboption of -by()-

- Nick Winter

Philip Jones wrote:
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/

--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index