ggplot | R Documentation |
If you declare a dataset and an aesthetic mapping inside the ggplot()
call,
each layer will inherit that information by default.
ggplot(data, aes(x, y, ...))
data |
A tibble. |
x |
Specify which variable should be drawn on the x-axis. |
y |
Specify which variable should be drawn on the y-axis. |
... |
Any other aeshetic mappings (color, fill, etc). |
library(tidyverse) library(gapminder) # Draw a scatterplot: ggplot(gapminder, aes(x = gdpPercap, y = lifeExp)) + geom_point() # Draw a histogram: ggplot(gapminder, aes(x = lifeExp)) + geom_histogram()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.