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: hbar graph & colour


From   María Edo <[email protected]>
To   [email protected]
Subject   Re: st: hbar graph & colour
Date   Mon, 21 Feb 2011 09:25:03 -0300

Dear Sergiy, Nick,

thanks for your answer.
The code you suggested works perfectly well with my real data.

Maria


2011/2/20 Nick Cox <[email protected]>:
> Please think again. A fair fraction of the population is red-green
> colour-blind.
>
> I suggest looking at e.g http://colorbrewer2.org/ and selecting a
> scheme that is more sensitive and is consistent with your other
> desiderata. Otherwise how about
>
> clear
> input country   gdp   colour
> 1  100    1
> 2  110    2
> 3  240    3
> 4  50     1
> 5  10     1
> end
> graph hbar  gdp, asyvars over(colour) over(country, sort( gdp) descending) ///
> bar(1, color(blue)) bar(2, color(orange)) bar(3, color(pink)) nofill
>
> Even greater flexibility is given by recasting the problem as one for
> -twoway bar-.
>
> Nick
>
> On Sun, Feb 20, 2011 at 1:57 AM, María Edo <[email protected]> wrote:
>> Hello,
>>
>> I need to construct a horizontal bar graph using three colours: two
>> different colours to highlight two particular bars (say, red and
>> green) and one colour for the rest of the bars (say, blue).
>>
>> So far, I have managed to get two colours in the graph by using the
>> -over- option:
>>
>> input country   gdp   flag1 flag2
>> 1  100    0       0
>> 2  110    0       1
>> 3  240    1       0
>> 4  50     0       0
>> 5  10     0       0
>> end
>> graph hbar  gdp, asyvars over(flag1) over(country, sort( gdp)
>> descending) bar(1, color(blue)) bar(2, color(red)) stack
>>
>> To get the graph I need, country "2" should appear in green.
>>
>> I am sure there is a trivial way of achieving this, but I haven't been
>> able to find it.
>
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index