Skip to content

Commit 9646eb4

Browse files
committed
prefix figure filenames so they won't collide
1 parent ef150c3 commit 9646eb4

File tree

28 files changed

+79
-72
lines changed

28 files changed

+79
-72
lines changed

_posts/2016-12-11-r-geojson-srt.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The first thing you can do is plot the data, and the `plot` command makes that e
5656
plot(data_json)
5757
{% endhighlight %}
5858

59-
![plot of chunk unnamed-chunk-4](/figures/unnamed-chunk-4-1.png)
59+
![plot of chunk unnamed-chunk-2](/figures//2016-12-11-r-geojson-srt.Rmdunnamed-chunk-2-1.png)
6060

6161
Unfortunately, this plot is not very helpful because it simply plots the points without any context. So we use the `ggmap` and `ggplot2` package to give us some context. First, we download from Google the right map.
6262

@@ -87,7 +87,7 @@ Now we can make the plot:
8787
print(mapImage + geom_point(aes(lon, lat), data = data_df))
8888
{% endhighlight %}
8989

90-
![plot of chunk unnamed-chunk-7](/figures/unnamed-chunk-7-1.png)
90+
![plot of chunk unnamed-chunk-5](/figures//2016-12-11-r-geojson-srt.Rmdunnamed-chunk-5-1.png)
9191

9292
It may be helpful to add labels based on the name of the location, given in the 'title' field:
9393

@@ -97,7 +97,7 @@ mapImage + geom_point(aes(lon, lat), data = data_df) + geom_text(aes(lon, lat,
9797
label = title, hjust = 0, vjust = 0.5), data = data_df, check_overlap = TRUE)
9898
{% endhighlight %}
9999

100-
![plot of chunk unnamed-chunk-8](/figures/unnamed-chunk-8-1.png)
100+
![plot of chunk unnamed-chunk-6](/figures//2016-12-11-r-geojson-srt.Rmdunnamed-chunk-6-1.png)
101101

102102
Here, I use `geom_text` to make the labels, and tweaked the options by hand using the help page.
103103

_posts/2016-12-16-r-geojson-gardens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ First, we plot the data as before:
5151
plot(data_park)
5252
{% endhighlight %}
5353

54-
![plot of chunk unnamed-chunk-2](/figures/unnamed-chunk-2-1.png)
54+
![plot of chunk unnamed-chunk-2](/figures//2016-12-16-r-geojson-gardens.Rmdunnamed-chunk-2-1.png)
5555

5656
While this was easy to do, it doesn't give very much context. However, it does give the boundaries of the different parks. As before, we use the `ggmap` and `ggplot2` package to give us some context. First, we download from Google the right map.
5757

@@ -80,7 +80,7 @@ print(mapImage + geom_polygon(aes(long, lat, group = group), data = data_park_df
8080
colour = "green"))
8181
{% endhighlight %}
8282

83-
![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-1.png)
83+
![plot of chunk unnamed-chunk-5](/figures//2016-12-16-r-geojson-gardens.Rmdunnamed-chunk-5-1.png)
8484

8585
Note the use of the `group=` option in the `geom_polygon` function above. This tells `geom_polygon` that there are many polygons rather than just one. Without that option, you get a big mess:
8686

@@ -89,7 +89,7 @@ Note the use of the `group=` option in the `geom_polygon` function above. This t
8989
print(mapImage + geom_polygon(aes(long, lat), data = data_park_df, colour = "green"))
9090
{% endhighlight %}
9191

92-
![plot of chunk unnamed-chunk-6](/figures/unnamed-chunk-6-1.png)
92+
![plot of chunk unnamed-chunk-6](/figures//2016-12-16-r-geojson-gardens.Rmdunnamed-chunk-6-1.png)
9393

9494
## Mashup of parking convenient to Swamp Rabbit Trail and city parks
9595

@@ -99,7 +99,7 @@ Now, say you want to combine the city parks data with the parking places conveni
9999

100100
Next, we use the layering feature of `ggplot2` to draw the map:
101101

102-
![plot of chunk unnamed-chunk-8](/figures/unnamed-chunk-8-1.png)
102+
![plot of chunk unnamed-chunk-8](/figures//2016-12-16-r-geojson-gardens.Rmdunnamed-chunk-8-1.png)
103103

104104
## Conclusions
105105

_posts/2016-12-21-r-twitter.md

Lines changed: 57 additions & 50 deletions
Large diffs are not rendered by default.

_posts/2017-01-27-tidy-text-inauguration-speeches.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ ggplot(speech_freq %>% ungroup() %>% slice(1:20), aes(reorder(word,desc(frequenc
187187
xlab("Word") + ylab("Frequency") + theme(axis.text.x = element_text(angle = 45, hjust = 1))
188188
{% endhighlight %}
189189

190-
![plot of chunk unnamed-chunk-3](/figures/unnamed-chunk-3-1.png)
190+
![plot of chunk unnamed-chunk-3](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-3-1.png)
191191

192192

193193
## What makes speeches unique
@@ -264,7 +264,7 @@ ggplot(plot_inaug %>% filter(tf_idf > 0.025), aes(word, tf_idf, fill = Speaker))
264264
coord_flip()
265265
{% endhighlight %}
266266

267-
![plot of chunk unnamed-chunk-4](/figures/unnamed-chunk-4-1.png)
267+
![plot of chunk unnamed-chunk-4](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-4-1.png)
268268

269269
Then we can do this analysis within each speech to find out what distinguishes them from other speeches. The `for` loop below can be used to print multiple pages of faceted graphs, good for when you are using RStudio or the R gui to explore.
270270

@@ -290,7 +290,7 @@ for (i in 1:floor(length(speakers_vec)/n_panel)) {
290290
}
291291
{% endhighlight %}
292292

293-
![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-1.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-2.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-3.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-4.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-5.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-6.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-7.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-8.png)![plot of chunk unnamed-chunk-5](/figures/unnamed-chunk-5-9.png)
293+
![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-1.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-2.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-3.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-4.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-5.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-6.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-7.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-8.png)![plot of chunk unnamed-chunk-5](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-5-9.png)
294294

295295
## Which speeches are most like each other?
296296

@@ -315,7 +315,7 @@ inaug_clust <- hclust(dist_matrix,method="ward.D")
315315
plot(inaug_clust)
316316
{% endhighlight %}
317317

318-
![plot of chunk unnamed-chunk-7](/figures/unnamed-chunk-7-1.png)
318+
![plot of chunk unnamed-chunk-7](/figures//2017-01-27-tidy-text-inauguration-speeches.Rmdunnamed-chunk-7-1.png)
319319

320320
It's pretty interesting that Speech 26 is unlike nearly all the others. This was William Henry Harrison discussing something about the Roman aristocracy, something other presidents have not felt the need to do very much.
321321

@@ -348,13 +348,13 @@ for (i in 1:length(inaug_km$withinss)) {
348348

349349
{% highlight text %}
350350
## [1] Cluster 1
351-
## [1] government people citizens time country nation
352-
## [7] own <NA> <NA> <NA> <NA> <NA>
351+
## [1] people government country own citizens time
352+
## [7] nation <NA> <NA> <NA> <NA> <NA>
353353
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
354354
## [19] <NA> <NA>
355355
## [1] Cluster 2
356-
## [1] government people citizens country own nation
357-
## [7] time <NA> <NA> <NA> <NA> <NA>
356+
## [1] government people citizens time country nation
357+
## [7] own <NA> <NA> <NA> <NA> <NA>
358358
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
359359
## [19] <NA> <NA>
360360
## [1] Cluster 3
@@ -368,16 +368,16 @@ for (i in 1:length(inaug_km$withinss)) {
368368
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
369369
## [19] <NA> <NA>
370370
## [1] Cluster 5
371-
## [1] people government country own citizens time
372-
## [7] nation <NA> <NA> <NA> <NA> <NA>
371+
## [1] government people citizens country own nation
372+
## [7] time <NA> <NA> <NA> <NA> <NA>
373373
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
374374
## [19] <NA> <NA>
375375
## [1] "Cluster Membership"
376376
##
377377
## 1 2 3 4 5
378-
## 12 3 19 16 8
378+
## 8 12 19 16 3
379379
## [1] "Within cluster sum of squares by cluster"
380-
## [1] 954.5833 797.3333 1147.1579 733.8125 760.3750
380+
## [1] 760.3750 954.5833 1147.1579 733.8125 797.3333
381381
{% endhighlight %}
382382

383383
Membership of speeches in clusters is here:
@@ -391,9 +391,9 @@ inaug_km$cluster
391391

392392
{% highlight text %}
393393
## 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
394-
## 4 4 5 4 4 4 4 1 1 1 4 1 5 2 2 4 3 1 5 4 4 4 1 5 1
394+
## 4 4 1 4 4 4 4 2 2 2 4 2 1 5 5 4 3 2 1 4 4 4 2 1 2
395395
## 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
396-
## 5 5 5 1 4 1 4 3 3 5 2 3 1 3 4 3 3 3 4 3 3 3 3 1 1
396+
## 1 1 1 2 4 2 4 3 3 1 5 3 2 3 4 3 3 3 4 3 3 3 3 2 2
397397
## 63 64 65 66 67 68 69 70
398398
## 3 3 3 4 3 3 3 3
399399
{% endhighlight %}
Loading
Loading
Loading
Loading
Loading
Loading
Loading

rmd2md.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ rmd2md <- function( path_site = getwd(),
6767
# https://groups.google.com/forum/#!topic/knitr/18aXpOmsumQ
6868

6969
opts_knit$set(base.url = "/")
70-
opts_chunk$set(fig.path = url_images)
70+
opts_chunk$set(fig.path = paste(url_images,f,sep="/"))
7171

7272
#andy I could try to make figures bigger
7373
#but that might make not work so well on mobile

0 commit comments

Comments
 (0)