{EDIT: To not accidentally attach a million versions of the graph, like a dummy}
Hi all,
Been trying a bunch of different solutions to this, but I have a marginsplot that I have recast to a bar graph to show the predictive margins at two different points in the distribution for 3 different groups. My basic problem is that I would like to highlight the fact that the bars are for three separate groups using different colors for each set of 2 bars. The below example (slightly modified from this very helpful post) doesn't have the same sets of groups, but is an easy way to show the basic problem
Which produces this graph:

Now imagine that I want to color each of those bars a different color. I tried this suggestion:
But alas - I get the same error as the person replying on that thread: "option plot2opts() not allowed". Interestngly, plot1opts() alone does not throw an error. I think this + the help file suggests to me that plot#opts is for controlling multiple plots, not multiple plot elements within a given plot. So I'm stuck, but have tried a shot in the dark with things such as:
But to no avail. Any suggestions?
Hi all,
Been trying a bunch of different solutions to this, but I have a marginsplot that I have recast to a bar graph to show the predictive margins at two different points in the distribution for 3 different groups. My basic problem is that I would like to highlight the fact that the bars are for three separate groups using different colors for each set of 2 bars. The below example (slightly modified from this very helpful post) doesn't have the same sets of groups, but is an easy way to show the basic problem
Code:
sysuse auto, clear reg price c.mpg##foreign margins, at(mpg=(20 30 40) foreign=(0 1)) vsquish marginsplot, xdim(mpg foreign) recast(bar) plotopts(barw(.8)) xlabel(,labsize(vsmall))
Now imagine that I want to color each of those bars a different color. I tried this suggestion:
Code:
marginsplot, xdim(mpg foreign) recast(bar) plotopts(barw(.8)) xlabel(,labsize(vsmall)) /// plot1opts(fcolor(cranberry)) plot2opts(fcolor(midblue))
Code:
marginsplot, xdim(mpg foreign) recast(bar) plotopts(barw(.8)) xlabel(,labsize(vsmall)) /// plotopts(barw(.8)) marker(1, mfcolor(cranberry)) marker(2, mfcolor(cranberry)) marker(3, mfcolor(midblue))
Comment