I have a complicated graph that I have multiples of for different categories and would like to simplify slightly by using the , by() feature of the graphing tools to get everything in a single image (rather than creating a separate image for each category).
I would like to display the mean for each category using text and a simple yline, but am unsure how to go about this.
The following code creates a simple version of what I'm after, but I'd like the mean value for each subtype to be displayed (or used to create a yline).
I've been searching for ages, and trying different combinations of things, but so far to no avail!
Thank you kindly,
Simon.
Code:
sysuse auto, clear twoway scatter price mpg, by(foreign) /// subtitle("Mean price: <insert mean for subtype here> ", suffix ring(0) pos(1) nobexpand fcol(none) lcol(white)) yline() // with a value inside the yline brackets equal to the mean for the relevant subtype
0 Response to different yline/subtitle in a by() plot
Post a Comment