Examples for 'ggplot2::qplot'


Quick plot

Aliases: qplot quickplot

Keywords:

### ** Examples

# Use data from data.frame
qplot(mpg, wt, data = mtcars)
plot of chunk example-ggplot2-qplot-1
qplot(mpg, wt, data = mtcars, colour = cyl)
plot of chunk example-ggplot2-qplot-1
qplot(mpg, wt, data = mtcars, size = cyl)
plot of chunk example-ggplot2-qplot-1
qplot(mpg, wt, data = mtcars, facets = vs ~ am)
plot of chunk example-ggplot2-qplot-1
## No test: 
qplot(1:10, rnorm(10), colour = runif(10))
plot of chunk example-ggplot2-qplot-1
qplot(1:10, letters[1:10])
plot of chunk example-ggplot2-qplot-1
mod <- lm(mpg ~ wt, data = mtcars)
qplot(resid(mod), fitted(mod))
plot of chunk example-ggplot2-qplot-1
f <- function() {
   a <- 1:10
   b <- a ^ 2
   qplot(a, b)
}
f()
plot of chunk example-ggplot2-qplot-1
# To set aesthetics, wrap in I()
qplot(mpg, wt, data = mtcars, colour = I("red"))
plot of chunk example-ggplot2-qplot-1
# qplot will attempt to guess what geom you want depending on the input
# both x and y supplied = scatterplot
qplot(mpg, wt, data = mtcars)
plot of chunk example-ggplot2-qplot-1
# just x supplied = histogram
qplot(mpg, data = mtcars)
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
plot of chunk example-ggplot2-qplot-1
# just y supplied = scatterplot, with x = seq_along(y)
qplot(y = mpg, data = mtcars)
plot of chunk example-ggplot2-qplot-1
# Use different geoms
qplot(mpg, wt, data = mtcars, geom = "path")
plot of chunk example-ggplot2-qplot-1
qplot(factor(cyl), wt, data = mtcars, geom = c("boxplot", "jitter"))
plot of chunk example-ggplot2-qplot-1
qplot(mpg, data = mtcars, geom = "dotplot")
Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.
plot of chunk example-ggplot2-qplot-1
## End(No test)

[Package ggplot2 version 3.3.6 Index]