Package: lwplot 0.0.2

lwplot: An Lighter-Weight Implementation of Leland Wilkinson's Grammar of Graphics

An implementation of the grammar of graphics in R, building on the foundation create by 'ggplot2' but being more conservative in the use of dependencies. It combines the advantages of both base and lattice graphics: conditioning and shared axes are handled automatically, and you can still build up a plot step by step from multiple data sources. It also implements a sophisticated multidimensional conditioning system and a consistent interface to map data to aesthetic attributes. See for more information, documentation and examples.

Authors:Hadley Wickham [aut], Winston Chang [aut], RStudio [cph], Dirk Eddelbuettel [ctb, cre]

lwplot.pdf |lwplot.html
lwplot/json (API)

# Install lwplot in R:
install.packages('lwplot', repos = c('', ''))

Peer review:

Bug tracker:

  • diamonds - Prices of 50,000 round cut diamonds
  • economics - US economic time series.
  • economics_long - US economic time series.
  • faithfuld - 2d density estimate of Old Faithful data
  • luv_colours - 'colors()' in Luv space.
  • midwest - Midwest demographics.
  • mpg - Fuel economy data from 1999 and 2008 for 38 popular models of car
  • msleep - An updated and expanded version of the mammals sleep dataset.
  • presidential - Terms of 11 presidents from Eisenhower to Obama.
  • seals - Vector field of seal movements.
  • txhousing - Housing sales in TX.


377 exports 13 stars 1.31 score 18 dependencies

Last updated 6 years agofrom:714b03612ac9b066e7480703355982b6a48f1bec


Aesthetic specifications

Rendered fromggplot2-specs.Rmdusingknitr::rmarkdownon May 29 2024.

Last update: 2018-10-13
Started: 2018-10-09

Extending ggplot2

Rendered fromextending-ggplot2.Rmdusingknitr::rmarkdownon May 29 2024.

Last update: 2018-10-13
Started: 2018-10-09

Readme and manuals

Help Manual

