Statalist


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

RE: st: RE: graph bar stacked loop question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: graph bar stacked loop question
Date   Tue, 19 Jan 2010 16:28:26 -0000

Maarten answered your question, but other takes are possible. One is to lose the legend and make sure that country names are next to the bars they represent. 

Nick 
[email protected] 

Leandro Brufman

Thanks Nick, it worked perfectly, now every country's bar has the same
color for each one of the graphs. One additional question: I would
like to suppress the legend, as it is the same for every graph. But at
the same time I would like to have it somewhere (maybe on an empty
graph with only the legend of the previous graphs) as a reference.

If I leave it as it is now, every graph has the legend, and besides it
is redundant, it is a big legend that distorts the graph proportions.
But if I set - legend(off) - I don't know what does each color mean.

On Fri, Jan 15, 2010 at 1:17 PM, Nick Cox <[email protected]> wrote:

> You might be able to fudge this by replacing zeros with smidgens so that
> each graph shows a bar for every country but one of negligible height
> when the real value is zero.

Leandro Brufman

> I am running a loop that repeats the same stacked bar graph for
> different individuals (`x').
>
> graph bar (sum)  w1pct*, over(report_month) over(report_year) nolabel
> stack title(`x') subtitle(Country Composition) nofill
>
> As you can see, the graph shows the variables w1pct* stacked. Those
> variables are countries. It shows the evolution of a portfolio country
> composition over time, and I am repeating it for different Banks.
>
> I want to have every country with the same colours across Banks, and I
> don't know how to do it. I know that Stata assigns keys to each
> variable and that I can change that with order(). But the problem is
> that some Banks do not have any asset of, say, Angola. So the keys
> change from Bank to bank, and colors change as well.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index