Skip to main content

More Plot Types (ggplot2)

In addition to the default plot types (dot plot, histogram, scatter plot, bar chart, hexagonal binning, and grid density), iNZight offers a range of alternative plot types built with ggplot2. These are available via the Plot Type dropdown in the Add to Plot panel and are labelled with a (gg) prefix.

Accessing gg plot types

  1. Create a plot by selecting variables in the control panel
  2. Open Add to Plot from the plot toolbar
  3. Under Plot Type, use the dropdown to select an alternative (gg) plot type

The available options depend on the types of variables you have selected.

Required packages

ggplot2 plot types require several packages to be installed: ggplot2, ggtext, dplyr, tidyr, forcats, ggmosaic, waffle, ggthemes, ggbeeswarm, and ggridges. If any are missing, iNZight will display the installation command needed.

Survey data

ggplot2 plot types are not available when a survey design is active. Only the default iNZight plot types are supported for survey data.

Available plot types

Numeric variables (one numeric, or numeric vs categorical)

These are alternatives to the default dot plot and histogram:

Plot typeDescription
(gg) dot stripIndividual points arranged along a strip
(gg) barcodeThin vertical lines marking each observation
(gg) boxplotTraditional box-and-whisker plot
(gg) beeswarmPoints spread to avoid overlap, revealing distribution shape
(gg) violinMirrored density curve showing distribution shape
(gg) densitySmooth density curve
(gg) cumulative curveCumulative frequency/proportion curve
(gg) column/row barValues plotted as individual bars (one numeric variable only)
(gg) lollipopDot-on-a-stick chart for individual values (one numeric variable only)

When a second categorical variable is selected:

Plot typeDescription
(gg) density (ridgeline)Overlapping density curves stacked by group
(gg) pyramidBack-to-back bars for comparing two groups (binary second variable only)

Categorical variables (one or two categorical)

These are alternatives to the default bar chart:

Plot typeDescription
(gg) column/row barColumn or row chart of counts
(gg) stacked column/rowStacked bars showing composition
(gg) lollipopDot-on-a-stick chart of counts

With one categorical variable only:

Plot typeDescription
(gg) gridplotA waffle-style grid showing counts per square
(gg) piePie chart
(gg) donutDonut chart (ring-shaped pie)

With two categorical variables:

Plot typeDescription
(gg) frequency polygonsLine chart of category counts across groups
(gg) heatmapColour-coded grid showing counts at each combination
(gg) spine/pyramidSpine plot for binary second variable
(gg) diverging stacked bar (Likert)Diverging bars centred around a midpoint (3+ levels in first variable)

Multiple variables

When multiple categorical variables are dragged into Variable 1 simultaneously:

Plot typeDescription
(gg) multiple barSide-by-side bars for each variable
(gg) multiple stacked columnStacked column chart across variables
(gg) multiple binary columnBinary comparison chart (two-level variables only)

Themes

All gg plot types support a Theme selector in the Add to Plot panel. Themes control the overall visual style of the plot — background, grid lines, fonts, and colours.

The following themes are always available:

ThemeDescription
DefaultStandard ggplot2 grey theme
Black & WhiteWhite background with black elements
LightLight grey background
DarkDark background with light text
MinimalClean, minimal styling
ClassicTraditional white background with axis lines
VoidNo background, axes, or grid — just the data

If the ggthemes package is installed, additional themes become available:

ThemeStyle
StataStata statistical software
Wall Street JournalWSJ chart styling
TufteEdward Tufte's minimalist aesthetic
Google DocsGoogle Docs chart colours
FiveThirtyEightFiveThirtyEight journalism style
ExcelMicrosoft Excel default chart
EconomistThe Economist magazine charts

If ggthemes is not installed, an "Install additional themes..." option appears in the dropdown.

Colour palettes

Many gg plot types provide a Colour palette selector for choosing a colour scheme. The available palettes vary by plot type and include both sequential and qualitative colour scales.

Rotation

Most gg plot types support rotation options:

  • Rotate plot: Swap the x and y axes (e.g., turn vertical bars into horizontal bars)
  • Rotate x-axis labels: Angle the x-axis labels for readability
  • Rotate y-axis labels: Angle the y-axis labels for readability

Rotation is not available for pie and donut charts.

tip

Some plot types — such as boxplot, violin, beeswarm, and lollipop — are rotated (horizontal) by default. Ticking the "Rotate" checkbox will switch them to vertical orientation.

Plot-specific options

Certain gg plot types have additional controls:

Plot typeOptions
Violin / DensitySmoothing adjustment slider
BarcodeSize slider
Barcode (grouped)Width and height sliders
Beeswarm / QuasirandomPoint size, swarm width, and method
Dot stripPoint size and transparency
LollipopLine width, point size, and labels
Population pyramidNumber of bins
Diverging stacked barCutpoint selection
GridplotObservations per square

Code access

For gg plot types, the Add to Plot panel includes two additional buttons:

  • Store code: Saves the ggplot2 code that generated the current plot to the code history
  • View code: Opens the stored code history window where you can review and copy ggplot2 code

This lets you reproduce the plot outside of iNZight or customise it further using R.

Interactive plots

Most gg plot types include an "Interactive Plot (via plotly)" button in the Add to Plot panel. Clicking it converts the current ggplot2 plot into an interactive plotly widget that opens in your web browser, allowing hovering, zooming, and panning.

This is not available for: pie, donut, gridplot, barcode, or ridgeline plots.

See Interactive Plots for more details.