boxplot

Add multiple horizontal lines in a boxplot

做~自己de王妃 提交于 2019-12-07 10:31:14
问题 I know that I can add a horizontal line to a boxplot using a command like abline(h=3) When there are multiple boxplots in a single panel, can I add different horizontal lines for each single boxplot? In the above plot, I would like to add lines 'y=1.2' for 1, 'y=1.5' for 2, and 'y=2.1' for 3. 回答1: I am not sure that I understand exactly, what you want, but it might be this: add a line for each boxplot that covers the same x-axis range as the boxplot. The width of the boxes is controlled by

matplotlib: inset axes for multiple boxplots

自闭症网瘾萝莉.ら 提交于 2019-12-07 06:35:02
问题 I have a few boxplots in matplotlib that I want to zoom in on a particular y-range ([0,0.1]) using inset axes. It is not clear to me from the example in the documentation how I should do this for multiple boxplots on the same figure. I was trying to modify the code provided this example, but there was too much unnecessary complexity. My code is pretty simple: # dataToPlot is a list of lists, containing some data. plt.figure() plt.boxplot(dataToPlot) plt.savefig( 'image.jpeg', bbox_inches=0)

ggplot facetted geom_boxplot: reduce space between x-axis categories

倾然丶 夕夏残阳落幕 提交于 2019-12-07 06:25:57
问题 I am creating a boxplot using ggplot. When I reduce the width of the boxplot the space between the x-axis categories increases. I would like to be able to reduce the space between the x-axis categories and bring the box plots closer to each other. p<-ggplot(data.plot1, aes(time2, Count)) p+geom_boxplot(outlier.shape = NA, width=0.3)+ ggtitle("")+ylab("Cell Count (cells/mL) ")+ xlab("Time") + theme_bw()+ coord_cartesian(ylim = c(0, 850))+ geom_hline(data=normal1, aes(yintercept = val),

grouping by column and then doing a boxplot by the index in pandas

回眸只為那壹抹淺笑 提交于 2019-12-07 02:55:05
问题 I have a large dataframe which I would like to group by some column and examine graphically the distribution per group using a boxplot. I found that df.boxplot() will do it for each column of the dataframe and put it in one plot, just as I need. The problem is that after a groupby operation, my data is all in one column with the group labels in the index , so i can't call boxplot on the result. here is an example: df = DataFrame({'a':rand(10),'b':[x%2 for x in range(10)]}) df a b 0 0.273548 0

Differing quantiles: Boxplot vs. Violinplot

浪子不回头ぞ 提交于 2019-12-07 02:49:22
问题 require(ggplot2) require(cowplot) d = iris ggplot2::ggplot(d, aes(factor(0), Sepal.Length)) + geom_violin(fill="black", alpha=0.2, draw_quantiles = c(0.25, 0.5, 0.75) , colour = "red", size = 1.5) + stat_boxplot(geom ='errorbar', width = 0.1)+ geom_boxplot(width = 0.2)+ facet_grid(. ~ Species, scales = "free_x") + xlab("") + ylab (expression(paste("Value"))) + coord_cartesian(ylim = c(3.5,9.5)) + scale_y_continuous(breaks = seq(4, 9, 1)) + theme(axis.text.x=element_blank(), axis.text.y =

ggplot increase distance between boxplots

一个人想着一个人 提交于 2019-12-07 02:16:53
问题 How can I avoid attached box-plots? Thank you ggplot(df, aes(x=factor(time), y=val, fill=ID))+ geom_boxplot()+ scale_fill_manual(values=c(WT="goldenrod3", KO="steelblue")) 回答1: Look at position_dodge , the width argument can help with spacing mtcars$sep <- 1:2 # a factor ggplot(mtcars, aes(x=factor(carb), y=mpg, fill=factor(sep))) + geom_boxplot(position=position_dodge(width=0.8)) 来源: https://stackoverflow.com/questions/32342616/ggplot-increase-distance-between-boxplots

Remove endpoints from error bars in ggplot2

与世无争的帅哥 提交于 2019-12-07 00:11:53
问题 My goal is to create boxplots in R (doesn't have to be with ggplot2, but that's what I'm using now) that are as stylistically similar to this example that I found somewhere (minus the text): Here's the code I have so far: dat <- read.table(file = "https://www.dropbox.com/s/b59b03rc8erea5d/dat.txt?dl=1", header = TRUE, sep = " ") library(ggplot2) p <- ggplot(dat, aes(x = Subscale, y = Score, fill = Class)) p + stat_boxplot(geom = "errorbar", width = 1.2, size = 2.5, color = "#0077B3") + geom

Creating geom / stat from scratch

╄→гoц情女王★ 提交于 2019-12-06 21:56:30
问题 I just started working with R not long ago, and I am currently trying to strengthen my visualization skills. What I want to do is to create boxplots with mean diamonds as a layer on top (see picture in the link below). I did not find any functions that does this already, so I guess I have to create it myself. What I was hoping to do was to create a geom or a stat that would allow something like this to work: ggplot(data, aes(...))) + geom_boxplot(...) + geom_meanDiamonds(...) I have no idea

Multiple boxplots for multiple conditions in R

大城市里の小女人 提交于 2019-12-06 12:40:15
问题 I understood how I have to plot multiple boxplots in one graph from the several others posts. But I have this situation where am unable to plot multiple conditions together. I applied the same idea as my former post (Multiple boxplots in R) but does not work for this case. I have this dataset Control Treatment L1 L2 L3 L4 L5 S1 S2 S3 S4 S5 g1 10.5 12 10 11 12 13 14 10 11 12 g2 11 13 10 10 11 10.5 12 8 9 10 g3 10 9 9 8 9 11 10 11 9 11 g4 9 8 8 9 8 6 5 5 7 6 g5 16 4 6.5 6.8 5 4 6 6 8 9 g6 11 12

Create paired boxplots, from 2 distinct dataframes

泄露秘密 提交于 2019-12-06 10:50:37
I would like to create a graphic with box plot in R. I got the following data frames: > drools_responseTimes_numberOfClients_REST X1 X5 X10 X20 X50 1 816 183 699 154 297 2 366 280 1283 345 291 3 103 946 1609 409 377 4 431 1086 1974 482 479 5 90 1379 2083 567 557 6 290 511 2184 910 925 7 134 770 2283 980 1277 8 480 1547 2416 1069 1752 9 275 1727 2520 1141 1846 10 67 679 2616 1188 1935 > javascript_responseTimes_numberOfClients_REST X1 X5 X10 X20 X50 1 334 497 610 439 417 2 445 894 859 826 588 3 306 1143 1123 1407 791 4 301 1442 1445 1806 1005 5 257 1754 1857 2209 1235 6 181 507 2078 2493 1441 7