Violin plot with mean_sdl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Violin plot with mean_sdl

Mahmood Naderan-Tahan
Hi,

I followed the example described at [1] but I don't know why I get the following warning


> library(ggplot2)
> library(Hmisc)
> mydata <- read.csv('test.csv', header=T,row.names=1)
> mydata
     V1  V2   V3 V4
P1 73.6 0.7 74.6  R
P2 75.2 0.7 75.8  R
P3  6.5 0.0  7.3  R
P4 41.4 0.3 39.2  C
P5  5.4 0.1 18.2  C
P6 18.8 0.3 30.3  C
> p <- ggplot(mydata, aes(x=V4, y=V1)) + geom_violin(trim=FALSE)
> p + stat_summary(fun.data="mean_sdl", mult=1,
+                  geom="crossbar", width=0.2 )
Warning message:
Ignoring unknown parameters: mult


How can I fix that?



[1] http://www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization


Regards,
Mahmood

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Violin plot with mean_sdl

Bill Dunlap-2
help(stat_summary) suggests you use the fun.args=list(...) argument to
pass arguments to the fun.* functions.   Try replacing mult=1 by
fun.args=list(mult=1).

It is possible that ggplot2::stat_summary changed its behavior since
that web page was written or that the web page was always wrong.

-Bill

On Wed, Mar 31, 2021 at 11:03 PM Mahmood Naderan-Tahan
<[hidden email]> wrote:

>
> Hi,
>
> I followed the example described at [1] but I don't know why I get the following warning
>
>
> > library(ggplot2)
> > library(Hmisc)
> > mydata <- read.csv('test.csv', header=T,row.names=1)
> > mydata
>      V1  V2   V3 V4
> P1 73.6 0.7 74.6  R
> P2 75.2 0.7 75.8  R
> P3  6.5 0.0  7.3  R
> P4 41.4 0.3 39.2  C
> P5  5.4 0.1 18.2  C
> P6 18.8 0.3 30.3  C
> > p <- ggplot(mydata, aes(x=V4, y=V1)) + geom_violin(trim=FALSE)
> > p + stat_summary(fun.data="mean_sdl", mult=1,
> +                  geom="crossbar", width=0.2 )
> Warning message:
> Ignoring unknown parameters: mult
>
>
> How can I fix that?
>
>
>
> [1] http://www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization
>
>
> Regards,
> Mahmood
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.