N.B. the commands here are either exact copies of the commands presented in Wickham (2009) or some minor alterations to them. Notably, some code given in the book no longer works. This is given a #!
The ggplot2
package has a summary
method that often but not always offers something to show that things have changed from one plot to another. I’ve kept the use of this command in as it shows where we need to look for more information and from where we ought to look for it.
library(BrailleR)
library(ggplot2)
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:BrailleR':
##
## xlab, ylab
library(magrittr)
dsmall = diamonds[1:100,]
g1 = qplot(carat, price, data = diamonds)
summary(g1)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat, y = price
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g1
VI(g1)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
g2 = qplot(carat, price, data = dsmall, colour = color)
summary(g2)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [100x10]
## mapping: colour = color, x = carat, y = price
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g2
g2 %>% VI()
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
##
## Colour is used to represent "color", a factor with levels: D, E, F, G, H, I, J.
# to get the content of the graph to be printed we need:
#class(g2)="list"; g2
g3 = qplot(carat, price, data = dsmall, shape = cut)
summary(g3)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [100x10]
## mapping: shape = cut, x = carat, y = price
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g3
VI(g3)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
#class(g3)="list"; g3
# to get semi-transparent points
g4 = qplot(carat, price, data = diamonds, alpha = I(1/100))
summary(g4)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat, y = price
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g4
VI(g4)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
# to add a smoother (default is loess for n<1000)
g5 = qplot(carat, price, data = dsmall, geom = c("point", "smooth"))
summary(g5)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [100x10]
## mapping: x = carat, y = price
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
##
## geom_smooth: na.rm = FALSE
## stat_smooth: na.rm = FALSE, method = auto, formula = y ~ x, se = TRUE
## position_identity
g5
## `geom_smooth()` using method = 'loess'
VI(g5)
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
#! g5a = qplot(carat, price, data = dsmall, geom = c("point", "smooth"), span = 1)
library(splines)
#! g5b = qplot(carat, price, data = dsmall, geom = c("point", "smooth"), method = "lm")
#! g5c = qplot(carat, price, data = dsmall, geom = c("point", "smooth"), method = "lm", formula = y ~ ns(x,5))
# continuous v categorical
g6 = qplot(color, price / carat, data = diamonds, geom = "jitter", alpha = I(1 / 50))
summary(g6)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = color, y = price/carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_jitter
g6
VI(g6)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "price/carat" labeled from to ;
g6a = qplot(color, price / carat, data = diamonds, geom = "boxplot")
summary(g6a)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = color, y = price/carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_boxplot: outlier.colour = NULL, outlier.fill = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE, na.rm = FALSE
## stat_boxplot: na.rm = FALSE
## position_dodge
g6a
VI(g6a)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "price/carat" labeled from to ;
# univariate plots
g7a = qplot(carat, data = diamonds, geom = "histogram")
summary(g7a)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: na.rm = FALSE
## stat_bin: binwidth = NULL, bins = NULL, na.rm = FALSE, pad = FALSE
## position_stack
g7a
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
VI(g7a)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "count" labeled from to ;
g7b = qplot(carat, data = diamonds, geom = "histogram", binwidth = 1, xlim = c(0,3))
g7c = qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.1, xlim = c(0,3))
g7d = qplot(carat, data = diamonds, geom = "histogram", binwidth = 0.01, xlim = c(0,3))
summary(g7d)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat
## scales: x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: na.rm = FALSE
## stat_bin: binwidth = 0.01, bins = NULL, na.rm = FALSE, pad = FALSE
## position_stack
g7d
## Warning: Removed 32 rows containing non-finite values (stat_bin).
VI(g7d)
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "count" labeled from to ;
g8 = qplot(carat, data = diamonds, geom = "density")
summary(g8)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_density: na.rm = FALSE
## stat_density: na.rm = FALSE
## position_identity
g8
VI(g8)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "density" labeled from to ;
# data is separated by implication using the following...
g9 = qplot(carat, data = diamonds, geom = "density", colour = color)
summary(g9)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: colour = color, x = carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_density: na.rm = FALSE
## stat_density: na.rm = FALSE
## position_identity
g9
VI(g9)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "density" labeled from to ;
##
## Colour is used to represent "color", a factor with levels: D, E, F, G, H, I, J.
g10 = qplot(carat, data = diamonds, geom = "histogram", fill = color)
summary(g10)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: fill = color, x = carat
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: na.rm = FALSE
## stat_bin: binwidth = NULL, bins = NULL, na.rm = FALSE, pad = FALSE
## position_stack
g10
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
VI(g10)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "count" labeled from to ;
# bar charts for categorical variable
g11a = qplot(color, data = diamonds)
summary(g11a)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = color
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: width = NULL, na.rm = FALSE
## stat_count: width = NULL, na.rm = FALSE
## position_stack
g11a
VI(g11a)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "count" labeled from to ;
g11b = qplot(color, data = diamonds, geom = "bar")
summary(g11b)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = color
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: width = NULL, na.rm = FALSE
## stat_count: width = NULL, na.rm = FALSE
## position_stack
g11b
VI(g11b)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "count" labeled from to ;
g12a = qplot(color, data = diamonds, geom = "bar", weight = carat)
summary(g12a)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: weight = carat, x = color
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: width = NULL, na.rm = FALSE
## stat_count: width = NULL, na.rm = FALSE
## position_stack
g12a
VI(g12a)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "count" labeled from to ;
g12b = qplot(color, data = diamonds, geom = "bar", weight = carat) + scale_y_continuous("carat")
summary(g12b)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: weight = carat, x = color
## scales: y, ymin, ymax, yend, yintercept, ymin_final, ymax_final, lower, middle, upper
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_bar: width = NULL, na.rm = FALSE
## stat_count: width = NULL, na.rm = FALSE
## position_stack
g12b
VI(g12b)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "color" labeled from to and y-axis "count" labeled from to ;
# time series plots
g13a = qplot(date, unemploy / pop, data = economics, geom = "line")
summary(g13a)
## data: date, pce, pop, psavert, uempmed, unemploy [574x6]
## mapping: x = date, y = unemploy/pop
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_line: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g13a
VI(g13a)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "date" labeled from to and y-axis "unemploy/pop" labeled from to ;
g13b = qplot(date, uempmed, data = economics, geom = "line")
summary(g13b)
## data: date, pce, pop, psavert, uempmed, unemploy [574x6]
## mapping: x = date, y = uempmed
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_line: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g13b
VI(g13b)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "date" labeled from to and y-axis "uempmed" labeled from to ;
# path plots
year <- function(x) as.POSIXlt(x)$year + 1900
g14a = qplot(unemploy / pop, uempmed, data = economics, geom = c("point", "path"))
summary(g14a)
## data: date, pce, pop, psavert, uempmed, unemploy [574x6]
## mapping: x = unemploy/pop, y = uempmed
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
##
## geom_path: lineend = butt, linejoin = round, linemitre = 1, arrow = NULL, na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g14a
VI(g14a)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "unemploy/pop" labeled from to and y-axis "uempmed" labeled from to ;
#g14b = qplot(unemploy / pop, uempmed, data = economics, geom = "path", colour = year(date)) + scale_area()
#summary(g14b)
#VI(g14b)
# facets is the ggplot term for trellis' panels
g15a = qplot(carat, data = diamonds, facets = color ~ ., geom = "histogram", binwidth = 0.1, xlim = c(0, 3))
summary(g15a)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat
## scales: x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper
## faceting: <ggproto object: Class FacetGrid, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## super: <ggproto object: Class FacetGrid, Facet>
## -----------------------------------
## geom_bar: na.rm = FALSE
## stat_bin: binwidth = 0.1, bins = NULL, na.rm = FALSE, pad = FALSE
## position_stack
g15a
## Warning: Removed 32 rows containing non-finite values (stat_bin).
VI(g15a)
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "count" labeled from to ;
g15b = qplot(carat, ..density.., data = diamonds, facets = color ~ ., geom = "histogram", binwidth = 0.1, xlim = c(0, 3))
summary(g15b)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [53940x10]
## mapping: x = carat, y = ..density..
## scales: x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper
## faceting: <ggproto object: Class FacetGrid, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## super: <ggproto object: Class FacetGrid, Facet>
## -----------------------------------
## geom_bar: na.rm = FALSE
## stat_bin: binwidth = 0.1, bins = NULL, na.rm = FALSE, pad = FALSE
## position_stack
g15b
## Warning: Removed 32 rows containing non-finite values (stat_bin).
VI(g15b)
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## Warning: Removed 32 rows containing non-finite values (stat_bin).
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "density" labeled from to ;
# rescaling of the axes
g16 = qplot(carat, price, data = dsmall, log = "xy")
summary(g16)
## data: carat, cut, color, clarity, depth, table, price, x, y, z
## [100x10]
## mapping: x = carat, y = price
## scales: x, xmin, xmax, xend, xintercept, xmin_final, xmax_final, xlower, xmiddle, xupper, y, ymin, ymax, yend, yintercept, ymin_final, ymax_final, lower, middle, upper
## faceting: <ggproto object: Class FacetNull, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## vars: function
## super: <ggproto object: Class FacetNull, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
g16
VI(g16)
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "carat" labeled from to and y-axis "price" labeled from to ;
g17 = qplot(displ, hwy, data=mpg, facets =~ year) + geom_smooth()
summary(g17)
## data: manufacturer, model, displ, year, cyl, trans, drv, cty, hwy,
## fl, class [234x11]
## mapping: x = displ, y = hwy
## faceting: <ggproto object: Class FacetWrap, Facet>
## compute_layout: function
## draw_back: function
## draw_front: function
## draw_labels: function
## draw_panels: function
## finish_data: function
## init_scales: function
## map: function
## map_data: function
## params: list
## render_back: function
## render_front: function
## render_panels: function
## setup_data: function
## setup_params: function
## shrink: TRUE
## train: function
## train_positions: function
## train_scales: function
## super: <ggproto object: Class FacetWrap, Facet>
## -----------------------------------
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
##
## geom_smooth: na.rm = FALSE
## stat_smooth: na.rm = FALSE, method = auto, formula = y ~ x, se = TRUE
## position_identity
g17
## `geom_smooth()` using method = 'loess'
VI(g17)
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'
## This untitled chart;
## has no subtitle;
## and no caption.
## with x-axis "displ" labeled from to and y-axis "hwy" labeled from to ;