boxplot

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

耗尽温柔 提交于 2019-12-04 21:18:02
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 significant categorical variables. I have looked at other examples but none seem to fit this type of

Multiple boxplots for multiple conditions in R

别等时光非礼了梦想. 提交于 2019-12-04 19:46:06
I understood how I have to plot multiple boxplots in one graph from the several others posts. But I have this situation where am unable to plot multiple conditions together. I applied the same idea as my former post ( Multiple boxplots in R ) but does not work for this case. I have this dataset Control Treatment L1 L2 L3 L4 L5 S1 S2 S3 S4 S5 g1 10.5 12 10 11 12 13 14 10 11 12 g2 11 13 10 10 11 10.5 12 8 9 10 g3 10 9 9 8 9 11 10 11 9 11 g4 9 8 8 9 8 6 5 5 7 6 g5 16 4 6.5 6.8 5 4 6 6 8 9 g6 11 12 7.8 7.5 6 5 4 9 10 11 g7 10 6 8.9 6.4 7.2 13 12 12 12 10 g8 5 4 9.0 5.6 7.8 12 12 9 8 7 g9 11 12 11

How to make an overall boxplot alongside factors in R?

痞子三分冷 提交于 2019-12-04 19:34:33
I am trying to create a boxplot that shows all of the factors of a variable, along with sample size, and at eh end of the plot also want an overall boxplot that combines all of the values into one. I am using the following line of code to do everything except making the overall plot: library(ggplot2) library(plyr) xlabels <- ddply(extract8, .(Fuel), summarize, xlabels = paste(unique(Fuel), '\n(n = ', length(Fuel),')')) ggplot(extract8, aes(x = Fuel, y = Exfiltration.Fraction.Percentage))+geom_boxplot()+ stat_boxplot(geom='errorbar', linetype=1) + geom_boxplot(fill="pink") + geom_hline

R manual boxplot with means and standard deviations (ggplot2)

蓝咒 提交于 2019-12-04 18:51:14
I have two groups with mean scores and standard deviations which represent how confident we are with the mean estimates. Note: I do not have raw scores, just mean estimates outputted from a model and the SD of the estimates outputted from the model, around that mean. I have a feature set around 20, and I want to compare for each feature the mean +/- standard deviations of each of my 2 groups. It will essentially look like this: ggplot() seems to work with data that has the raw data and it calculates the mean and standard deviation from the arrays of each feature. boxplot() works similarly. Can

Time-series boxplot in pandas

蓝咒 提交于 2019-12-04 18:49:27
问题 How can I create a boxplot for a pandas time-series where I have a box for each day? Sample dataset of hourly data where one box should consist of 24 values: import pandas as pd n = 480 ts = pd.Series(randn(n), index=pd.date_range(start="2014-02-01", periods=n, freq="H")) ts.plot() I am aware that I could make an extra column for the day, but I would like to have proper x-axis labeling and x-limit functionality (like in ts.plot() ), so being able to work with the datetime index would be great

ggplot2 boxplot from count table

久未见 提交于 2019-12-04 18:04:19
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 = count)) + geom_bar(stat = "identity") But how can I get a boxplot from the first data frame? Ggplot is

grouped boxplot r ggplot2

拈花ヽ惹草 提交于 2019-12-04 14:09:00
问题 I have 5 columns of numerical data (Equipment, Hyiene.items etc) and 1 column of categorical data (A or D). I'd like to make a grouped boxplot of the numerical data grouped by category but I cannot find a way: head(sc) Equipment Hygiene.items Patient Near.bed Far.bed Care 1 0 0 1 5 1 D 2 1 4 1 2 0 D 3 3 1 1 2 0 D 4 0 2 2 3 1 A 5 1 2 1 5 2 A 6 1 2 1 1 1 A boxplot(sc~sc$Care) would seem like the most appropriate way right? I like ggplot2 but it doesn't look like i can simply do this: ggplot(sc,

Adding Different Percentiles in boxplots in R

走远了吗. 提交于 2019-12-04 12:57:32
问题 I am failry new to R and recently used it to make some Boxplots. I also added the mean and standard deviation in my boxplot. I was wondering if i could add some kind of tick mark or circle in different percentile as well. Let's say if i want to mark the 85th, $ 90th percentile in each HOUR boxplot, is there a way to do this? My data consist of a year worth of loads in MW in each hour & My output consist of 24 boxplots for each hour for each month. I am doing each month at a time because i am

Multiple boxplots placed side by side for different column values in ggplot

[亡魂溺海] 提交于 2019-12-04 12:40:19
问题 I have read different posts like this and this but my problem has a small variation. I have a df like this ID <- c("DJ45","DJ46","DJ47","DJ48","DJ49","DJ53","DJ54","DJ55","DJ56","DJ57") Tool <- c("Tool_A", "Tool_A", "Tool_A", "Tool_A", "Tool_A", "Tool_B", "Tool_B", "Tool_B", "Tool_B", "Tool_B") Name <- c("CMP", "CMP", "CMP", "CMP", "CMP", "CMP", "CMP", "CMP", "CMP", "CMP") MS1 <- c(51,55,50,59,50,47,48,42,43,46) MS2 <- c(13,11,14,11,10,17,18,17,20,21) MS3 <- c(2,3,2,5,6,4,9,6,4,4) MS4 <- c(16

How would you plot a box plot and specific points on the same plot?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:14:52
We can draw box plot as below: qplot(factor(cyl), mpg, data = mtcars, geom = "boxplot") and point as: qplot(factor(cyl), mpg, data = mtcars, geom = "point") How would you combine both - but just to show a few specific points(say when wt is less than 2) on top of the box? Use + geom_point(...) on your qplot (just add a + geom_point() to get all the points plotted). To plot selectively just select those points that you want to plot: n <- nrow(mtcars) # plot every second point idx <- seq(1,n,by=2) qplot( factor(cyl), mpg, data=mtcars, geom="boxplot" ) + geom_point( aes(x=factor(cyl)[idx],y=mpg