-mylabels- is a user-written program from SSC.
I can reproduce something like this result some but
not all of the time. I think the problem lies in
your -twoway- call. I'd omit the parentheses in
twoway (connected slavepr year if year<=1860)
and I think the problem will go away, but I'm
not sure why that is.
Nick
[email protected]
John D. Levendis
> I've got a question about a program called "mylabels".
>
> Here's what I'm trying to do.
>
> I've got data on yearly prices, a small bit of which looks like:
> 373.5416
> 343.0145
> 409.1766
> 449.1369
> 491.1221
> 490.6828
> 479.1853
> 882.5421
> 1218.8488
>
>
> From these, I can generate a price index by dividing by the
> first period's
> prices.
> - gen PI = prices/prices[1]
>
>
> I would like to graph both of these series on one graph.
> They should align perfectly. On the left y-axis, I'd
> like the ticks to correspond to the values from "prices".
> On the right axis, I'd like the ticks to correspond
> to the values from "PI". But graphing both series on the
> same graph doesn't get them to align perfectly. (ie,
> twoway line slavepr year || line PI year , yaxis(2) doesn't work)
>
>
> Nick Cox has suggested using -mylabels but I'm having problems
> with it. (see the statalist archives
> http://www.stata.com/statalist/archive/2004-02/msg00402.html )
>
>
>
> Here's what I tried:
>
>
> mylabels 1(.2)3 , myscale(@*373.5416) local(labels)
>
> #delimit ;
> twoway (connected slavepr year if year<=1860 ) ,
> title("Avg price AND Index ")
> yaxis(1 2)
> ylabel(300(100)1200 , ang(h) axis(1) )
> ylabel(`labels' , ang(h) axis(2) ) ;
> #delimit cr
>
>
>
>
> I get the following output and error message:
>
>
> . mylabels 1(.2)3 , myscale(@*373.54156) local(labels)
> 373.542 "1" 448.25 "1.2" 522.958 "1.4" 597.666 "1.6" 672.375
> "1.8" 747.083 "2"
> 821.791
> "2.2" 896.5 "2.4" 971.208 "2.6" 1045.92 "2.8" 1120.62 "3"
>
> .
> .
> . #delimit ;
> delimiter now ;
> . twoway (connected slavepr year if year<=1860 ) ,
> > title("Avg price AND Index ")
> > yaxis(1 2)
> > ylabel(300(100)1200 , ang(h) axis(1) )
> > ylabel(`labels' , ang(h) axis(2) ) ;
> ylabels( 373.542 Unknown function 1" 448.25 "1.2" 522.958 "1.4"
> 597.666 "1.6" 67
> > 2.375 "1.8" 747.083 "2" 821.791 "2.2" 896.5 "2.4"
> 971.208 "2.6"
> 1045.92 "2.8"
> > 1120.62 "3" , ang()
> r(133);
>
>
>
>
> Whats up with that "Unknown function 1" bit?
>
> Can anyone think of a workaround?
*
* 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/