Boxplot of table using ggplot2

前端 未结 1 1000
情歌与酒
情歌与酒 2020-12-10 04:49

I\'m trying to plot a boxplot graph with my data, using \'ggplot\' in R, but I just can\'t do it. Can anyone help me out? The data is like the table below:

P         


        
相关标签:
1条回答
  • 2020-12-10 05:20

    ggplot2 requires data in a specific format. Here, you need x= and y= where y will be the values and x will be the corresponding column ids. Use melt from reshape2 package to melt the data to get the data in this format and then plot.

    require(reshape2)
    ggplot(data = melt(dd), aes(x=variable, y=value)) + geom_boxplot(aes(fill=variable))
    

    ggplot2_boxplot

    0 讨论(0)
提交回复
热议问题