Bookmark and Share

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: RE: graph hbar - different colors for different groups defined by an external variables


From   Alice Guerra <[email protected]>
To   [email protected]
Subject   Re: st: RE: graph hbar - different colors for different groups defined by an external variables
Date   Fri, 20 Sep 2013 17:16:39 +0200

Thank you Joe,

my command is

graph hbar (mean) g0, over(regione, sort(g0) descending label(labsize(vsmall)))

The graph that I would like to obtain have on the yaxis the name of
the Italian regions, and the color of their bars should reflect their
geographical position. For example, if the first region at the top of
the y-axis  is Lombardy, and Sicily is the second one, I would like to
color the first bar in black (color that corresponds to the North),
and the second in gray (color of the South).

Thank you for your help

Alice

On 20 September 2013 17:07, Joe Canner <[email protected]> wrote:
> Alice,
>
> Try:
>
> . graph hbar yvar, over(geo) asyvars bar(1, color(black)) bar(2,color(gray)) bar(3,color(white))
>
> Or were you hoping to have something more general that doesn't depend on knowing the ordering of the -geo-?
>
> Regards,
> Joe Canner
> Johns Hopkins University School of Medicine
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Alice Guerra
> Sent: Friday, September 20, 2013 10:53 AM
> To: [email protected]
> Subject: st: graph hbar - different colors for different groups defined by an external variables
>
> Dear Statalists,
>
> I was wondering if it would be possible to have different colors in a graph hbar for different groups. The groups are defined by an external variable.
>
> In my dataset, I have the Italian regions. I want to plot them in a graph hbar, and I want to color the bars of the Northern regions in black, the bars of the Southern regions in gray, and the central regions in white. the external variable for the geographic ripartition of regions is called "geo".
>
> Thank you for your time and help.
>
> Best regards
>
> Alice
> *
> *   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/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index