Announcement

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

  • Coefplot: Passing background colours when plotting multiple estimates

    Dear all,

    I am struggling to correctly specify "white" as background colour in SSC coefplot.
    I already went throught the excellent help file and support website but could not solve the issue.

    I am plotting estimates for separate outcomes (plotted in separate panels) and samples (multiple estimates for the same coefficient in the same panel).
    I ran the following codes:

    HTML Code:
    coefplot  (comm_skills_1y,         label(1Y) pstyle(p3)     msymbol(D) graphregion(color(white)) bgcolor(white)) ///
                   (comm_skills_1y_past,     label(1Y - Past) pstyle(p4)     msymbol(S) graphregion(color(white)) bgcolor(white)), graphregion(color(white)) bgcolor(white) bylabel(Communication) ///
                   || ///  
                   (crea_skills_1y,         label(1Y) pstyle(p3)     msymbol(D) graphregion(color(white)) bgcolor(white)) ///
                   (crea_skills_1y_past,     label(1Y - Past) pstyle(p4)     msymbol(S) graphregion(color(white)) bgcolor(white)) ///
                   , graphregion(color(white)) bgcolor(white) bylabel(Creativity) keep(ever_estero_all) xline(0) rename(ever_estero_all = ISM) ci(90)            



    and I got back the picture below.

    Click image for larger version

Name:	Screenshot 2024-04-08 171815.png
Views:	1
Size:	27.1 KB
ID:	1749301


    It seems coefplot passess through the graphregion(color(white)) bgcolor(white) options I entered.
    I also tried passing the background options only in the last set of options but I got back the same result.

    I guess I could edit the graph by hand but I am surprised I cannot automate this in the do file.
    Can anyone please point out where I am going wrong?

    Thanks,
    Luca

  • #2
    You need to provide a reproducible example (see FAQ Advice #12 for details). coefplot graphs are twoway graphs, and the command accepts twoway options. The color of the graph region is defined by the scheme. However, even when choosing the s2color scheme, which was the default in Stata graphs preceding version 18, I do not encounter any problems specifying "white" as the color of the graph region.

    Code:
    sysuse auto, clear
    regress price mpg headroom trunk length turn
    coefplot, drop(_cons) xline(0) scheme(s2mono) graphregion(color(white))
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	32.7 KB
ID:	1749325

    Comment

    Working...
    X