Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Problem with bar chart


From   William Buchanan <william@williambuchanan.net>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Problem with bar chart
Date   Fri, 12 Apr 2013 06:51:10 -0700

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 <merveakbas@gmail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index