boxplot

How can I use different background color each x value in ggplot?

依然范特西╮ 提交于 2019-12-12 04:07:06
问题 I want to create a boxplot using ggplot library in R. What I want is that set various background color to each x value such as a following image. I cannot find any option for changing bgcolor of each x axis. Only thing I found is for changing entire background color such as 'theme_bw()' option On first, fourth, fifth x axis, bgcolor is blue. However, there is no value on second, third, sixth x axis, so I want to set red color as bgcolor. Thanks for your time! 回答1: Maybe you can build up

Plotly boxplot: groupby option?

限于喜欢 提交于 2019-12-11 14:50:36
问题 I have two boolean variables and I try to create a boxplot with groups. Each group should represent one of the variables and it should contain two boxplots, one for TRUE and one for FALSE. Instead I am getting two groups, one representing TRUE and one representing FALSE and for each group two boxplots corresponding to each variable as in the attached graph: I understand that groups are derived from the xaxis. But how can I make plotly think that the variable names are the groups? The code I

How do I customize the margin and label settings with plot_grid?

↘锁芯ラ 提交于 2019-12-11 12:54:02
问题 I would like to have the title not be chopped off and have the axis labels removed from this chart that I generated with plot_grid from cowplot. Here is my code data(mtcars) library(ggplot2) library(cowplot) mpg = ggplot() + geom_boxplot(aes(y = mpg,x = as.factor(cyl)),data=mtcars) + coord_flip() am=ggplot() + geom_boxplot(aes(y = mpg,x = as.factor(am)),data=mtcars) + coord_flip() vs=ggplot() + geom_boxplot(aes(y = mpg,x = as.factor(vs)),data=mtcars) + coord_flip() gear = ggplot() + geom

extreme value labels ggplot2 in geom_boxplot

白昼怎懂夜的黑 提交于 2019-12-11 12:12:02
问题 I am trying to add labels to geom_boxplot for extreme values with dplyr and am getting an inconsistency either with ggplot or dplyr. what am i doing wrong? #toy exmaple df=rbind(data.frame(id=rep("1",100),var=paste0("V",seq(1,100)),val=rnorm(100,0,5)), data.frame(id=rep("2",100),var=paste0("V",seq(1,100)),val=rnorm(100,0,3))) #subset with extreme values df_bound=df%.%group_by(id)%.%filter(val<quantile(val,.025)|val>quantile(val,.975)) #plot ggplot(df,aes(x=id,y=val,fill=id,label=var))+geom

Weighted Standard Deviation and Quartiles in excel

非 Y 不嫁゛ 提交于 2019-12-11 12:08:08
问题 I've got a dataset with aggregated data and total values per category. Example: Now I want to create a boxplot to visualize the insights of this dataset and not just the (weighted) averages. I've found some formula's for weighted standard deviation, but nothing I have been able to translate to an excel formula. Is there a default formula that does this in excel? If not, some suggestions on how to handle this? And how about the quartiles? Or is the best way to somehow expand the dataset to

Multiple boxplots in R

泪湿孤枕 提交于 2019-12-11 10:48:37
问题 I have gene expression data as follows: Control Treatment L1 L2 L1 L2 g1 10.5 12 13 14 g2 11 13 10.5 12 g3 10 9 11 10 g4 9 8 6 5 g5 16 4 4 6 g6 11 12 5 4 g7 10 6 13 12 g8 5 4 12 12 g9 11 12 10 11.5 g10 8.9 7.8 7.6 5.8 where the rows represent the genes and there are two conditions "control" and "treatment" which is further subdivided into "L1", "L2" and "L1" and "L2" respectively. I would like to make a boxplot of these expression values in the following way and represent them as a boxplot ??

How to plot a bloxplot in R with subsets

我只是一个虾纸丫 提交于 2019-12-11 10:38:33
问题 My data set "olympics" has 4 columns: case number, height, sport, and sex (female=F, male=M), and each row corresponds to an athlete. I need to produce a box plot comparing the height distributions among the male basketball players and male football players. (Both sports on a single plot, but with no others.) I have tried boxplot(olympics$height[olympics$sex == "M" & olympics$sport %in% c("basketball", "football")]) but I keep getting errors saying that finite ylim values are needed. How

Multiple plots by factor in ggplot (facets)

穿精又带淫゛_ 提交于 2019-12-11 09:37:36
问题 I have a data frame with two qualitative variables (Q1, Q2) which are both measured on a scale of LOW, MEDIUM, HIGH and a continuous variable CV on a scale 0-100. s = 5 trial <- data.frame(id = c(1:s), Q1 = ordered(sample(c("LOW","MED","HIGH"),size=s,replace=T)), Q2 = ordered(sample(c("LOW","MED","HIGH"),size=s,replace=T)), CV = runif(s,0,100)) I need to use ggplot to show a faceted plot (preferably a horizontal boxplot/jitter) of the continous variable for each qualitative variable (x2) for

Matplotlib, shift boxplots along x-axis?

被刻印的时光 ゝ 提交于 2019-12-11 09:27:32
问题 I am plotting multiple boxplots along two different axes. My code looks like: fig, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=False) data_1 = [array1, array2, array3] ax1.boxplot(data_1, whis=[5,95], showfliers=True) data_2 = [array4, array5] ax2.boxplot(data_2, whis=[5,95], showfliers=True) ax2.set_xlim(0,4) This produces a plot (substituting in my actual data) that looks like: However, I would like the lower plot (on ax2) to shift to the right along the x-axis by one unit. That is, I

Colorfill the boxes in a boxplot in Matlab

假如想象 提交于 2019-12-11 08:32:55
问题 Is there a way to fill the boxes in a boxplot in Matlab? I was able to change the color of the boundaries of the boxes using the colorgroup option of the boxplot function (http://www.mathworks.com/help/stats/boxplot.html), but could not find any option to change the or fill the color of the space inside box itself. Edit: So, I went through the code at the link (http://www.mathworks.com/matlabcentral/newsreader/view_thread/300245) pointed out user1929959 in the comments. However, i am new to