|
1 | 1 |
|
2 | 2 | <!-- README.md is generated from README.Rmd. Please edit that file -->
|
3 | 3 |
|
4 |
| -# ggplot2 <a href="https://ggplot2.tidyverse.org"><img src="man/figures/logo.png" align="right" height="138" alt="ggplot2 website" /></a> |
5 |
| - |
6 |
| -<!-- badges: start --> |
7 |
| - |
8 |
| -[](https://github.com/tidyverse/ggplot2/actions/workflows/R-CMD-check.yaml) |
9 |
| -[](https://cran.r-project.org/package=ggplot2) |
10 |
| -[](https://app.codecov.io/gh/tidyverse/ggplot2) |
12 |
| -<!-- badges: end --> |
13 |
| - |
14 |
| -## Overview |
15 |
| - |
16 |
| -ggplot2 is a system for declaratively creating graphics, based on [The |
17 |
| -Grammar of |
18 |
| -Graphics](https://www.amazon.com/Grammar-Graphics-Statistics-Computing/dp/0387245448/ref=as_li_ss_tl). |
19 |
| -You provide the data, tell ggplot2 how to map variables to aesthetics, |
20 |
| -what graphical primitives to use, and it takes care of the details. |
21 |
| - |
22 |
| -## Installation |
23 |
| - |
24 |
| -``` r |
25 |
| -# The easiest way to get ggplot2 is to install the whole tidyverse: |
26 |
| -install.packages("tidyverse") |
27 |
| - |
28 |
| -# Alternatively, install just ggplot2: |
29 |
| -install.packages("ggplot2") |
30 |
| - |
31 |
| -# Or the development version from GitHub: |
32 |
| -# install.packages("pak") |
33 |
| -pak::pak("tidyverse/ggplot2") |
34 |
| -``` |
35 |
| - |
36 |
| -## Cheatsheet |
37 |
| - |
38 |
| -<a href="https://github.com/rstudio/cheatsheets/blob/master/data-visualization.pdf"><img src="https://raw.githubusercontent.com/rstudio/cheatsheets/master/pngs/thumbnails/data-visualization-cheatsheet-thumbs.png" width="630" height="252" alt="ggplot2 cheatsheet" /></a> |
39 |
| - |
40 |
| -## Usage |
41 |
| - |
42 |
| -It’s hard to succinctly describe how ggplot2 works because it embodies a |
43 |
| -deep philosophy of visualisation. However, in most cases you start with |
44 |
| -`ggplot()`, supply a dataset and aesthetic mapping (with `aes()`). You |
45 |
| -then add on layers (like `geom_point()` or `geom_histogram()`), scales |
46 |
| -(like `scale_colour_brewer()`), faceting specifications (like |
47 |
| -`facet_wrap()`) and coordinate systems (like `coord_flip()`). |
48 |
| - |
49 |
| -``` r |
50 |
| -library(ggplot2) |
51 |
| - |
52 |
| -ggplot(mpg, aes(displ, hwy, colour = class)) + |
53 |
| - geom_point() |
54 |
| -``` |
55 |
| - |
56 |
| -<img src="man/figures/README-example-1.png" alt="Scatterplot of engine displacement versus highway miles per gallon, for 234 cars coloured by 7 'types' of car. The displacement and miles per gallon are inversely correlated." /> |
57 |
| - |
58 |
| -## Lifecycle |
59 |
| - |
60 |
| -[](https://lifecycle.r-lib.org/articles/stages.html) |
61 |
| - |
62 |
| -ggplot2 is now over 10 years old and is used by hundreds of thousands of |
63 |
| -people to make millions of plots. That means, by-and-large, ggplot2 |
64 |
| -itself changes relatively little. When we do make changes, they will be |
65 |
| -generally to add new functions or arguments rather than changing the |
66 |
| -behaviour of existing functions, and if we do make changes to existing |
67 |
| -behaviour we will do them for compelling reasons. |
68 |
| - |
69 |
| -If you are looking for innovation, look to ggplot2’s rich ecosystem of |
70 |
| -extensions. See a community maintained list at |
71 |
| -<https://exts.ggplot2.tidyverse.org/gallery/>. |
72 |
| - |
73 |
| -## Learning ggplot2 |
74 |
| - |
75 |
| -If you are new to ggplot2 you are better off starting with a systematic |
76 |
| -introduction, rather than trying to learn from reading individual |
77 |
| -documentation pages. Currently, there are several good places to start: |
78 |
| - |
79 |
| -1. The [Data Visualization](https://r4ds.hadley.nz/data-visualize) and |
80 |
| - [Communication](https://r4ds.hadley.nz/communication) chapters in [R |
81 |
| - for Data Science](https://r4ds.hadley.nz). R for Data Science is |
82 |
| - designed to give you a comprehensive introduction to the |
83 |
| - [tidyverse](https://www.tidyverse.org), and these two chapters will |
84 |
| - get you up to speed with the essentials of ggplot2 as quickly as |
85 |
| - possible. |
86 |
| - |
87 |
| -2. If you’d like to take an online course, try [Data Visualization in R |
88 |
| - With |
89 |
| - ggplot2](https://learning.oreilly.com/videos/data-visualization-in/9781491963661/) |
90 |
| - by Kara Woo. |
91 |
| - |
92 |
| -3. If you’d like to follow a webinar, try [Plotting Anything with |
93 |
| - ggplot2](https://youtu.be/h29g21z0a68) by Thomas Lin Pedersen. |
94 |
| - |
95 |
| -4. If you want to dive into making common graphics as quickly as |
96 |
| - possible, I recommend [The R Graphics |
97 |
| - Cookbook](https://r-graphics.org) by Winston Chang. It provides a |
98 |
| - set of recipes to solve common graphics problems. |
99 |
| - |
100 |
| -5. If you’ve mastered the basics and want to learn more, read [ggplot2: |
101 |
| - Elegant Graphics for Data Analysis](https://ggplot2-book.org). It |
102 |
| - describes the theoretical underpinnings of ggplot2 and shows you how |
103 |
| - all the pieces fit together. This book helps you understand the |
104 |
| - theory that underpins ggplot2, and will help you create new types of |
105 |
| - graphics specifically tailored to your needs. |
106 |
| - |
107 |
| -6. For articles about announcements and deep-dives you can visit the |
108 |
| - [tidyverse blog](https://www.tidyverse.org/tags/ggplot2/). |
109 |
| - |
110 |
| -## Getting help |
111 |
| - |
112 |
| -There are two main places to get help with ggplot2: |
113 |
| - |
114 |
| -1. The [RStudio community](https://forum.posit.co/) is a friendly place |
115 |
| - to ask any questions about ggplot2. |
116 |
| - |
117 |
| -2. [Stack |
118 |
| - Overflow](https://stackoverflow.com/questions/tagged/ggplot2?sort=frequent&pageSize=50) |
119 |
| - is a great source of answers to common ggplot2 questions. It is also |
120 |
| - a great place to get help, once you have created a reproducible |
121 |
| - example that illustrates your problem. |
| 4 | +# TDs dataviz ENSAI |
0 commit comments