Skip to content

Instantly share code, notes, and snippets.

@lx-88
Created September 8, 2015 05:50
Show Gist options
  • Save lx-88/b973f9551aa5d3167c7e to your computer and use it in GitHub Desktop.
Save lx-88/b973f9551aa5d3167c7e to your computer and use it in GitHub Desktop.
Include a superscript in a ggplot2 axis label. Useful for a unit...
# use expression
# within expression, ~ represents a space
chanDensity_plot <- ggplot(data=chan_density_df, aes(x=site, y=density)) +
geom_bar(stat='identity') +
labs(x="Site", y=expression(Channel~Density~(km/km^2)), title='LIDAR-derived channel density')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment