boxplot

How do I make a boxplot with two categorical variables in R? [closed]

不问归期 提交于 2019-12-10 00:10:34
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I would like to make a boxplot that shows how time spent doing a behaviour(Alert) is affected by two variables (Period= Morning/Afternoon and Visitor Level= High/Low). Alert ~ Period + Vis.Level 'Alert' is a set of 12 numbers that show the amount of time spent awake with the other two as the

ggplot2 boxplot from count table

╄→尐↘猪︶ㄣ 提交于 2019-12-09 22:34:48
问题 I have a count table that I have generated with another tool, and I would like to get a boxplot from it with ggplot2. For instance, suppose that I have: df1 = data.frame(nSiblings = c(0, 1, 2), count = c(10, 15, 12)) instead of df2 = data.frame(nSiblings = c(rep(0, 10), rep(1, 15), rep(2, 12))) I know how to produce a boxplot from the second data frame: qplot(y=df2$nSiblings, x=1, geom = "boxplot") I know how to produce a histogram from the first data frame: ggplot(df1, aes(x = nSiblings, y =

How to modify whiskers of a boxplot in ggplot2?

南笙酒味 提交于 2019-12-09 17:54:04
问题 I'll start with an MWE: library(ggplot2) p <- ggplot(mtcars, aes(factor(cyl), mpg, fill = factor(am))) p + geom_boxplot() I'd like to modify the colour of the whiskers, e.g., set it to red. I don't think it's possible to do this directly both geom_boxplot , so this is my workaround: library(Hmisc) stat_sum_df <- function(fun, geom = "crossbar", ...) { stat_summary(fun.data = fun, geom = geom, width = 0.4, ...) } p + stat_boxplot(geom = 'linerange', colour = "red", position = "dodge) + stat

Ordering boxplot x-axis in seaborn

瘦欲@ 提交于 2019-12-09 17:53:33
问题 My dataframe round_data looks like this: error username task_path 0 0.02 n49vq14uhvy93i5uw33tf7s1ei07vngozrzlsr6q6cnh8w... 39.png 1 0.10 n49vq14uhvy93i5uw33tf7s1ei07vngozrzlsr6q6cnh8w... 45.png 2 0.15 n49vq14uhvy93i5uw33tf7s1ei07vngozrzlsr6q6cnh8w... 44.png 3 0.25 xdoaztndsxoxk3wycpxxkhaiew3lrsou3eafx3em58uqth... 43.png ... ... ... ... 1170 -0.11 9qrz4829q27cu3pskups0vir0ftepql7ynpn6in9hxx3ux... 33.png 1171 0.15 9qrz4829q27cu3pskups0vir0ftepql7ynpn6in9hxx3ux... 34.png [1198 rows x 3 columns]

How to create one box plot using multiple columns and argument “split”

和自甴很熟 提交于 2019-12-09 07:07:03
问题 I need create a box plot from a data.frame with three numeric columns , and use the argument split to separate the boxes by paint . I have a large data.frame, but what I need is in the example below: paint<-c("blue", "black", "red", "blue", "black", "red", "blue", "black", "red") car1<-c(100, 138, 123, 143, 112, 144, 343, 112, 334) car2<-c(111, 238, 323, 541, 328, 363, 411, 238, 313) car3<-c(432, 123, 322, 342, 323, 522, 334, 311, 452) data<-data.frame(paint, car1, car2, car3) >data paint

Face pattern for boxes in boxplots

夙愿已清 提交于 2019-12-09 03:18:45
问题 I would like to do something of the sort (using matplotlib): (from Colorfill boxplot in R-cran with lines, dots, or similar) I saw some info about hatch(ing)? But I really can't make heads or tails on how to use this. Also I find myself wondering how can I change parameters like the possible attributes of a boxprop dict -- used in plt.boxplot(..., boxprops=boxpropsdict). Is it possible to just have a list of all the possible attributes for this? 回答1: The important aspect is to set patch

Plotting box plots in python without grouping the data

旧巷老猫 提交于 2019-12-08 11:21:35
问题 I want to plot a box plot for a variable in a data frame xldata['yaxis_data'] according to 1,0 mapping stored in another array ( one_zero_map ). I have a working code for this I am just not sure if this is the best way. Any help would be great. Reason I am unsure is I am guessing there should be a direct way for boxplot to understand what I want if I input directly one_zero_map and xldata['yaxis_data'] without creating good_ones and bad_ones and then putting them in a list called final_list

Boxplot : Outliers Labels Python

房东的猫 提交于 2019-12-08 03:27:49
问题 I'm making a time series boxplot using seaborn package but I can't put a label on my outliers. My data is a dataFrame of 3 columns : [Month , Id , Value] that we can fake like that : ### Sample Data ### Month = numpy.repeat(numpy.arange(1,11),10) Id = numpy.arange(1,101) Value = numpy.random.randn(100) ### As a pandas DataFrame ### Ts = pandas.DataFrame({'Value' : Value,'Month':Month, 'Id': Id}) ### Time series boxplot ### ax = seaborn.boxplot(x="Month",y="Value",data=Ts) I have one boxplot

Create paired boxplots, from 2 distinct dataframes

时光总嘲笑我的痴心妄想 提交于 2019-12-08 01:01:32
问题 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

ggplot2 boxplot stat_summary text placement by group

扶醉桌前 提交于 2019-12-07 20:31:29
In the plot below, I'd like the number of observations (40 in this case) to be overlayed on top of each boxplot. My code below doesn't work when there's a fill aesthetic. The text need to be adjusted horizontally (1 left, 1 center, 1 right in this case) so that they properly overlay their corresponding boxplots. dt <- data.table( x = factor(rep(1:2, each=120)) , f = rep(letters[1:3], 40) , y = c(rnorm(120, 1:3), rnorm(120, 1:3*2)) ) table(dt$x, dt$f) +--------------+ | a b c | +--------------+ | 1 40 40 40 | | 2 40 40 40 | +--------------+ frequencyAnnotation <- function(x) { c(y = (quantile(x