Hello everyone,
I'm trying to create a combined line and bar graph with two categories for my bar chart. I have monthly data for the line chart, but only annual data for the bar charts (I filled all months of the respective year with the same value). Hence, I typed:
The result is:

As you can see, the first problem is that the second category (here: outflow) completely covers the first category (here: inflow). Thus, I have tried to circumvent this problem by replacing the first six months of "inflow" and the last six month of "outflow" with missing:
Now, the result is:
Although, it looks better now, the problem is that there are small with lines between the bar since one blue/red bar is actually comprised of 6 smaller (identical but separate) bars. I tried to simply disable the lines of the smaller bars by experimenting with the "lintensity(0)" option. However, Stata is telling me that this option is not allowed (probably because I am combining two graphs). Thus, this command does not work:
Does anyone have an idea how I can create such a combined graph which does not suffer from the shortcomings of my current graph.
Thank you in advance!
Best regards,
Sebastian
I'm trying to create a combined line and bar graph with two categories for my bar chart. I have monthly data for the line chart, but only annual data for the bar charts (I filled all months of the respective year with the same value). Hence, I typed:
Code:
graph twoway (bar inflow outflow time) (line leiharb time, lc(black)) if jahr>=1998
As you can see, the first problem is that the second category (here: outflow) completely covers the first category (here: inflow). Thus, I have tried to circumvent this problem by replacing the first six months of "inflow" and the last six month of "outflow" with missing:
Code:
* MANIPULATE VARIABLE FOR GRAPH replace inflow = . if monat>=7 replace outflow = . if monat<=6 * GRAPH graph twoway (bar inflow outflow time) (line leiharb time, lc(black)) if jahr>=1998
Although, it looks better now, the problem is that there are small with lines between the bar since one blue/red bar is actually comprised of 6 smaller (identical but separate) bars. I tried to simply disable the lines of the smaller bars by experimenting with the "lintensity(0)" option. However, Stata is telling me that this option is not allowed (probably because I am combining two graphs). Thus, this command does not work:
Code:
graph twoway (bar inflow outflow time, lintensity(0)) (line leiharb time, lc(black)) if jahr>=1998 option lintensity() not allowed
Thank you in advance!
Best regards,
Sebastian
Comment