Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: How to start a bar graph with a minimum other than 0
From
Andrew Hsiao <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: How to start a bar graph with a minimum other than 0
Date
Wed, 31 Aug 2011 13:03:09 -0400
Sorry, it's a false-complaint. What happened is that I did not have the continuation symbols "///" before the line with the exclude0 in my syntax, thus not invoking the option at all.
I apologize for the fuss.
Andrew
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, August 31, 2011 12:31 PM
To: [email protected]
Subject: Re: st: How to start a bar graph with a minimum other than 0
I don't notice a difference between
. graph bar (mean) mpg, over(rep78) ysc(r(10,30)) exclude0 yla(10(5)30)
. graph bar (mean) mpg, over(rep78) exclude0 ysc(r(10,30)) yla(10(5)30)
Can you document your claim with publicly available datasets?
Nick
On Wed, Aug 31, 2011 at 5:27 PM, Andrew Hsiao <[email protected]> wrote:
> Thanks, Nick.
>
> Indeed, "cheating" is actually "legal" in Stata. The trick is where you place exclude0. It has to precede ysc(r()). I thought the order is not important. But it is in this circumstance.
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: Wednesday, August 31, 2011 11:50 AM
> To: [email protected]
> Subject: Re: st: How to start a bar graph with a minimum other than 0
>
> You are correct. -yscale(range())- will never exclude what would
> otherwise be shown, but -exclude0- will do what you want (so long as
> the smallest value shown is positive). Consider this sequence.
>
> . sysuse auto, clear
> (1978 Automobile Data)
>
> . graph bar (mean) mpg, over(rep78)
>
> . graph bar (mean) mpg, over(rep78) exclude0
>
> . graph bar (mean) mpg, over(rep78) exclude0 ysc(r(10(10)40))
>
> . graph bar (mean) mpg, over(rep78) exclude0 ysc(r(10,30))
>
> . graph bar (mean) mpg, over(rep78) exclude0 ysc(r(10,30)) yla(10(5)30)
>
> There is no need to cheat.
>
> (A horrible graph, but that's a different issue.)
>
> Nick
>
> On Wed, Aug 31, 2011 at 4:45 PM, Andrew Hsiao <[email protected]> wrote:
>> I just studied the command yscale(range(x y)) in the document a bit more. It seems it is not used to define the range of axis to be shown on the graph. Rather it is used to EXPAND the range of the values in the data. So it does seem that Stata does not allow "cheating" to truncate the bottom part of the graph.
>>
>> It looks the solution is to find the aggregate of the variables (group means) and plot the values directly, using range(50 100) to define the bottom of the graph.
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of Ronan Conroy
>> Sent: Wednesday, August 31, 2011 11:21 AM
>> To: [email protected]
>> Subject: Re: st: How to start a bar graph with a minimum other than 0
>>
>> On 2011 Lún 31, at 15:24, Andrew Hsiao wrote:
>>
>>> I was trying to create a bar graph with a set of group means. The differences between the groups are not big numerically but I'd like to highlight the differences. I want to plot the bars at a value other than 0 (not meant to mislead but to make the point of where they differ).
>>
>> Then try cheating.
>>
>> 1. Subtract a constant value from each mean (looking at your data, you might subtract 70)
>>
>> 2. On the plot, use bogus labels
>>
>> ylabel(0 "70" 5 "75" 10 "80" 15 "85 20 "90", angle(0))
>>
*
* 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/
*
* 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/