Hi all,
I'm a long-time reader, first-time poster. Thanks in advance for advice!
I would like to superimpose a scatter plot and a line graph. In the legend, I'd like to label the scatter, but not the line. For example, this graph shows what I'd like to keep and what I'd like to suppress:
sysuse auto, clear
tab foreign, nol
sysuse auto, clear
reg price mpg if foreign
predict phat_f
reg price mpg if foreign==0
predict phat_d
twoway (scatter price mpg if foreign, mc(red) ytitle("Price") legend(label(1 "Foreign - keep this"))) ///
(scatter price mpg if foreign==0, mc(blue) legend(label(2 "Domestic - and this"))) ///
(line phat_f mpg, sort lc(red) legend(label(3 "Don't want this"))) ///
(line phat_d mpg, sort lc(blue) legend(label(4 "or this")))
My workaround has been to turn off the entire legend and add text within the plot region, but I'd like to know better.
Thanks again,
Bill
(using Stata 15)
Related Posts with Suppress part of legend when generating multiple twoway graphs
Help with inverse cumulative distribution function commands invcdfPlease help correct this: invcdf PD [if] [in], Reference(str) Generate(DD) cdf(PD). error message is…
Panel Quantile Regression- "Stata issued an error message"Panel Quantile Regression- "Stata issued an error message" Hello everyone, I want to run the Panel …
Fixed effects model: how do I take account of non-uniform time intervals?Good morning all, Hope you're well. Apologies if this is a very basic enquiry but I am still findin…
Splitting dataHi, I have a data set on mortgage lending for single family homes and I have a total of 10,000 obser…
COVID-19 symptoms graphic I was asked off-forum by someone in the medical field if I knew of how to create the graphic below.…
Subscribe to:
Post Comments (Atom)
0 Response to Suppress part of legend when generating multiple twoway graphs
Post a Comment