Statalist


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

st: AW: bar graph with 2 y-axes


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: bar graph with 2 y-axes
Date   Mon, 27 Apr 2009 14:07:59 +0200

<> 

There may be specific reasons why you want a bar -graph- but I think a
-line- graph conveys pretty much the same information and does not suffer
from the overlap prob...

*************
clear*
set obs 10

gen year=_n

gen var1=rnormal(5000000,50000)
gen var2=   rnormal(5000000000,5430000)

tw (line var1 year, sort) (line var2 year, yaxis(2))
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Jochen Späth
Gesendet: Montag, 27. April 2009 13:37
An: [email protected]
Betreff: st: bar graph with 2 y-axes

Dear all, 

After screening the statalist and some graphical advice literature in the
last days I still haven't got the clue: 
I need to draw a bar graph for two time series with different scales (e.g.
one in millions, the other in billions) over years. 
Graph bar delivers the desired over-all look as, f.i., in

-graph bar var1 var2,  over(year)-.

But I would like to have two different scales (left and right). 
-graph bar- does not offer such an option with the -over-option - logically.

In -twoway bar-, which has the option for a second vertical axis as in

-graph twoway (bar var1 year, yscale(1)) (bar var2 year, yscale(2))-, 

I have not managed to override the default result that the bars are drawn
one behind the other - I rather want them one beside the other (and grouped
over years). 

Any idea?
Best,
Jochen


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