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

RE: st: RE: Automatically changing -ylabel()- values using -graph-


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Automatically changing -ylabel()- values using -graph-
Date   Wed, 8 Jun 2005 02:04:41 +0100

There is a factor of 10 adrift between these two examples. 

Your example based on Scott's code has (e.g.) "50" plotted
at 0.05, i.e. the ratio shown / underlying is 1000. 

Your example using -mylabels- has (e.g.) "50" plotted
at 0.5, i.e. the ratio is 100. 

Hence results _should_ differ. 

Incidentally, I noted during a look at the help 
of -mylabels- that the one of the examples there 
is the wrong way round, and has been for a couple 
of years. That was probably the trigger for your 
original confusion. I'll get it fixed. 

As I am currently asleep, and this response is produced
automatically, I will look at the graphs when I get them 
and are awake. 

Nick 
n.j.cox@durham.ac.uk 

Clive Nicholas
 
> Nick Cox replied:
> 
> > Your call is the wrong way round. You want (e.g.)
> > the text "25" at 0.25. Stata's ignoring your label
> > rules as irrelevant to the data you have. Start with
> >
> > mylabels 0(25)100, myscale(@/100) local(label100)
> >
> > Think "my graph labels that I want are 0(25)100, but
> > my data scale is that of the labels divided by 100".
> >
> > I invented this beast, but I make the same mistake
> > too some fraction of the time.
> 
> Thanks for this. I followed this to the letter before calling the same
> -twoway line- command (see below), but I'm _still_ not achieving the
> result I want. I don't why. Following Scott Merryman's suggestion to:
> 
> . twoway line beconch belabch beldmch quarter, xtitle("") ///
>   ylabel(.1 "100" .075 "75" .05 "50" .025 "25" 0 "0" -.025 "-25" ///
>   -.05 "-50" -.075 "-75" -.1 "100", angle(0)) xlabel(1 "Q1" ///
>   2 "Q2" 3 "Q3" 4 "Q4") clpattern(longdash dash) scheme(s1mono)
> 
> produces exactly the graph I expect to see. I should also 
> have mentioned
> that my scale runs from -100 through zero to +100 (sorry 
> about that), but
> the same problem ensues anyway. If I run
> 
> . mylabels -100(25)100, myscale(@/100) local(label100)
> -1 "-100" -.75 "-75" -.5 "-50" -.25 "-25" 0 "0" .25 "25" .5 
> "50" .75 "75"
> 1 "100"
> 
> . myticks -100(25)100, myscale(@/100) local(tick100)
> -1 -.75 -.5 -.25 0 .25 .5 .75 1
> 
> and then
> 
> . twoway line beconch belabch beldmch quarter, xtitle("") ///
>   ylabel(`label100', angle(0)) xlabel(1 "Q1" 2 "Q2" 3 "Q3" 4 "Q4") ///
>   scheme(s1mono) ymtic(`ticks100')
> 
> I get a heavily squashed graph where all three trendlines 
> deviate no more
> than +/-10 percentage points around zero, whereas I should be 
> seeing all
> sorts of sexy stuff going on all over the graph. I'll take 
> the liberty of
> e-mailing the graphs privately to Nick, as it's not possible to
> demonstrate here the visual difference between the graph I should be
> getting (the 'right' graph) and the one I'm getting instead using
> -mylabels- (the 'wrong' graph).
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index