Announcement

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

  • Changing the bar properties in marginsplot

    Hello everyone,
    please, how can I select a different outline color for marginsplot and change its pattern?
    In other words, how can I specify these options after the command below?
    marginsplot, recast(bar)

  • #2
    Code:
    webuse nhanes2
    qui logistic highbp sex##agegrp##c.bmi
    qui margins sex, at(bmi=(10(5)65))
    set scheme s1color
    *DEFAULT
    marginsplot, recast(bar) saving(gr1, replace)
    *CHANGE BAR AND CI COLORS, FOR EXAMPLE
    marginsplot, recast(bar) plot1opts(bcolor(red)) plot2opts(bcolor(blue)) ///
    ci1opt(color(red)) ci2opt(color(blue)) saving(gr2, replace)
    gr combine gr1.gph gr2.gph
    Res.:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	77.3 KB
ID:	1615742

    Comment


    • #3
      Thanks a lot.
      is there any way to select a different outline pattern and outline color? by outline, I mean the line around the bars.
      in the normal graph bar we apply such a command:
      bar(1, fintensity(inten30) lcolor(blue) lpattern(dash))
      but it doesn't work in marginsplot.

      Comment


      • #4
        You need to include these within plot#opts

        Code:
        webuse nhanes2
        qui logistic highbp sex##agegrp##c.bmi
        qui margins sex, at(bmi=(10(5)65))
        set scheme s1color
        *CHANGE BAR AND CI COLORS, FOR EXAMPLE
        marginsplot, recast(bar) plot1opts(lcolor(red) fcolor(red*0.2)) plot2opts(lcolor(blue) fcolor(blue*0.2)) ///
        ci1opt(color(red)) ci2opt(color(blue))
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	67.0 KB
ID:	1615826

        Comment


        • #5
          Thanks a lot.

          Comment

          Working...
          X