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: Problem with bar chart
From
Merve Akbas <[email protected]>
To
[email protected]
Subject
Re: st: Problem with bar chart
Date
Fri, 12 Apr 2013 11:27:55 -0400
Billy and Matt,
Thanks so much!
You both were very helpful. Billy I tired just collapsing across Gain
and Loss and then reshape so that they are 2 variables, and it
worked!
Matt, I will also try your suggestion - it would be better if I can do
it without collapsing and reshaping...
Thanks so much!
merve
On Fri, Apr 12, 2013 at 10:27 AM, Barclay Matthew (SHEFFIELD TEACHING
HOSPITALS NHS FOUNDATION TRUST) <[email protected]> wrote:
> I think Billy's correct about this.
>
> However, if you take a look at http://www.stata.com/statalist/archive/2011-01/msg00599.html, you will see that
>
> graph bar avrpercr_b, over(condition, gap(0)) asyvars over(block)
>
> is one solution.
>
> Best wishes,
> Matt
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of William Buchanan
> Sent: 12 April 2013 14:51
> To: [email protected]
> Subject: Re: st: Problem with bar chart
>
> You are only creating a bar - in a sense - for avrpercr_b and are partitioning it over the variables in the -over()- options. The easiest way I've found to deal with these situations (since the normal solution typically evades me at the time I need it) is to create a dataset with the appropriate summary statistics and then use the -(asis)- optional argument to work around it. Michael Mitchell's book is almost always helpful in these instances (available from StataPress).
>
> HTH,
> Billy
>
> Sent from my iPhone
>
> On Apr 12, 2013, at 6:41, Merve Akbas <[email protected]> wrote:
>
>> Dear statalist members,
>> I have a very simple dataset (the one below)
>> And I want to create a barchart that compares the means of the
>> variable "avrpercr_b" between Gain and Loss, for each block.
>>
>> I use this command in stata
>>
>> graph bar avrpercr_b, over(condition, gap(0)) over(block)
>>
>>
>> Which does the job, but it doesn't make the Gain and Loss bar colors different.
>>
>>
>> They both are blue and when I try to change the color of one bar - it
>> dyes all of the bars.
>>
>>
>> If you could help me figure out what is wrong, it would be so highly
>> appreciated!
>>
>> Thanks in advance!
>>
>> Merve Akbas
>>
>>
>>
>>
>> subid blockcondition avrpercr_b
>> 101 1 Gain .74
>> 101 2 Gain .78
>> 101 3 Gain .52
>> 101 4 Gain .78
>> 102 1 Gain .48
>> 102 2 Gain .58
>> 102 3 Gain .54
>> 102 4 Gain .58
>> 201 1 Loss .5
>> 201 2 Loss .62
>> 201 3 Loss .64
>> 201 4 Loss .62
>> 202 1 Loss .9
>> 202 2 Loss .86
>> 202 3 Loss .82
>> 202 4 Loss .86
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
>
> ********************************************************************************************************************
>
> This message may contain confidential information. If you are not the intended recipient please inform the
> sender that you have received the message in error before deleting it.
> Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
> to do so is strictly prohibited and may be unlawful.
>
> Thank you for your co-operation.
>
> NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
> NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
> NHSmail provides an email address for your career in the NHS and can be accessed anywhere
>
> ********************************************************************************************************************
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
--
Merve Akbas
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/