boxplot

Boxplot of pre-aggregated/grouped data in R

余生颓废 提交于 2019-12-10 13:14:43
问题 In R I want to create a boxplot over count data instead of raw data. So my table schema looks like Value | Count 1 | 2 2 | 1 ... Instead of Value 1 1 2 ... Where in the second case I could simply do boxplot(x) 回答1: I'm sure there's a way to do what you want with the already summarized data, but if not, you can abuse the fact that rep takes vectors: > dat <- data.frame(Value = 1:5, Count = sample.int(5)) > dat Value Count 1 1 1 2 2 3 3 3 4 4 4 2 5 5 5 > rep(dat$Value, dat$Count) [1] 1 2 2 2 3

Flier colors in boxplot with matplotlib

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:12:59
问题 According to the documentation, the Axes.boxplot function takes a dictionary flierprop as argument to define the properties of the outliers. Unfortunately, I can't find the documentation concerning this dictionary. In particular, I would like to define the color of the border of the marker. By default, empty circles are drawn. One can set the face color, as shown in the example. Nevertheless, the circle border is always a black line. I tried with the keys color and markercolor (the former has

Creating a Multi-Project Timeline Using ggplot2 in R

安稳与你 提交于 2019-12-10 11:33:45
问题 I'm attempting to create a multi-project timeline that features various stages of the project in order to organize all of our current projects going forward in one easy to visualize place. I initially found the timeline() package and was able to semi-create what I was hoping for. However, it appears that package is not very customizable, so I am hoping to complete my timeline in ggplot2() instead. Here is my fake data: Phase Project StartDate EndDate SD Test1 2015-08-01 2015-08-31 DD Test1

Grouped boxplots in Matlab: a Generic function

瘦欲@ 提交于 2019-12-10 10:56:55
问题 After seeing this great post in SO: Most efficient way of drawing grouped boxplot matlab I was wondering if it is possible to create a function like that but a bit more generic, as in my application I need to make several analysis of different algorithms in different situations and it would be very tedious to tune the plotting code for each case. I would like something generic for this kind of plots: 回答1: I coded a Matlab function that does that for you (me). Features: In each boxplot

Add name to boxplot in R

二次信任 提交于 2019-12-10 10:26:36
问题 This question is related to: R: how to label the x-axis of a boxplot When more than one column is plotted, names appear. But when only one column is plotted, name does not appear, even when names=.. argument is used: ddf = structure(list(apple = c(1, 2, 3, 4, 5), banana = c(5, 4, 3, 2, 1), watermelon = c(4, 5, 6, 7, 8)), .Names = c("apple", "banana", "watermelon"), row.names = c(NA, -5L), class = "data.frame") ddf apple banana watermelon 1 1 5 4 2 2 4 5 3 3 3 6 4 4 2 7 5 5 1 8 boxplot(ddf[,1

Box plot for continuous data in Python

◇◆丶佛笑我妖孽 提交于 2019-12-10 10:02:04
问题 I have a csv file with 2 columns: col1- Timestamp data(yyyy-mm-dd hh:mm:ss.ms (8 months data)) col2 : Heat data (continuous variable) . Since there are almost 50k record, I would like to partition the col1(timestamp col) into months or weeks and then apply box plot on the heat data w.r.t timestamp. I tried in R,it takes a long time. Need help to do in Python. I think I need to use seaborn.boxplot . Please guide. 回答1: Group by Frequency then plot groups First Read your csv data into a Pandas

ggplot2: boxplot with all points distributed evenly in a row

心不动则不痛 提交于 2019-12-10 04:21:12
问题 I have a boxplot generated with the following code: b.males <- c(6, 7, 8, 8, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 14, 15) b.females <- c(14, 13, 12, 12, 11, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7) b.total<-c(b.males,b.females) b.m<-data.frame(b.males) b.f<-data.frame(b.females) b.t<-data.frame(b.total) myList<-list(b.m, b.f, b.t) df<-melt(myList) colnames(df) <- c("class","count") plt<-ggplot(df, aes(x=class,y=count))+geom_boxplot() plt + geom_point(aes(x = as.numeric(class) + 0,

How can box plot be overlaid on top of swarm plot in Seaborn?

淺唱寂寞╮ 提交于 2019-12-10 04:17:07
问题 I am trying to plot swarm plots and box plots together using matplotlib and Seaborn. I found how to plot them together but the box plot appears underneath the swarm plot. The problem with this is that the swarm plot points drown out the box plot and the box plot is lost. I thought that by switching the order of the functions called, to have the box plot called first rather than second as in the link below, would overlay the box plot on top but it does not. Is it possible to overlay the box

R ggplot2: Add means as horizontal line in a boxplot

烂漫一生 提交于 2019-12-10 03:26:49
问题 I have created a boxplot using ggplot2: library(ggplot2) dat <- data.frame(study = c(rep('a',50),rep('b',50)), FPKM = c(rnorm(1:50),rnorm(1:50))) ggplot(dat, aes(x = study, y = FPKM)) + geom_boxplot() The boxplot shows the median as a horizontal line across each box. How do I add a dashed line to the box representing the mean of that group? Thanks! 回答1: You can add horizontal lines to plots by using stat_summary with geom_errorbar . The line is horizontal because the y minimum and maximum are

ValueError: num must be 1 <= num <= 2, not 3

青春壹個敷衍的年華 提交于 2019-12-10 02:39:54
问题 I have the following dataframe that I generated using pivot_table : and I'm using the following code to boxplot the multiple columns: fig = plt.figure() for i in range(0,25): ax = plt.subplot(1,2,i+1) toPlot1.boxplot(column='Score',by=toPlot1.columns[i+1],ax=ax) fig.suptitle('test title', fontsize=20) plt.show() I was expecting an output like the following: But this code gives me the following error: --------------------------------------------------------------------------- ValueError