Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4b9d8f

Browse files
committed
forgot these two files
1 parentf987693 commita4b9d8f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎content/post/2019-08-28-you-can-replicate-almost-any-plot-with-ggplot2.Rmd‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ slug: you-can-replicate-almost-any-plot-with-ggplot2
77

88
Although R is great for quickly turning data into plots, it is not widely used for making publication ready figures. But, with enough tinkering you can make almost any plot in R. For examples check out the[flowingdata blog](https://flowingdata.com/) or the[Fundamentals of Data Visualization book](https://serialmentor.com/dataviz/index.html).
99

10-
Here I show five charts from the lay press that I use as examples in my data science courses. In the past I would show the originals, but I decided to replicate them in R to make it possible to generate class notes with just R code (there was a lot of googling involved).
10+
Here I show five charts from the lay press that I use as examples in my data science courses. In the past I would show the originals, but I decided to replicate them in R to make it possible to generate class notes with just R code (there was a lot of googling involved).
1111

1212
Below I show the original figures followed by R code and the version of the plot it produces. I used the__ggplot2__ package but you can achieve similar results using other packages or even just with R-base. Any recommendations on how to improve the code or links to other good examples are welcomed. Please at to the comments or @ me on twitter:[\@rafalab](https://twitter.com/rafalab).
1313

@@ -52,7 +52,7 @@ dat %>% mutate(country = reorder(country, -count)) %>%
5252
The second example from[everytown.org](https://everytownresearch.org). Here is the original:
5353

5454

55-
![](https://rafalab.github.io/dsbook/R/img/GunTrends_murders_per_1000.png)
55+
![](https://raw.githubusercontent.com/rafalab/dsbook/master/R/img/GunTrends_murders_per_1000.png)
5656

5757
Here is the R code for my version. As in the previous example I copied the values by hand.
5858

‎content/post/2019-08-28-you-can-replicate-almost-any-plot-with-ggplot2.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h2>Example 1</h2>
4545
<divid="example-2"class="section level2">
4646
<h2>Example 2</h2>
4747
<p>The second example from<ahref="https://everytownresearch.org">everytown.org</a>. Here is the original:</p>
48-
<p><imgsrc="https://rafalab.github.io/dsbook/R/img/GunTrends_murders_per_1000.png"/></p>
48+
<p><imgsrc="https://raw.githubusercontent.com/rafalab/dsbook/master/R/img/GunTrends_murders_per_1000.png"/></p>
4949
<p>Here is the R code for my version. As in the previous example I copied the values by hand.</p>
5050
<preclass="r"><code>dat &lt;- tibble(country = toupper(c(&quot;United States&quot;, &quot;Canada&quot;, &quot;Portugal&quot;, &quot;Ireland&quot;, &quot;Italy&quot;, &quot;Belgium&quot;, &quot;Finland&quot;, &quot;France&quot;, &quot;Netherlands&quot;, &quot;Denmark&quot;, &quot;Sweden&quot;, &quot;Slovakia&quot;, &quot;Austria&quot;, &quot;New Zealand&quot;, &quot;Australia&quot;, &quot;Spain&quot;, &quot;Czech Republic&quot;, &quot;Hungry&quot;, &quot;Germany&quot;, &quot;United Kingdom&quot;, &quot;Norway&quot;, &quot;Japan&quot;, &quot;Republic of Korea&quot;)),
5151
count = c(3.61, 0.5, 0.48, 0.35, 0.35, 0.33, 0.26, 0.20, 0.20, 0.20, 0.19, 0.19, 0.18, 0.16,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp