Skip to content

Commit 088fa70

Browse files
committed
Add sample plot to readme
1 parent 9d1961d commit 088fa70

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

README-example-1.png

43.3 KB
Loading

README.Rmd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ install.packages("ggplot2")
3636
devtools::install_github("tidyverse/ggplot2")
3737
```
3838

39+
## Usage
40+
41+
It's hard to succintly describe how ggplot2 works because it embodies a deep philosophy of visualisation. However, in most cases you start with `ggplot()`, supply a dataset and aesthetic mapping (with `aes()`). You then add on layers (like `geom_point()` or `geom_histogram()`), scales (like `scale_colour_brewer()`), faceting specifications (like `facet_wrap()`) and coordinate systems (like `coord_flip()`).
42+
43+
```{r example}
44+
library(ggplot2)
45+
46+
ggplot(mpg, aes(displ, hwy, colour = class)) +
47+
geom_point()
48+
```
49+
3950
## Learning ggplot2
4051

41-
ggplot2 is a comprehensive system for generating visualisations, so if you are new to ggplot2 you are better off starting with a systematic introduction, rather than trying to learn from reading individual documentation pages. Currently, there are three good places to start:
52+
If you are new to ggplot2 you are better off starting with a systematic introduction, rather than trying to learn from reading individual documentation pages. Currently, there are three good places to start:
4253

4354
1. The [data visualisation][r4ds-vis] and
4455
[graphics forcommunication][r4ds-comm] chapters in

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,24 @@ install.packages("ggplot2")
2525
devtools::install_github("tidyverse/ggplot2")
2626
```
2727

28+
Usage
29+
-----
30+
31+
It's hard to succintly describe how ggplot2 works because it embodies a deep philosophy of visualisation. However, in most cases you start with `ggplot()`, supply a dataset and aesthetic mapping (with `aes()`). You then add on layers (like `geom_point()` or `geom_histogram()`), scales (like `scale_colour_brewer()`), faceting specifications (like `facet_wrap()`) and coordinate systems (like `coord_flip()`).
32+
33+
``` r
34+
library(ggplot2)
35+
36+
ggplot(mpg, aes(displ, hwy, colour = class)) +
37+
geom_point()
38+
```
39+
40+
![](README-example-1.png)
41+
2842
Learning ggplot2
2943
----------------
3044

31-
ggplot2 is a comprehensive system for generating visualisations, so if you are new to ggplot2 you are better off starting with a systematic introduction, rather than trying to learn from reading individual documentation pages. Currently, there are three good places to start:
45+
If you are new to ggplot2 you are better off starting with a systematic introduction, rather than trying to learn from reading individual documentation pages. Currently, there are three good places to start:
3246

3347
1. The [data visualisation](http://r4ds.had.co.nz/data-visualisation.html) and [graphics forcommunication](http://r4ds.had.co.nz/graphics-for-communication.html) chapters in [R for data science](http://r4ds.had.co.nz). R for data science is designed to give you a comprehensive introduction to the [tidyverse](http://tidyverse.org), and these two chapters will you get up to speed with the essentials of ggplot2 as quickly as possible.
3448

0 commit comments

Comments
 (0)