Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I display the bars next to each other instead of on top

    I am trying to display a graph that contains two bar graphs and two scatter plots. I have attached the code below:
    *White Hispanics and Non-Hispanic Whites
    graph twoway (bar inc_ME year if (race == 100 & hispan != 0 & hispan != 901 & ///
    hispan != 902), yaxis(2) ytitle("Margin of Error", axis(2))) ///
    (bar inc_ME year if (race == 100 & (hispan == 0|hispan == 901| hispan == 902)), ///
    yaxis(1) ytitle("Margin of Error", axis(1))) ///
    (scatter inc_mean year if (race == 100 & hispan != 0 & hispan != 901 & hispan ///
    != 902), yaxis(1) ytitle("Mean of Income") msymbol(O)) ///
    (scatter inc_mean year if (race == 100 & (hispan == 0|hispan == 901| ///
    hispan == 902)), yaxis(1) ytitle("Mean of Income") msymbol(O)), ///
    title("Income Margin of Error and Mean") ///
    xtitle("X Axis") ///
    legend(order(1 "MOE White-Hispanics" 2 "MOE White Only" ///
    3 "Mean Income White-Hispanics" 4 "Mean Income White"))
    My problem is that when this is run the bar graphs are stacked on top of each other instead of next to each other so they are both visible. How can I fix this?

  • #2
    We can't run your code because we don't have your variables and we can't see what the code produces because you don't include the output.

    Either we should generate some data that looks similar to yours (which we don't see) or we should see clearly (from past experience) what the 15-line code will result in.

    Comment

    Working...
    X