Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you can redifine the funcition</p> <pre><code>GeomBoxplot$draw&lt;-function (., data, ..., outlier.colour = "black", outlier.shape = 16, outlier.size = 2, outlier.jitter=0) { defaults &lt;- with(data, data.frame(x = x, xmin = xmin, xmax = xmax, colour = colour, size = size, linetype = 1, group = 1, alpha = 1, fill = alpha(fill, alpha), stringsAsFactors = FALSE)) defaults2 &lt;- defaults[c(1, 1), ] if (!is.null(data$outliers) &amp;&amp; length(data$outliers[[1]] &gt;= 1)) { pp&lt;-position_jitter(width=outlier.jitter,height=0) p&lt;-pp$adjust(data.frame(x=data$x[rep(1, length(data$outliers[[1]]))], y=data$outliers[[1]]),.scale) outliers_grob &lt;- GeomPoint$draw(data.frame(x=p$x, y = p$y, colour = I(outlier.colour), shape = outlier.shape, alpha = 1, size = outlier.size, fill = NA), ...) } else { outliers_grob &lt;- NULL } with(data, ggname(.$my_name(), grobTree(outliers_grob, GeomPath$draw(data.frame(y = c(upper, ymax), defaults2), ...), GeomPath$draw(data.frame(y = c(lower, ymin), defaults2), ...), GeomRect$draw(data.frame(ymax = upper, ymin = lower, defaults), ...), GeomRect$draw(data.frame(ymax = middle, ymin = middle, defaults), ...)))) } ggplot(test, aes(x=places,y=value))+geom_boxplot(outlier.jitter=0.05) </code></pre> <p>This is ad-hoc solution. Of course, in the sense of OOP, you should create a sub-class of GeomBoxplot and override the function. This is easy because ggplot2 is nice.</p> <p>=== added for example of sub-class definition ===</p> <pre><code>GeomBoxplotJitterOutlier &lt;- proto(GeomBoxplot, { draw &lt;- function (., data, ..., outlier.colour = "black", outlier.shape = 16, outlier.size = 2, outlier.jitter=0) { # copy the body of function 'draw' above and paste here. } objname &lt;- "boxplot_jitter_outlier" desc &lt;- "Box and whiskers plot with jittered outlier" guide_geom &lt;- function(.) "boxplot_jitter_outlier" }) geom_boxplot_jitter_outlier &lt;- GeomBoxplotJitterOutlier$build_accessor() </code></pre> <p>then you can do with your sub-class:</p> <pre><code>ggplot(test, aes(x=places,y=value))+geom_boxplot_jitter_outlier(outlier.jitter=0.05) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload