Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: RE: overlay bar and line graphs in STATA

From   Nick Cox <>
To   "''" <>
Subject   st: RE: overlay bar and line graphs in STATA
Date   Wed, 18 May 2011 16:11:26 +0100

This could be schematically 

twoway bar y1 t || line y2 t 

You need to think about appropriate scales and whether to have two y axes, but in principle || is the way to overlay. 

What you say about -addplot()- is I think likely to confuse. -addplot()- is not about adding -twoway- types. 

Nick (edited) 

I am using Stata 11.

Wonder if you can help me out on the following:

I have 2 graphs,
1) bar graph: y axis: # of flu positive cases; x-axis: calendar period
2) line graph: y axis: percent of swabs which are flu positive; x-axis: calendar period

the x-axis is common to both graphs.
I now want to create a single graph (bar graph overlay on line graph) with y1 ( # of flu positive cases) and y2 axis (percent of swabs which are flu positive) and x-axis as common.

In stata, can I overlay (not combine side by side) a bar graph on a line graph in the same graph?

The -graph combine- command combines graphs but does not overlay them. The -addplot- option works only if both the graphs to be combined are twoway line graphs.

*   For searches and help try:

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