boxplot

creating a common legend for bar plot and line

怎甘沉沦 提交于 2020-07-20 08:48:51
问题 I'm very new to R so I apologise in advance if this is a very basic question. I'm trying to plot a graph showing discharge and suspended sediment load (SSL). However, I want to make it clear that the bar plot represents discharge, and the line graph represents SSL. I had two ideas: color the label for discharge and SSL to correspond to the bar graph and line graph respectively, so the reader intuitively knows which one belongs to which. but ggplot2 doesn't allow me to do this because it'll

How to group Boxplots without use of color or fill in ggplot2

丶灬走出姿态 提交于 2020-07-08 19:44:18
问题 I have a dataset that I would like to create two groups of boxplots using the ggplot2 package as shown below: library(ggplot2) df <- data.frame(f1=factor(rbinom(100, 1, 0.45), label=c("m","w")), f2=factor(rbinom(100, 1, 0.45), label=c("young","old")), boxthis=rnorm(100)) ggplot(aes(y = boxthis, x = f2, fill = f1), data = df) + geom_boxplot() BUT, I want to color the boxplots using a different aesthetic (not shown) or not color them at all. How can I group the old and young together, but still

How to group Boxplots without use of color or fill in ggplot2

允我心安 提交于 2020-07-08 19:41:49
问题 I have a dataset that I would like to create two groups of boxplots using the ggplot2 package as shown below: library(ggplot2) df <- data.frame(f1=factor(rbinom(100, 1, 0.45), label=c("m","w")), f2=factor(rbinom(100, 1, 0.45), label=c("young","old")), boxthis=rnorm(100)) ggplot(aes(y = boxthis, x = f2, fill = f1), data = df) + geom_boxplot() BUT, I want to color the boxplots using a different aesthetic (not shown) or not color them at all. How can I group the old and young together, but still

How can I adjust the size of the whiskers in a Seaborn boxplot?

廉价感情. 提交于 2020-06-27 15:19:18
问题 I'd like to make the whisker lines wider in the following boxplot. import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt data = pd.DataFrame({'Data': np.random.random(100), 'Type':['Category']*100}) fig, ax = plt.subplots() # Plot boxplot setting the whiskers to the 5th and 95th percentiles sns.boxplot(x='Type', y='Data', data=data, color = 'gray', whis = [5,95]) # Adjust boxplot and whisker line properties for p, artist in enumerate(ax.artists): artist

What exactly do the whiskers in pandas' boxplots specify?

試著忘記壹切 提交于 2020-06-22 11:18:08
问题 In python-pandas boxplots with default settings, the red bar is the mean median , and the box signifies the 25th and 75th quartiles, but what exactly do the whiskers mean in this case? Where is the documentation to figure out the exact definition (couldn't find it)? Example code: df.boxplot() Example result: 回答1: These are specified in the matplotlib documentation. The whiskers are some multiple (1.5 by default) of the interquartile range. 回答2: Pandas just wraps the boxplot function from

Matplotlib boxplot x axis

大憨熊 提交于 2020-06-11 17:32:09
问题 It's easier to ask this with a figure. At the moment i obtain the following boxplot graph using matplotlib: Is there a way to obtain a figure like that, but with each box in a position coherent with the corresponding x-axis number (like in a normal scatter plot, but with boxes instead of points)? At the moment the numbers on the x-axis are added by means of the labels= argument. 回答1: You need to specify the positions argument to the boxplot constructor. from matplotlib import pyplot as plt

is seaborn confidence interval computed correctly?

别来无恙 提交于 2020-06-10 04:04:07
问题 First, I must admit that my statistics knowledge is rusty at best: even when it was shining new, it's not a discipline I particularly liked, which means I had a hard time making sense of it. Nevertheless, I took a look at how the barplot graphs were calculating error bars, and was surprised to find a "confidence interval" (CI) used instead of (the more common) standard deviation. Researching more CI led me to this wikipedia article which seems to say that, basically, a CI is computed as: Or,

How to set the y range in boxplot graph?

北城以北 提交于 2020-05-27 03:58:35
问题 I'm using boxplot() in R. My code is: #rm(list=ls()) #B2 fps_error <- c(0.058404273, 0.028957446, 0.026276044, 0.07084294, 0.078438563, 0.024000178, 0.120678965, 0.081774358, 0.025644741, 0.02931614) fps_error = fps_error *100 fps_qp_error <-c(1.833333333, 1.69047619, 1.666666667, 3.095238095, 2.738095238, 1.714285714, 3.634146341, 5.142857143, 1.238095238, 2.30952381) bit_error <- c(0.141691737, 0.136173785, 0.073808209, 0.025057931, 0.165722097, 0.004276999, 0.365353752, 0.164757488, 0

Ggplot2 Boxplot width setting changes x-axis

十年热恋 提交于 2020-05-15 19:17:13
问题 I have produced a boxplot with a continuous x-axis unsing geom_boxplot() in ggplot2 . However, as there are many boxes they appear as skinny lines. Another stackoverflow chain (see here) suggested using the width= argument to make all the boxes the same width. However, when I use this argument it changes the x-axis and some of the boxes just disappear! For example, take this example dataframe. I apologise for the number of observations this has but I think the quantity has to do with the

Ggplot2 Boxplot width setting changes x-axis

夙愿已清 提交于 2020-05-15 19:15:53
问题 I have produced a boxplot with a continuous x-axis unsing geom_boxplot() in ggplot2 . However, as there are many boxes they appear as skinny lines. Another stackoverflow chain (see here) suggested using the width= argument to make all the boxes the same width. However, when I use this argument it changes the x-axis and some of the boxes just disappear! For example, take this example dataframe. I apologise for the number of observations this has but I think the quantity has to do with the