You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/ggplot2/2017-04-21-geom_quantile.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ output:
17
17
18
18
19
19
20
-
### New to Plotly??!!?
20
+
### New to Plotly?
21
21
22
22
Plotly's R library is free and open source!<br>
23
23
[Get started](https://plot.ly/r/getting-started/) by downloading the client and [reading the primer](https://plot.ly/r/getting-started/).<br>
24
24
You can set up Plotly to work in [online](https://plot.ly/r/getting-started/#hosting-graphs-in-your-online-plotly-account) or [offline](https://plot.ly/r/offline/) mode.<br>
25
25
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/r_cheat_sheet.pdf) (new!) to help you get started!
26
-
2017-04-21-geom_quantile.Rmd
26
+
27
27
### Version Check
28
28
29
29
Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
p <- ggplot(english_french, aes(x=engperc,y=frenperc)) +
49
49
geom_bin2d() +
50
-
labs(title = "Distribution of Canadian towns by English and French fluency",
50
+
labs(title = "Distribution of Canadian areas by English and French fluency",
51
51
x = "% fluent in English",
52
52
y = "% fluent in French",
53
53
fill = "# of census \nsubdivisions")
@@ -65,7 +65,7 @@ chart_link
65
65
66
66
### Customized Colours
67
67
The automatic colour scheme is unintuitive: lighter colours denote larger numbers than darker colours.
68
-
We should change that, and while we're at it, make the colour scale logarithmic.
68
+
We should change that by setting our own colour scale. We should also move to a logarithmic scale, since as it is, the very large value in the bottom right overshadows all other values.
69
69
70
70
```{r, results='hide'}
71
71
library(plotly)
@@ -81,7 +81,7 @@ ggplotly(p)
81
81
82
82
# Create a shareable link to your chart
83
83
# Set up API credentials: https://plot.ly/r/getting-started
labs(title = "Distribution of the Canadian population by English and French fluency",
103
102
x = "% fluent in English",
@@ -117,7 +116,7 @@ chart_link
117
116
```
118
117
119
118
### With Facets
120
-
We can facet the graphic with the "region" column. We can also use a little trick to add an "All" subset containing all the data.
119
+
We can facet the graphic with the "region" column, and set "bins" to 20, so that the graph is 20 x 20 sides. We can also use a little trick to add an "All" subset containing all the data.
121
120
122
121
```{r, results='hide'}
123
122
library(plotly)
@@ -130,7 +129,7 @@ p <- ggplot(english_french, aes(x=engperc,y=frenperc, weight=total)) +
130
129
labs(title = "Distribution of Canadian towns by English and French fluency",
131
130
x = "% fluent in English",
132
131
y = "% fluent in French",
133
-
fill = "# of census \nsubdivisions")
132
+
fill = "# of people")
134
133
ggplotly(p)
135
134
136
135
@@ -158,7 +157,7 @@ p <- ggplot(english_french, aes(x=engperc,y=frenperc, weight=total)) +
158
157
labs(title = "Distribution of Canadian towns by English and French fluency",
labs(title="Distribution of Canadian towns by English and French fluency",
52
+
labs(title="Distribution of Canadian areas by English and French fluency",
53
53
x="% fluent in English",
54
54
y="% fluent in French",
55
55
fill="# of census \nsubdivisions")
@@ -65,7 +65,7 @@ chart_link
65
65
66
66
### Customized Colours
67
67
The automatic colour scheme is unintuitive: lighter colours denote larger numbers than darker colours.
68
-
We should change that, and while we're at it, make the colour scale logarithmic.
68
+
We should change that by setting our own colour scale. We should also move to a logarithmic scale, since as it is, the very large value in the bottom right overshadows all other values.
69
69
70
70
71
71
```r
@@ -82,11 +82,11 @@ ggplotly(p)
82
82
83
83
# Create a shareable link to your chart
84
84
# Set up API credentials: https://plot.ly/r/getting-started
In the previous graphs, each observation represented a single census subdivision - this counted small towns of 500 people equally with cities like Montreal and Toronto. We can weight the data by the "total" column (i.e. total population) to make this a graph of population.
We can facet the graphic with the "region" column. We can also use a little trick to add an "All" subset containing all the data.
117
+
We can facet the graphic with the "region" column, and set "bins" to 20, so that the graph is 20 x 20 sides. We can also use a little trick to add an "All" subset containing all the data.
119
118
120
119
121
120
```r
@@ -129,7 +128,7 @@ p <- ggplot(english_french, aes(x=engperc,y=frenperc, weight=total)) +
129
128
labs(title="Distribution of Canadian towns by English and French fluency",
130
129
x="% fluent in English",
131
130
y="% fluent in French",
132
-
fill="# of census \nsubdivisions")
131
+
fill="# of people")
133
132
ggplotly(p)
134
133
135
134
@@ -156,7 +155,7 @@ p <- ggplot(english_french, aes(x=engperc,y=frenperc, weight=total)) +
156
155
labs(title="Distribution of Canadian towns by English and French fluency",
0 commit comments