Announcement

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

  • How can I change the violin colors in vioplots?

    I am trying to change the violin colors in a violet command, I tried adding bar(3, fcolor(bluish gray)), box(3, fcolor(bluish gray)) violin(3, fcolor(bluish gray) to my command, but nothing seems to work

  • #2
    Welcome to Statalist. For user-written commands, you are requested to make this explicit when making reference to them in your description and as a matter of courtesy also acknowledge the authors. The relevant command here is vioplot which is a modification of the box plot and the authors are Nick Winter and Austin Nichols. The help file will show you that the graph contains 4 components: density, bar, line, and median. You can specify colors as follows:


    Code:
    *TO INSTALL TYPE ssc install vioplot
    sysuse auto
    vioplot mpg, over(rep78) bar(color(black)) density(color(ebg)) line(color(midblue)) median(color(red))
    Click image for larger version

Name:	vioplot.png
Views:	1
Size:	13.7 KB
ID:	1356483

    Last edited by Andrew Musau; 13 Sep 2016, 15:12.

    Comment


    • #3
      thank you for this. What if you have two variables though?
      Code:
      bar(1, color(black))
      does not work, for example

      Comment


      • #4
        vioplot doesn't appear to support varying colours.

        Comment


        • #5
          Thanks Nick

          Comment

          Working...
          X