Announcement

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

  • Making recastci(rarea) in -marginsplot- transparant

    I'm trying to use the new transparent color options in Stata 15 to make the -recastci(rarea) produce transparent color. I've tried various versions of the command:

    marginsplot, recast(line) recastci(rarea intensity(inten50)) addplot((scatter AGD1_H PPB_LW_OPDDT if sex==0, msymbol(o) msize(small)) (scatter AGD1_H PPB_LW_OPDDT if sex==1, msymbol(+) msize(small)))

    and

    marginsplot, recast(line) recastci(rarea color(%50)) addplot((scatter AGD1_H PPB_LW_OPDDT if sex==0, msymbol(o) msize(small)) (scatter AGD1_H PPB_LW_OPDDT if sex==1, msymbol(+) msize(vsmall)))

    Stata responds "recast (rarea etc.) not allowed". Is this a bug, an oversight or a feature? Can someone please provide proper syntax?

    A second issue with my present syntax is that the "mysmbol(+) specification at the end of the command doesn't change the symbols to +, though the first instance of the symbol(o) size(small) appears to change symbols for both sex==0 and sex==1 to very small circles. Can someone please point out my error to allow small circles for sex==0 and small + for sex==1?

    Best regards,
    Steve Rothenberg
    Instituto Nacional de Salud Publica
    Cuernavaca, Morelos, Mexico

  • #2
    There is an example with - recast - here. Hopefully it applies to your needs.

    That said, maybe you should try the option - color(red%50) -, or any other color, instead of "color(%50)".
    Best regards,

    Marcos

    Comment


    • #3
      Thank for your suggestions Marco. The previous response you suggested with -recast- is from a date before transparent colors were available in Stata and so does not cover the specific problem. Your suggested use of the option - color(red%50) - also returned the same error message as before "...not allowed".

      I was able to produce the effect using the graph editor by specifically editing the ci areas in the graph using the original commands without the transparency attempts, but it should be possible to achieve the color transparency within the - recast - portion of the marginsplot command from the command line too.

      Can anyone contribute any further suggestions, please?

      Steve Rothenberg

      Comment


      • #4
        My intention when sharing the link was underlining #7, written by Rafael Raciborki from StataCorp, where there you will find an example with - recast - using Stata 15. In fact, it was not - recastci - but I'm quite sure the example was done in Stata 15. Since I have not decided to concentrate interests in this matter, this is the furtherst I can go. Hopefully you'll get extra advice.
        Best regards,

        Marcos

        Comment


        • #5
          Ah, yes, I see the subcommand should be fcolor(red%50). I'll give that a try and report back to the list. Thanks for your pointing out post #7 in your previous link.
          Best,
          Steve

          Comment


          • #6
            To change the color in ci, use ciopt().

            Here is an example

            Code:
            webuse nhanes2
            logistic highbp sex##agegrp##c.bmi
            margins sex, at(bmi=(10(5)65))
            marginsplot
            marginsplot, recast(line) ciopt(color(%20)) recastci(rarea)

            Comment

            Working...
            X