Help pageTopics
Add a new component to a ggplot or theme object.%+% %+replace%
Add margins to a data frame.add_margins
Modify properties of an element in a theme objectadd_theme
Define aesthetic mappings.aes
Define aesthetic mappings from strings, or quoted calls and formulas.aes_ aes_q aes_string
Colour related aesthetics: colour, fill and alphaaes_colour_fill_alpha color colour fill
Aesthetics: groupaes_group_order group
Differentiation related aesthetics: linetype, size, shapeaes_linetype_size_shape linetype shape size
Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yendaes_position x xend xmax xmin y yend ymax ymin
Create an annotation layer.annotate
Annotation: Custom grob.annotation_custom
Annotation: log tick marksannotation_logticks
Annotation: maps.annotation_map
Annotation: High-performance rectangular tiling.annotation_raster
Coerce to labeller functionas_labeller
Convert a ggproto object to a listas.list.ggproto
Create a complete ggplot appropriate to a particular data typeautoplot
Create a layer of map borders.borders
Calculate the element properties, by inheriting properties from its parentscalc_element
Cartesian coordinates.coord_cartesian
Cartesian coordinates with fixed relationship between x and y scales.coord_equal coord_fixed
Flipped cartesian coordinates.coord_flip
Map projections.coord_map coord_quickmap
Polar coordinates.coord_polar
Transformed cartesian coordinate system.coord_trans
Cut up numeric vector into useful groups.cut_interval cut_number cut_width
Prices of 50,000 round cut diamondsdiamonds
Use data.table::meltdtmelt
Replacement for reshape on outerdtouter
US economic time series.economics economics_long
Theme element: blank. This theme element draws nothing, and assigns no spaceelement_blank
Theme element: line.element_line
Theme element: rectangle.element_rect
Theme element: text.element_text
Expand the plot limits with data.expand_limits
Lay out panels in a grid.facet_grid
Facet specification: a single panel.facet_null
Wrap a 1d ribbon of panels into 2d.facet_wrap
2d density estimate of Old Faithful datafaithfuld
Format a ggproto objectformat.ggproto
Fortify a model with data.fortify
Fortify methods for objects produced by 'multcomp'fortify-multcomp fortify.cld fortify.confint.glht fortify.glht fortify.summary.glht
Supplement the data fitted to a linear model with model fit statistics.fortify.lm
Fortify method for map
Fortify method for classes from the sp package.fortify.Line fortify.Lines fortify.Polygon fortify.Polygons fortify.sp fortify.SpatialLinesDataFrame fortify.SpatialPolygons fortify.SpatialPolygonsDataFrame
Lines: horizontal, vertical, and specified by slope and intercept.geom_abline geom_hline geom_vline
Bars, rectangles with bases on x-axisgeom_bar stat_count
Add heatmap of 2d bin counts.geom_bin2d stat_bin2d stat_bin_2d
Blank, draws nothing.geom_blank
Box and whiskers plot.geom_boxplot stat_boxplot
Display contours of a 3d surface in 2d.geom_contour stat_contour
Count the number of observations at each location.geom_count stat_sum
Vertical intervals: lines, crossbars & errorbars.geom_crossbar geom_errorbar geom_linerange geom_pointrange
Display a smooth density estimate.geom_density stat_density
Contours from a 2d density estimate.geom_density2d geom_density_2d stat_density2d stat_density_2d
Dot plotgeom_dotplot
Horizontal error barsgeom_errorbarh
Histograms and frequency polygons.geom_freqpoly geom_histogram stat_bin
Hexagon binning.geom_hex stat_binhex stat_bin_hex
Points, jittered to reduce overplotting.geom_jitter
Textual annotations.geom_label geom_text
Polygons from a reference map.geom_map
Connect observations.geom_line geom_path geom_step
Points, as for a scatterplotgeom_point
Polygon, a filled path.geom_polygon
Add quantile lines from a quantile regression.geom_quantile stat_quantile
Draw rectangles.geom_raster geom_rect geom_tile
Ribbons and area plots.geom_area geom_ribbon
Marginal rug plots.geom_rug
Line segments and curves.geom_curve geom_segment
Add a smoothed conditional mean.geom_smooth stat_smooth
A line segment parameterised by location, direction and distance.geom_spoke stat_spoke
Violin plot.geom_violin stat_ydensity
Create a new ggplot plot.ggplot ggplot.default
Create a new ggproto objectggproto ggproto_parent
Save a ggplot (or other grid object) with sensible defaultsggsave
ggplot2 themesggtheme theme_bw theme_classic theme_dark theme_gray theme_grey theme_light theme_linedraw theme_minimal theme_void
Graphical .stroke graphical-units
Continuous colour bar guide.guide_colorbar guide_colourbar
Legend guide.guide_legend
Set guides for each scale.guides
Wrap up a selection of summary functions from Hmisc to make it easy to use with 'stat_summary'.hmisc mean_cl_boot mean_cl_normal mean_sdl median_hilow
Is an object a ggproto object?is.ggproto
Reports whether x is a rel objectis.rel
Reports whether x is a theme objectis.theme
Backquoted labellerlabel_bquote
Generic labeller function for facetslabeller
Labeller functionslabellers label_both label_context label_parsed label_value label_wrap_gen
Change axis labels and legend titlesggtitle labs xlab ylab
Retrieve the last plot to be modified or created.last_plot
Create a new layerlayer
Convenience functions to set the axis limits.lims xlim ylim
'colors()' in Luv space.luv_colours
Create a data frame of map data.map_data
Define margins.margin
Calculate mean and standard errors on either side.mean_se
Midwest demographics.midwest
Fuel economy data from 1999 and 2008 for 38 popular models of carmpg
An updated and expanded version of the mammals sleep dataset.msleep
Adjust position by dodging overlaps to the side.position_dodge
Stack overlapping objects on top of one another.position_fill position_stack
Don't adjust positionposition_identity
Jitter points to avoid overplotting.position_jitter
Adjust position by simultaneously dodging and jitteringposition_jitterdodge
Nudge points.position_nudge
Terms of 11 presidents from Eisenhower to Obama.presidential
Draw plot on current graphics device.plot.ggplot print.ggplot
Print a ggproto objectprint.ggproto
Quick plotqplot quickplot
Relative sizing for theme elementsrel
Compute the "resolution" of a data vector.resolution
Alpha scales.scale_alpha scale_alpha_continuous scale_alpha_discrete
Sequential, diverging and qualitative colour scales from colorbrewer.orgscale_color_brewer scale_color_distiller scale_colour_brewer scale_colour_distiller scale_fill_brewer scale_fill_distiller
Smooth gradient between two coloursscale_color_continuous scale_color_gradient scale_color_gradient2 scale_color_gradientn scale_colour_continuous scale_colour_date scale_colour_datetime scale_colour_gradient scale_colour_gradient2 scale_colour_gradientn scale_fill_continuous scale_fill_date scale_fill_datetime scale_fill_gradient scale_fill_gradient2 scale_fill_gradientn
Sequential grey colour scale.scale_color_grey scale_colour_grey scale_fill_grey
Qualitative colour scale with evenly spaced hues.scale_color_discrete scale_color_hue scale_colour_discrete scale_colour_hue scale_fill_discrete scale_fill_hue
Continuous position scales (x & y).scale_continuous scale_x_continuous scale_x_log10 scale_x_reverse scale_x_sqrt scale_y_continuous scale_y_log10 scale_y_reverse scale_y_sqrt
Position scale, date & date timesscale_date scale_x_date scale_x_datetime scale_y_date scale_y_datetime
Use values without scaling.scale_alpha_identity scale_color_identity scale_colour_identity scale_fill_identity scale_identity scale_linetype_identity scale_shape_identity scale_size_identity
Scale for line patterns.scale_linetype scale_linetype_continuous scale_linetype_discrete
Create your own discrete scale.scale_alpha_manual scale_color_manual scale_colour_manual scale_fill_manual scale_linetype_manual scale_manual scale_shape_manual scale_size_manual
Scale for shapes, aka glyphs.scale_shape scale_shape_continuous scale_shape_discrete
Scale size (area or radius).scale_radius scale_size scale_size_area scale_size_continuous scale_size_date scale_size_datetime scale_size_discrete
Discrete position.scale_x_discrete scale_y_discrete
Vector field of seal movements.seals
Empirical Cumulative Density Functionstat_ecdf
Plot data ellipses.stat_ellipse
Superimpose a function.stat_function
Identity statistic.stat_identity
Calculation for quantile-quantile plot.geom_qq stat_qq
Bin and summarise in 2d (rectangle & hexagons)stat_summary2d stat_summary_2d stat_summary_hex
Summarise y values at unique/binned x x.stat_summary stat_summary_bin
Remove duplicates.stat_unique
Set theme elementstheme
Get, set and update themes.theme_get theme_replace theme_set theme_update
Translating between qplot and ggplottranslate_qplot_ggplot
Translating between qplot and latticetranslate_qplot_lattice
Housing sales in TX.txhousing
Modify geom/stat aesthetic defaults for future plotsupdate_geom_defaults update_stat_defaults
Update axis/legend labelsupdate_labels