Skip to contents

Creating Plots

Everything starts here. The plot2() function is the heart of this package – just pass in your data and it will figure out the best way to visualise it. Whether you have a data frame, a matrix, a statistical model, or even geographic data, plot2() knows what to do. Want to layer extra elements on top? Use add_type() and its convenient shortcuts to build up your plot step by step.

Customising Your Plot

Already have a plot but want to fine-tune it? These functions let you change which variables are mapped to visual properties like colour or size, reorder the layers that make up your plot, or switch to a spider (radar) chart layout. Small adjustments can make a big difference in how clearly your data tells its story.

add_mapping()
Add Additional Mapping
move_layer()
Move a ggplot Layer
coord_spider() CoordSpider
Spider (Radar) Coordinate System for ggplot2

Working with Colours

Colour is one of the most powerful tools in data visualisation. These functions give you access to a wide range of colour palettes – including colourblind-friendly options – and let you define and save your own custom colours for consistent use across all your plots and projects.

get_colour() register_colour() unregister_colour() add_white()
Get (and Register) Colours from R, Viridis and More

Themes and Labels

Great plots deserve a clean, professional look. theme_minimal2() gives your plots a modern, print-ready appearance with sensible defaults. The other functions in this section help you use bold, italic, and other rich formatting in your plot titles and axis labels, and make it easy to extract or customise the title of any plot.

theme_minimal2()
An Even More Minimal Theme
md_to_expression()
Convert Markdown to Plotmath Expression
get_plot_title()
Get Plot Title
euros() dollars()
Label Euro currencies

Number Formatting

Numbers on axes and in labels should be easy to read, regardless of where in the world your audience is. These helpers automatically format numbers with the right decimal separator and thousands grouping for your locale, and can display values as euros or dollars.

dec_mark() big_mark()
Use Decimal Comma?

Interactive Plots

Want your audience to hover, zoom, and click on your plots? Turn any plot into an interactive widget with as_plotly(), or use create_interactively() to build a plot from scratch using a point-and-click interface – no code required.

as_plotly() plotly_style()
Create Interactive Plotly
create_interactively()
Interactively Create a plot2

Default Settings

Tired of setting the same options every time? Configure your preferred defaults – such as your go-to colour scheme, font, or decimal format – once, and every plot you create will automatically use them.

Example Datasets

These built-in datasets are ready to use for exploring plot2() and trying out different plot types. No need to load external files – just type the dataset name and start plotting.

admitted_patients
Example Data Set with Admitted Patients
netherlands
Example Geography Data Set: the Netherlands

Convenience Functions

A handful of commonly used helper functions from other packages, made available directly through plot2 so you do not need to load additional packages for everyday tasks like counting rows or selecting columns.