Announcement

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

  • Update to violinplot: support for raindrop plots and weighted markers

    An update to violinplot is available from SSC. Type

    Code:
    . ssc install violinplot, replace
    to install the update.

    There are two main additions.

    (1) Option rag() can now be used with suboption stack to produce so-called raindrop plots.

    Examples:

    Code:
    sysuse auto
    violinplot mpg turn, left rag(stack right msymbol(o) offset(-0.05))
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	146.4 KB
ID:	1743432

    Code:
    sysuse nlsw88
    violinplot wage tenure, pdf(ll(0)) dscale(1.5) left rag(stack msymbol(p))
    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	212.1 KB
ID:	1743433

    (2) If weights are specified, markers in the rag are now scaled in relation to the weights (with average weight corresponding to the unweighted marker size). This also translates suboption unique, which now scales the markers in relation to the represented data mass even if no weights are specified. Use suboption noweight in rag() to suppress the new behavior.

    Examples:

    Code:
    sysuse auto
    violinplot mpg turn, nomed nobox nowhisk rag(uniq msymbol(o))
    Click image for larger version

Name:	Graph3.png
Views:	1
Size:	152.4 KB
ID:	1743434

    Code:
    webuse nhanes2f
    violinplot loglead [pweight=finalwgt], over(sex) nobox nowhisk nomed ///
         pstyles(1 2) rag(spread(10) msymbol(o) mcolor(%20) mlcolor(%0))
    Click image for larger version

Name:	Graph4.png
Views:	1
Size:	398.5 KB
ID:	1743435

    Same graph using fixed marker size (suboption noweight):

    Code:
    violinplot loglead [pweight=finalwgt], over(sex) nobox nowhisk nomed ///
         pstyles(1 2) rag(spread(10) msymbol(o) mcolor(%20) mlcolor(%0) noweight)
    Click image for larger version

Name:	Graph5.png
Views:	1
Size:	341.9 KB
ID:	1743436

    ben
Working...
X