boxplot

How to create a grouped boxplot in R?

情到浓时终转凉″ 提交于 2019-11-30 13:47:23
I want to merge the three datasets grouped and obtain a graph with only two boxes, 1 for A and 1 for B. Can you suggest how to get that? I'm tryng to create a grouped boxplot in R. I have 2 groups: A and B, in each group I have 3 subgroups with 5 measurements each. The following is the way that I constructed the boxplot, but if someone has a better, shorter or easy way to do, I'll appreciate A1 <- c(1,2,9,6,4) A2 <- c(5,1,9,2,3) A3 <- c(1,2,3,4,5) B1 <- c(2,4,6,8,10) B2 <- c(0,3,6,9,12) B3 <- c(1,1,2,8,7) DF <- data.frame(A1, A2, A3, B1, B2, B3) boxplot(DF, col = rainbow(3, s = 0.5)) axis(side

Set color for xticklabels individually in matplotlib

孤者浪人 提交于 2019-11-30 13:42:15
How can I give the labels "a", "b", "c" individual colors (e.g. "a" in green, "b" in blue, "c" in red) in the example below? import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots() p = plt.boxplot(np.random.normal(size=(10,3))) ax.set_xticklabels(list("abc")) plt.show() The code: import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots() p = plt.boxplot(np.random.normal(size=(10,3))) ax.set_xticklabels(list("abc")) [t.set_color(i) for (i,t) in zip(['red','green','blue'],ax.xaxis.get_ticklabels())] plt.show() Gives me: 来源: https://stackoverflow.com/questions

Is it possible to draw a matplotlib boxplot given the percentile values instead of the original inputs?

天大地大妈咪最大 提交于 2019-11-30 12:46:23
From what I can see, boxplot() method expects a sequence of raw values (numbers) as input, from which it then computes percentiles to draw the boxplot(s). I would like to have a method by which I could pass in the percentiles and get the corresponding boxplot . For example: Assume that I have run several benchmarks and for each benchmark I've measured latencies ( floating point values ). Now additionally, I have precomputed the percentiles for these values. Hence for each benchmark, I have the 25th, 50th, 75th percentile along with the min and max. Now given these data, I would like to draw

Posthoc labels on anova boxplot in R

假如想象 提交于 2019-11-30 09:58:11
If I have some data and do an ANOVA and post-hoc tests, how do I make a boxplot that adds the post-hoc classification automatically, rather than having to edit the figure outside of R? For example, here are some data to get started: install.packages("reshape", dependencies=T) library(reshape) x <- rnorm(30) y <- rnorm(30)+1 z <- rnorm(30)+0.5 data.1 <- data.frame(x, y, z) data.2 <- melt(data.1) Here's code for running a simple one way ANOVA and all of the unplanned comparision post-hoc tests: linear.model <- lm(value~variable, data=data.2) anova(linear.model) # Analysis of Variance Table #

R - boxplot with multiple factor labels

雨燕双飞 提交于 2019-11-30 09:23:37
I'm working on trying to make a boxplot in R-cran that is categorized by two different factors on the x-axis. My problem lies in creating labels for one factor with +20 levels that spans the entire graph appropriately while using a legend to label the second factor which has only 2 to 3 levels. Here is a test script that roughly mimics my actual dataset: d<-data.frame(x=rnorm(1500),f1=rep(seq(1:20),75),f2=rep(letters[1:3],500)) # first factor has 20+ levels d$f1<-factor(d$f1) # second factor a,b,c d$f2<-factor(d$f2) boxplot(x~f2*f1,data=d,col=c("red","blue","green"),frame.plot=TRUE,axes=FALSE)

Multiple box plots within one group

我的未来我决定 提交于 2019-11-30 07:41:47
I found some solutions but not exactly what I want. I have 5 dataframes in R and each dataframe has 4 columns: Lets say name of the first dataframe is "Gene1" Ind1 Ind2 Ind3 Ind4 1 3 3.2 2.5 1 3 4 2 1.5 2 2.2 1 3.4 2 1 3 and remaining dataframes are called "Gene2", "Gene3","Gene4","Gene5" and are similar. I want to plot boxplots side by side in same plot for all dataframes and for all columns. I did not find any plot like this, so I can't upload a picture but I will try to explain. Now from above data, the plot will have 20 box plots. First 4 box plot should be close to each other and x-axis

Matplotlib boxplot using precalculated (summary) statistics

岁酱吖の 提交于 2019-11-30 06:54:45
I need to do a boxplot (in Python and matplotlib) but I do not have the original "raw" data. What I have are precalculated values for max, min, mean, median and IQR (normal distribution) but still I'd like to do a boxplot. Of course plotting outliers isn't possible, but beside that I guess all information is there. I've search all over to find an answer without success. The closest I've come is the same question but for R (which I'm unfamiliar with). See Is it possible to plot a boxplot from previously-calculated statistics easily (in R?) Can anyone show me how to do the boxplot? Many thanks!

Boxplots for groups?

时光毁灭记忆、已成空白 提交于 2019-11-30 06:42:05
I have a dataset (test) as given below: Type Met1 Met2 Met3 Met4 TypeA 65 43 97 77 TypeA 46 25 76 77 TypeA 44 23 55 46 TypeA 46 44 55 77 TypeA 33 22 55 54 TypeB 66 8 66 47 TypeB 55 76 66 65 TypeB 55 77 88 46 TypeB 36 67 55 44 TypeB 67 55 76 65 I have checked a lot of links on box plots, but I still have not succeeded for the type of box plot I want. I wish to have a boxplot with my X-axis having type A (yellow, orange) for all the Mets (Met1, Met2, Met3, Met4). In essence, I want something like the following (taken from here ): I am trying somethings like, boxplot(formula = len ~ Type , data =

How to plot 'multiple box plots' in one plot?

余生长醉 提交于 2019-11-30 05:14:09
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . I have data in the following format: # repetition, packet, route, energy level 1, 1, 1, 10.0 1, 1, 2, 12.3 1, 1, 3, 13.8 1, 2, 1, 9.2 1, 2, 2, 10.1 1, 2, 3, 11.2 ... 50,99,3, 0.01 Now, I want to create a plot showing box plots per route per packet over all repetitions. So, for example the x-axis would depict the packets and the y-axis the energy level. The first tick on the x

ggplot2: boxplot with colors and text labels mapped to combination of two categorical variables

家住魔仙堡 提交于 2019-11-30 05:08:52
问题 I would like to create a boxplot with ggplot2 from a dataset densityAGRLKA with 3 categorical variables (species, location, position) on the x-axis. The following function: ggplot(densityAGRLKA, aes(species, density, fill=location, alpha=position), dodge=species, position) + stat_boxplot(geom ='errorbar') + geom_boxplot() creates a plot, in which the grouping of the species is fine, but the colours are misleading. I have no idea how to fix this. I need a plot with the following properties: