boxplot

How to remove dots and extend boxplots in ggplot2 [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-24 17:53:23
问题 This question already has an answer here : ggplot2 - Boxplot Whiskers at Min/Max (1 answer) Closed 3 years ago . I have some data that I'm trying to build some boxplots with, but I'm getting this error: Warning message: Removed 1631 rows containing non-finite values (stat_boxplot). There are no NA values and all the data seems fine. How can I fix this as these are certainly valuable points in my data and should be extended by the whiskers? Data The data is fairly large, and I couldn't get a

Adding marginal histograms (or boxplots) to xyplot using lattice

久未见 提交于 2019-12-24 11:27:40
问题 Similar to this question, I'd like to to add marginal histograms or boxplots to a xyplot or densityplot using lattice . Is there a way to replace the right and/or top axes with these plots instead? Something like: library(lattice) x <- rnorm(100) y <- rnorm(100) xyplot(x~y, x.top = histogram(~x), # desired y.right = bwplot(~y) # desired ) How could I do this? 回答1: Using ggplot2 with ggExtra works. library(ggplot2) library(ggExtra) p <- ggplot(cars, aes_string('speed', 'dist')) + geom_point()

ggplot geom_point position_jitterdodge not working when color specified?

Deadly 提交于 2019-12-24 10:59:55
问题 I have plotted a boxplot+points. I want to add colors to the points. The position_jitterdodge worked fine without color as shown in Figure B, the points are close, which is I intended to do. But when I try to add colors to the points, the jitter.width parameter doesn't work any more (Figure A). The points are too far apart. I tried different numbers for jitter.width , not working. How do I solve this problem? library(tidyverse) library(ggpubr) mtcars$cyl <- factor(mtcars$cyl) p1 <- mtcars %>%

Boxplot over multiple columns within loop

亡梦爱人 提交于 2019-12-24 05:53:07
问题 I would like to make boxplots of the following: Example data: > head(df2) Results Capacity Power LDI LDE LB PDC D 1 2 3 4 5 6 7 8 9 1 ImpactDCNoV2GYesDC 1 PG11 LDI6 LDE0 LB0.045 PDC0 D10 1 NA NA NA NA NA NA NA NA 2 ImpactDCNoV2GYesDC 0.95 PG11 LDI5 LDE0 LB0.045 PDC0.25 D10 2 2 6 7 9 NA NA NA NA 3 ImpactDCNoV2GYesDC 0.9 PG11 LDI1 LDE0 LB0.045 PDC0.50 D10 5 3 NA NA NA NA NA NA NA 4 ImpactDCNoV2GYesDC 0.85 PG11 LDI6 LDE0 LB0.045 PDC0.75 D10 8 6 NA 8 NA NA NA NA NA 5 ImpactDCNoV2GYesDC 0.8 PG11

Add whiskers (horizontal lines) to multiple boxplots

萝らか妹 提交于 2019-12-24 04:34:12
问题 I need to add whisker (or horizontal lines) to my multiple box-plots. You can find my dataset here: link to data is broken... In other words, I am plotting three variables (Mat, Ita, and Log) divided by Gender (F and M), in order to compare their box plots. I need to add an horizontal line at the end of both vertical lines in each box plot. I am using ggplot2 package and the code I am using so far is (this code allows me to create the box plots as I need them, I only need to add the

Using matplotlib boxplot with groupby

℡╲_俬逩灬. 提交于 2019-12-24 04:33:09
问题 I have what superficially appears to be a simple question, but I cannot find the answer. I have a feature in my df for which I would like to use groupby on two different categories. Here's my metacode: df = pd.DataFrame(np.random.rand(100,2), columns=['Col1', 'Col2'] ) # Assume each series below repeats. df['X'] = pd.Series(['A','B','A','B',...,'A','B','A','B']) df['Y'] = pd.Series(['X','Y','X','Y',...,'X','Y','X','Y']) How can I use groupby to create 4 box plotsfor a particular feature in

Add jitter to box plot using markers in plotly

余生长醉 提交于 2019-12-24 03:06:22
问题 I made a boxplot: dat %>% plot_ly(y = ~xval, color = ~get(col), type = "box", boxpoints = "all", jitter = 0.7, pointpos = 0, marker = list(size = 3), source = shiny_source, key = shiny_key, hoverinfo = 'text', text = txt) but problem is that jittered points are not interactive and cannot be marked separately, so I came with an idea to add those points using add_markers : dat %>% plot_ly(y = ~xval, color = ~get(col), type = "box", boxpoints = FALSE, jitter = 0.7, pointpos = 0, marker = list

How to set the horizontal distance between outliers in gnuplot boxplot

谁说胖子不能爱 提交于 2019-12-24 03:05:15
问题 So if i have plotted some data in gnuplot as a boxplot (set style data gnuplot), and I have outliers having the same value, then they are plotted as dots horizontally at the same place. How can I set that horizontal distance? So for example I have the datafile data.dat 1 1 1 1 1 1 1 1 1 1 1 1 9 9 and plot it using set style data boxplot plot 'data.dat' using (1):1 set yrange [0:10] How can I set then the distance between the two points at y=9? 回答1: No, you cannot change that distance, The

boxplot the data of the y-axis of a scatter plot using matlab

醉酒当歌 提交于 2019-12-24 02:56:25
问题 What I basically want to do is to have boxplots for one data set on a scatter plot using Matlab. We can do the scatter plot with scatter(X, Y) and instead of the points corresponding to Y , I would like to have boxplots. Something like scatter(X, (boxplot(Y)) - which of course does not work. Have been searching high and low but could not find a relevant answer, or even something similar. The scatter-points from the left-hand side have to be replaced with box plots as on the right: 来源: https:/

Vector, ggplot2 doesn't know how to deal with data of class numeric

*爱你&永不变心* 提交于 2019-12-24 00:57:45
问题 I'm trying to make a simple boxplot with ggplot2. I've got a vector with numbers but when I type in the code an this error message appears: Error: ggplot2 doesn't know how to deal with data of class numeric. What does that mean? Code: vector1 <- c(x1, x2, x3, ...) library(ggplot2) ggplot(vector1, aes(x=x, y=value)) + boxplot() 回答1: You can use qplot as follows: qplot(1,vector1, geom="boxplot") Or (as @scoa pointed out) concert vector1 to a data.frame as ggplot operates only on data.frame s