Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: problem adding textbox to graph with 2 y axes


From   Brian Wells Pence <[email protected]>
To   [email protected]
Subject   st: problem adding textbox to graph with 2 y axes
Date   Thu, 27 Oct 2005 09:09:55 -0400 (EDT)

I'm trying to add a text box to a graph that has 2 y axes with different scales. I can add the text to a single graph, and I can add the text to a graph with 2 y variables if they are on the same axis, but when I add a second y axis I get a mystifying error message. I've replicated the problem below using the auto.dta dataset; commands and log are below. Am I doing something wrong?

Thanks,
Brian

. sysuse auto, clear
(1978 Automobile Data)
.
. * Single scatterplot, text added
. twoway scatter mpg weight, text(41 2040 "VW Diesel", place(e))
.
. * Two scatter plots, single y axis, text added
. twoway scatter mpg weight, text(41 2040 "VW Diesel", place(e)) || ///

        scatter turn weight
.
. * Two scatter plots, two y axes with different scales, no text
. twoway scatter mpg weight ||    ///
        scatter turn weight, yaxis(2)
.
. * Two scatter plots, two y axes with different scales, attempt to add text
. twoway scatter mpg weight, text(41 2040 "VW Diesel", place(e)) || ///

        scatter turn weight, yaxis(2)
text() option invalid, specified axis pair (1 1) not in graph
invalid syntax
invalid syntax
invalid syntax
r(198);

end of do-file
r(198);

. * Two scatter plots, two y axes, a different attempt to add text
. twoway scatter mpg weight ||    ///
        scatter turn weight, yaxis(2)   ///
        , text(41 2040 "VW Diesel", place(e))
text() option invalid, specified axis pair (1 1) not in graph
invalid syntax
invalid syntax
invalid syntax
r(198);

end of do-file
r(198);
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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