boxplot

How do I turn the numeric output of boxplot (with plot=FALSE) into something usable?

好久不见. 提交于 2019-11-27 12:33:55
问题 I'm successfully using the boxplot function to generate... boxplots. Now I need to generate tables containing the stats that boxplot calculates in order to create plots. I do this by using the plot=FALSE option. The problem is that this produces data in a rather bizarre format that I simply can't do anything with. Here's an example: structure(list(stats = structure(c(178.998262143545, 182.227431564442, 202.108456373209, 220.375358994654, 221.990406228232, 216.59986775699, 217.054997032148,

Seaborn load_dataset

南楼画角 提交于 2019-11-27 11:53:52
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? Can I actually use this for my own boxplots? EDIT: I managed to get my own boxplots working using my own

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

独自空忆成欢 提交于 2019-11-27 11:20:05
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 left to right: c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00") I tried ggplot(data =

Transform only one axis to log10 scale with ggplot2

一笑奈何 提交于 2019-11-27 11:13:34
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 = color)) The problem is not serious here, but I hope you could imagine why I would like to see the

Removing one tableGrob when applied to a box plot with a facet_wrap

a 夏天 提交于 2019-11-27 09:19:29
I'm using the code below to enrich a box plot with a summary table for categorical variable created on the x-axis. # Libs require(ggplot2); require(gridExtra); require(grid); require(ggthemes) # Data data(mtcars) # Function to summarise the data fun_dta_sum <- function(var_sum, group, data) { sum_dta <- data.frame( aggregate(var_sum ~ group, FUN = min, data = data), aggregate(var_sum ~ group, FUN = max, data = data), aggregate(var_sum ~ group, FUN = mean, data = data)) sum_dta <- sum_dta[,c(1,2,4,6)] colnames(sum_dta) <- c("Group (x axis)", "min", "max", "mean") rownames(sum_dta) <- NULL sum

How to plot a hybrid boxplot: half boxplot with jitter points on the other half?

流过昼夜 提交于 2019-11-27 08:44:47
I'm trying to make a similar plot to Fig. 2d-f in an article published on Nature this year. It's basically a half boxplot with points on the other half. Can anyone give me some hints? Thank you very much! These are my data and code which produced full boxes with points inside require(magrittr) require(tidyverse) dat <- structure(list(p1 = c(0.0854261831077604, 0.408418657218253, 0.577793646477315, 0.578028229977424, 0.48933166218204, 0.53117814324334, 0.526653494462464, 0.00687616283435221, 0.444300425796509, 0.00287319455358522, 0.949821402532831, 0.96832469523368, 0.953281969982759, 0

Is it possible to plot a boxplot from previously-calculated statistics easily (in R?) [duplicate]

依然范特西╮ 提交于 2019-11-27 07:51:00
问题 This question already has answers here : Closed 7 years ago . This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . Possible Duplicate: Draw bloxplots in R given 25,50,75 percentiles and min and max values I have a number of sets of summary statistics from various datasets: max, min, mean, median etc. I'd like to plot box-plots of these - or at least, similar plots to boxplots (I don't have UQ and LQ stats, although it may be

How to draw the boxplot with significant level?

喜欢而已 提交于 2019-11-27 06:50:18
Some time ago I asked a question about drawing boxplot Link1 . I have got some data with 3 different groups (or labels) Please down load here . I can use the following R codes to get the boxplot library(reshape2) library(ggplot2) morphData <- read.table(".\\TestData3.csv", sep=",", header=TRUE); morphData.reshaped <- melt(morphData, id.var = "Label") ggplot(data = morphData.reshaped, aes(x=variable, y=value)) + + geom_boxplot(aes(fill=Label)) Here I just wondering how to put the significant level above the boxplot. To make myself clear I put a screenshot cut from a paper here: I don't quite

ggplot2: horizontal position of stat_summary with geom_boxplot

[亡魂溺海] 提交于 2019-11-27 06:26:51
问题 I want to annotate mean of each boxplot using ggplot2 . However, I could not figure out how to horizontally center the symbols marking the means within their respective boxes (see image below). MWE is below for reference: library(ggplot2) ggplot(data=mpg, mapping=aes(x=class, y=hwy)) + geom_boxplot(aes(color = drv), outlier.shape = NA) + stat_summary(fun.y = mean, geom = "point", size=2, aes(shape = drv, color = drv)) + theme_bw() 回答1: Try with position_dodge() ggplot(data=mpg, mapping=aes(x

How to put values on a boxplot for median, 1st quartile and last quartile?

陌路散爱 提交于 2019-11-27 06:21:29
问题 How to put values on boxplot and control its width? X<-c(1,2,,3,4,4,5,5,6,6,6,6,6,7) I need to write values for min, max, 1st quartile, median and last quartile. How can I put it there? 回答1: You can use horizontal = TRUE get a horizontal boxplot and axes = FALSE to remove the axes. staplewex = 1 sets the staple width the same as the box width Then you can use fivenum to return the statistics used to create the boxplot and use these as text labels, fiddling with the y value until you have what