Questions tagged [bwplot]

`bwplot` is a function used to create a box and whisker plot in the `lattice` graphics package for `r`.

bwplot is a function used to create a box and whisker plot in the lattice graphics package for r. Questions using this tag should be about the box and whisker plot and not about general lattice issues.

By default the box-plot statistics are calculated using the boxplot.stats function. However the user can pass a custom function to the stats argument in bwplot in place of the default.

25 questions
5
votes
1 answer

R lattice bwplot: Fill boxplots with specific color depending on factor level

I have this dataframe as an example: >mydata <- rbind(data.frame(Col1 = rnorm(2*1000),Col2 =rep(c("A", "C"), each=1000),Col3=factor(rep(c("YY","NN"), 1000))),data.frame(Col1 = rnorm(1000),Col2 =rep(c("B")),Col3=factor(rep(c("YY","YN"), 500)))) That…
Pablo Fleurquin
  • 351
  • 1
  • 3
  • 14
5
votes
2 answers

Grouped horizontal boxplot with bwplot

I have the following code that allows grouped vertical box-plots via the bwplot function in lattice. Reproducible example.. data(mpg, package = "ggplot2") bwplot( hwy~class, data = mpg, groups = year, pch = "|", box.width = 1/3, auto.key =…
user2507608
  • 355
  • 1
  • 6
  • 18
5
votes
3 answers

Equivalent of boxplot lwd parameter for bwplot

I want to have the box plotted with thicker lines. In boxplot function I simply put lwd=2, but in the lattice bwplot I can pull my hair out and haven't found a solution! (with the box I mean the blue thing in the image above) Sample code to work…
Tomas
  • 57,621
  • 49
  • 238
  • 373
2
votes
1 answer

How to make a bwplot for different vectors lenght

HI i trying to make one bwplot (it must be bwplot from Lattice) for differnt vectors lenghts. xx1 <- rnorm(20, mean = 3, sd = 3.6) #20 xx2 <- rpois(40, lambda = 3.5) xx3 <- rchisq(31, df = 5, ncp = 0) #31
Garf
  • 75
  • 1
  • 12
1
vote
0 answers

bwplot coding and customise plot

I need some help with a graphic. I want to add the boxplot of the complete data. I've done it on the graph but got two colours on the box plot. I also need help figuring out how to make the names of the data mechanisms easier to read. For example,…
Ibrahima
  • 11
  • 3
1
vote
1 answer

How to add mean to grouped bwplot Lattice R

I have a grouped boxplot that shows for each category two boxes side by side (see code). Now I am interested in adding the mean for each category and box separately. I can calculate and visualize the mean for each category but not conditioned on the…
1
vote
2 answers

sort `caret` models in `bwplot()`

I am plotting box-plots of the accuracy scores of resamples of yearly models trained with caret. The models are named by the years they refer to: 2000, 2001, 2002, ..., 2010. I want the models to appear in the box-plots with ascending order based on…
et_
  • 179
  • 8
1
vote
1 answer

R - change of boxplot on bwplot from lattice

I was tasked to change the code which uses graphics package into something with bwplot from lattice package with the same result. Boxplot: par(mai = c(1, 1, 1, 1), omi = c(0, 0, 0, 0)) set.seed(591) xx1 <- rnorm(20, mean = 3, sd = 3.6) xx2 <-…
KacZdr
  • 1,267
  • 3
  • 8
  • 23
1
vote
2 answers

how to add multiple boxplots to same axis set

I'm trying to plot 4 groups of data as boxplots on the same set of axis. I've been able to use the print() function to plot them on separate plots, but can't figure out how to plot them all together, preferably using the base package or…
Natway
  • 11
  • 2
1
vote
1 answer

Coloring each violin in a different color in panel.violin of bwplot

Suppose I have this example data.frame: df <- data.frame(y=c(rnorm(150, 2, 1), rnorm(100, 1, 1.5), rnorm(200, 3, 0.75)), x=c(rep("c1", 150),rep("c2", 100),rep("c3", 200)), color=c(rep("gray",150),rep("red",150),rep("blue",150))) and I would like to…
user1701545
  • 5,706
  • 14
  • 49
  • 80
1
vote
1 answer

How can I add text in a bwplot (lattice graphics in R)?

I need help with lattice bwplot. I made my multipanel plots and I put them in the same window. library(lattice) attach(mtcars) gear.f<-factor(gear,levels=c(3,4,5), labels=c("3gears","4gears","5gears")) cyl.f <-factor(cyl,levels=c(4,6,8),…
1
vote
2 answers

Boxplot and xyplot overlapped

I've done a conditional boxplot with my data, with the bwplot function of the lattice library. A1 <- bwplot(measure ~ month | plot , data = prueba, strip = strip.custom(bg = 'white'), cex = .8, layout = c(2, 2), …
TeSeA
  • 55
  • 6
1
vote
1 answer

How to create a bwplot with date on x-axis

users thanks to the reply of @McQueenDon on r-nabble http://r.789695.n4.nabble.com/boxplot-with-x-axis-time-td4686787.html#a4687746 I managed to produce a boxplot::base of a single variable with the x-axis correctly formatted and spaced for the…
0
votes
1 answer

Change size of box title in bwplot (lattice)

I have this bwplot made with the lattice package. Only thing is I want to enlarge the size of the "morning" and "midday" text on the y-axis (this is a 2-level factor called Period in the script). Any idea how to do this? My plot and script so…
0
votes
1 answer

Is there a way I could reproduce the box plots using the lattice package function bwplot()

par(mai = c(1, 1, 1, 1), omi = c(0, 0, 0, 0)) set.seed(591) (xx1 <- rnorm(20, mean = 3, sd = 3.6)) (xx2 <- rpois(40, lambda = 3.5)) (xx3 <- rchisq(31, df = 5, ncp = 0)) box plot code using the R base package. box1 <- boxplot(xx1, xx2, xx3, names =…
Matthew
  • 1
  • 2
1
2