boxplot

Multiple boxplots using ggplot

流过昼夜 提交于 2019-11-26 18:35:24
问题 I have a dataframe that looks like the one attached, with 6 columns and 1000 rows (tab separated). The column headings (0,30,60,120,240 and 360) are a time series (with 0 representing 0 mins, 30 meaning 30 mins and so on). I'd like to create 6 boxplots corresponding to the columns using ggplot2 in a single plot, keeping in mind that they need to be spaced based on the time difference. It seems I would need to melt the columns, but cant figure out a way to do so. Any help would be much

How to change order of boxplots when using ggplot2?

家住魔仙堡 提交于 2019-11-26 18:13:17
问题 This question follows from this other one. I was unable to implement answers there. Define: df2 <- data.frame(variable=rep(c("vnu.shr","vph.shr"),each=10), value=seq(1:20)) Plot: require(ggplot2) qplot(variable,value, data=df2,geom="boxplot")+ geom_jitter(position=position_jitter(w=0.1,h=0.1)) I would like to have the boxplots in the reverse order (e.g. one in right on left and so on). I have tried various ways of reordering the factors using levels , ordered , relevel , rev and so on, but I

geom_boxplot with precomputed values

会有一股神秘感。 提交于 2019-11-26 17:48:08
问题 In the past, I have been able to create boxplots using ggplot2 by providing the lower whisker, lower quantile, median, upper quantile, and upper whisker along with x-axis labels. For example: DF <- data.frame(x=c("A","B"), min=c(1,2), low=c(2,3), mid=c(3,4), top=c(4,5), max=c(5,6)) ggplot(DF, aes(x=x, y=c(min,low,mid,top,max))) + geom_boxplot() would make a boxplot for two sets of data (A & B). This no longer works for me. I get the following error: Error: Aesthetics must either be length one

Changing whisker definition in geom_boxplot

早过忘川 提交于 2019-11-26 17:36:09
I'm trying to use ggplot2 / geom_boxplot to produce a boxplot where the whiskers are defined as the 5 and 95th percentile instead of 0.25 - 1.5 IQR / 0.75 + IQR and outliers from those new whiskers are plotted as usual. I can see that the geom_boxplot aesthetics include ymax / ymin, but it's not clear to me how I put values in here. It seems like: stat_quantile(quantiles = c(0.05, 0.25, 0.5, 0.75, 0.95)) should be able to help, but I don't know how to relate the results of this stat to set the appropriate geom_boxplot() aesthetics: geom_boxplot(aes(ymin, lower, middle, upper, ymax)) I've seen

matplotlib: Group boxplots

你说的曾经没有我的故事 提交于 2019-11-26 17:26:39
问题 Is there a way to group boxplots in matplotlib? Assume we have three groups "A", "B", and "C" and for each we want to create a boxplot for both "apples" and "oranges". If a grouping is not possible directly, we can create all six combinations and place them linearly side by side. What would be to simplest way to visualize the groupings? I'm trying to avoid setting the tick labels to something like "A + apples" since my scenario involves much longer names than "A". 回答1: How about using colors

Multiple boxplots using ggplot

只愿长相守 提交于 2019-11-26 17:26:02
问题 I have a dataframe that looks like the one attached, with 6 columns and 1000 rows (tab separated). The column headings (0,30,60,120,240 and 360) are a time series (with 0 representing 0 mins, 30 meaning 30 mins and so on). I'd like to create 6 boxplots corresponding to the columns using ggplot2 in a single plot, keeping in mind that they need to be spaced based on the time difference. It seems I would need to melt the columns, but cant figure out a way to do so. Any help would be much

Add color to boxplot - “Continuous value supplied to discrete scale” error

北城以北 提交于 2019-11-26 15:32:32
问题 There is probably a very easy solution to my problem but I couldn't find a satisfying answer online. Using the following command I was able to create the following boxplot graph and overlay it with the individual data points: ggplot(data = MYdata, aes(x = Age, y = Richness)) + geom_boxplot(aes(group=Age)) + geom_point(aes(color = Age)) There are several things I would like to add/change: 1. Change the line color and/or fill of each boxplot (depending on "Age") using 6 different colors from

Transform only one axis to log10 scale with ggplot2

元气小坏坏 提交于 2019-11-26 15:27:55
问题 I have the following problem: I would like to visualize a discrete and a continuous variable on a boxplot in which the latter has a few extreme high values. This makes the boxplot meaningless (the points and even the "body" of the chart is too small), that is why I would like to show this on a log10 scale. I am aware that I could leave out the extreme values from the visualization, but I am not intended to. Let's see a simple example with diamonds data: m <- ggplot(diamonds, aes(y = price, x

Put whisker ends on boxplot

女生的网名这么多〃 提交于 2019-11-26 12:13:46
问题 I would like to put perpendicular lines at the ends of the whiskers like the boxplot function automatically gives. 回答1: As hinted but not implemented by @Roland, you can use stat_boxplot to implement this. The trick calling _boxplot twice and is to set the geom to errorbar for one of the calls. Note that as R uses a pen and paper approach it is advisable to implement the error bars first the draw the traditional boxplot over the top. Using @Roland's dummy data df ggplot(df, aes(x=cond, y =

Seaborn load_dataset

爷,独闯天下 提交于 2019-11-26 12:13:14
问题 I am trying to get a grouped boxplot working using Seaborn as per the example I can get the above example working, however the line: tips = sns.load_dataset(\"tips\") is not explained at all. I have located the tips.csv file, but I can\'t seem to find adequate documentation on what load_dataset specifically does. I tried to create my own csv and load this, but to no avail. I also renamed the tips file and it still worked... My question is thus: Where is load_dataset actually looking for files