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
Reshaping variable from wide to long and joining it to a pre-existing long variableGreetings, I'm running Stata 15.1 on OSX. I suspect the subject line was confusing so allow me to e…
Analyzing subsample of datasetDear Stata users, I think I have a quite easy question, but since i am new to Stata I haven't been …
Probit Model : Joint significance of variables & Estimated EffectSuppose I estimate the following model: Code: probit y1 x1 x2 x3 x4 where y1 is binary variable, x…
Generating simple summary statistics tablesHello - I would like to do something that should be relatively simple: generate a table of summary s…
Generating trimestral averages with panel datasetHello, I have an unbalanced panel for 24 different companies with monthly data from 1995 to 2019 an…
Subscribe to:
Post Comments (Atom)
0 Response to Suppress part of legend when generating multiple twoway graphs
Post a Comment