Announcement

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

  • linepattern for rarea and rspike in a custom graph scheme

    I am creating a custom scheme in order to save time in creating my Stata plots. I would like to set the scheme to draw shaded confidence intervals with no outline around them. This is straightforward with commands such as lfitci, but I am having trouble when it comes to rarea and rspike plots, which I commonly use when creating marginal effects plots using margins... , plot.

    The specific problem is that if set the scheme to erase the outlines on rarea graphs, by entering the following command in my scheme

    linewidth pother none

    then it also erases the lines on rspike and rcap graphs (and probably some others too). I would like to know if it is possible to write a scheme that erases those outlines for rarea plots but not for the others plots.

    To illustrate what I have, and what I want, here is some simple code.


    clear
    set obs 100
    gen x = rnormal()
    gen z = rnormal()
    gen y = x + z + x*z + rnormal(0,2)

    reg y c.x##c.z
    margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(recastci(rarea) scheme(myscheme))


    Click image for larger version

Name:	twomargins1.jpg
Views:	1
Size:	44.1 KB
ID:	1466847

    ^ This is what I want, and it is produced by (linewidth pother none) in the scheme file. But that line also produces, with the default rcap plot,


    margins, at(x=(-2 -1 0 1 2) z=(-1 0 1)) plot(scheme(myscheme))
    Click image for larger version

Name:	twomargins2.jpg
Views:	1
Size:	38.5 KB
ID:	1466848

    ^ i.e., the rcap lines and caps for the confidence intervals are missing. I can add them by manually adjusting the ci#opts... entries but that is now undermining the point of the exercise of making a scheme. If I remove (linewidth pother none) from the scheme file, the rcap lines and caps reappear as they should, but then the rarea plot looks like this:

    Click image for larger version

Name:	twomargins3.jpg
Views:	1
Size:	53.0 KB
ID:	1466849

    ... and I do not like those outlines. If anyone knows of a way to adjust the properties of rarea but not rcap and other plots in a Stata custom scheme, it'd be a great help.



  • #2
    Have you checked the documentation for brewscheme? I’ve tried to make as much of the documentation for schemes as consolidated as possible. I think confidence intervals might have difference references which could be why pother fails.

    Comment


    • #3
      Thanks for sharing this. I tried to install brewscheme, and ran into trouble when giving it a test drive:


      . brewscheme, scheme(set1) allst(set1) allc(5) allsat(80)
      Directory exists and rebuild option not specified. No further action
      Directory exists and rebuild option not specified. No further action
      file /Users/tp253/Library/Application Support/Stata/ado/personal/brewcolors/colordb.dta not found
      stata(): 3598 Stata returned error
      brewcolors::new(): - function returned error
      brewcolors(): - function returned error
      <istmt>: - function returned error


      I found the same error when installing from ssc and when installing from github. I'm running Stata SE 15.1 on a Mac.

      Comment


      • #4
        Did you run the commands to build out the associated files required after installation? I can’t remember it off the top of my head, but it should be described in either the project README or in the documentation on the project site. Otherwise, if you could submit an issue with the exact steps you took so I can replicate the issue I can try to work on it as my time permits.

        Comment


        • #5
          Ah yes, that fixed it. Brewscheme is remarkable--and the scheme files that it generates are tremendously useful as a guide. But I still don't see anything that allows me to specify unique attributes for rarea, rcap, and related plots. As far as I can tell, both are controlled under p#other.

          Comment

          Working...
          X