ggplots in r

Solutions on MaxInterview for ggplots in r by the best coders in the world

showing results for - "ggplots in r"
Braeden
13 Mar 2017
1library(ggplot2)
2ggplot(diamonds)  # if only the dataset is known.
3ggplot(diamonds, aes(x=carat))  # if only X-axis is known. The Y-axis can be specified in respective geoms.
4ggplot(diamonds, aes(x=carat, y=price))  # if both X and Y axes are fixed for all layers.
5ggplot(diamonds, aes(x=carat, color=cut))  # Each category of the 'cut' variable will now have a distinct  color, once a geom is added.
similar questions
queries leading to this page
ggplots in r