Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed links in tutorial files #258

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions character-interaction-analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ <h1>Creating the Basic Chord Diagram</h1>
<span id="cb2-32"><a href="#cb2-32" tabindex="-1"></a><span class="fu">invisible</span>(<span class="fu">dev.off</span>())</span>
<span id="cb2-33"><a href="#cb2-33" tabindex="-1"></a></span>
<span id="cb2-34"><a href="#cb2-34" tabindex="-1"></a><span class="co"># Display the saved plot in R Markdown</span></span>
<span id="cb2-35"><a href="#cb2-35" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="fu">here</span>(base_path,<span class="st">&quot;17-network-the-office-mentions.png&quot;</span>))</span></code></pre></div>
<p><img src="faceted-chord-diagram/17-network-the-office-mentions.png" width="100%" style="display: block; margin: auto;" /></p>
<span id="cb2-35"><a href="#cb2-35" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="st">&quot;https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions.png?raw=true&quot;</span>)</span></code></pre></div>
<p><img src="https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions.png?raw=true" width="100%" style="display: block; margin: auto;" /></p>
</div>
<div id="creating-individual-character-focused-diagrams"
class="section level1">
Expand Down Expand Up @@ -358,8 +358,8 @@ <h1>Creating Individual Character-Focused Diagrams</h1>
<span id="cb3-46"><a href="#cb3-46" tabindex="-1"></a><span class="fu">invisible</span>(<span class="fu">dev.off</span>())</span>
<span id="cb3-47"><a href="#cb3-47" tabindex="-1"></a></span>
<span id="cb3-48"><a href="#cb3-48" tabindex="-1"></a><span class="co"># Display the saved plot in R Markdown</span></span>
<span id="cb3-49"><a href="#cb3-49" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="fu">here</span>(base_path,<span class="st">&quot;17-network-the-office-mentions-facets.png&quot;</span>))</span></code></pre></div>
<p><img src="faceted-chord-diagram/17-network-the-office-mentions-facets.png" width="100%" style="display: block; margin: auto;" /></p>
<span id="cb3-49"><a href="#cb3-49" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="st">&quot;https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions-facets.png?raw=true&quot;</span>)</span></code></pre></div>
<p><img src="https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions-facets.png?raw=true" width="100%" style="display: block; margin: auto;" /></p>
</div>
<div id="adding-title-and-annotations-to-the-final-visualization"
class="section level1">
Expand Down Expand Up @@ -407,8 +407,8 @@ <h1>Adding Title and Annotations to the Final Visualization</h1>
<span id="cb4-34"><a href="#cb4-34" tabindex="-1"></a> <span class="fu">image_write</span>(<span class="fu">here</span>(base_path, <span class="st">&quot;17-network-who-speaks-office.png&quot;</span>))</span>
<span id="cb4-35"><a href="#cb4-35" tabindex="-1"></a></span>
<span id="cb4-36"><a href="#cb4-36" tabindex="-1"></a><span class="co"># Display the final image in R Markdown</span></span>
<span id="cb4-37"><a href="#cb4-37" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="fu">here</span>(base_path,<span class="st">&quot;17-network-who-speaks-office.png&quot;</span>))</span></code></pre></div>
<p><img src="faceted-chord-diagram/17-network-who-speaks-office.png" width="100%" style="display: block; margin: auto;" /></p>
<span id="cb4-37"><a href="#cb4-37" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="st">&quot;https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-who-speaks-office.png?raw=true&quot;</span>)</span></code></pre></div>
<p><img src="https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-who-speaks-office.png?raw=true" width="100%" style="display: block; margin: auto;" /></p>
</div>
</div>
<!-- ============================ RELATED SECTION ============================ -->
Expand Down
6 changes: 3 additions & 3 deletions character-interaction-analysis.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ title(
invisible(dev.off())

# Display the saved plot in R Markdown
knitr::include_graphics(here(base_path,"17-network-the-office-mentions.png"))
knitr::include_graphics("https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions.png?raw=true")
```

# Creating Individual Character-Focused Diagrams
Expand Down Expand Up @@ -188,7 +188,7 @@ for (i in 1:9) {
invisible(dev.off())

# Display the saved plot in R Markdown
knitr::include_graphics(here(base_path,"17-network-the-office-mentions-facets.png"))
knitr::include_graphics("https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-the-office-mentions-facets.png?raw=true")
```

# Adding Title and Annotations to the Final Visualization
Expand Down Expand Up @@ -232,7 +232,7 @@ img_chart %>%
image_write(here(base_path, "17-network-who-speaks-office.png"))

# Display the final image in R Markdown
knitr::include_graphics(here(base_path,"17-network-who-speaks-office.png"))
knitr::include_graphics("https://github.com/holtzy/R-graph-gallery/blob/master/character-interaction-analysis/17-network-who-speaks-office.png?raw=true")
```


Expand Down
16 changes: 8 additions & 8 deletions vaccination-heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ <h1>Read and prepare the data</h1>
reverse alphabetical order</strong> - this ordering will determine how
states are displayed from top to bottom in our final heatmap.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># Read the data </span></span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a>measles <span class="ot">=</span> readr<span class="sc">::</span><span class="fu">read_csv</span>(<span class="st">&quot;measles_data_1928-2011.csv&quot;</span>)</span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a>measles <span class="ot">=</span> readr<span class="sc">::</span><span class="fu">read_csv</span>(<span class="st">&quot;https://raw.githubusercontent.com/holtzy/R-graph-gallery/refs/heads/master/measles_data_1928-2011.csv&quot;</span>)</span>
<span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co"># Show the first few rows of the data</span></span>
<span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a><span class="fu">print</span>(<span class="fu">head</span>(measles))</span></code></pre></div>
Expand All @@ -241,14 +241,14 @@ <h1>Create color palette</h1>
<hr />
<p>This code creates a <strong>custom color gradient</strong> for the
heatmap that will represent different levels of measles cases. It
combines two color palettes: a spectrum from white through blue, green,
yellow, and orange (for lower case counts up to 500), followed by an
orange-to-red gradient (for higher case counts from 500-4000). The
<code>colorRampPalette()</code> function smoothly interpolates between
these colors to create 100 total color steps.</p>
combines two color palettes: a spectrum from light blue through deeper
blues, green, and yellows/oranges for lower case counts up to 500,
followed by an orange-to-red gradient for higher case counts from
500-4000. The <code>colorRampPalette()</code> function smoothly
interpolates between these colors to create 100 total color steps.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>cols <span class="ot">&lt;-</span> <span class="fu">c</span>(</span>
<span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a> <span class="fu">colorRampPalette</span>(<span class="fu">c</span>(<span class="st">&quot;white&quot;</span>, <span class="st">&quot;blue&quot;</span>, <span class="st">&quot;green&quot;</span>, <span class="st">&quot;yellow&quot;</span>, <span class="st">&quot;orange&quot;</span>))(<span class="dv">20</span>), <span class="co"># Full spectrum until 500</span></span>
<span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a> <span class="fu">colorRampPalette</span>(<span class="fu">c</span>(<span class="st">&quot;orange&quot;</span>, <span class="st">&quot;red&quot;</span>))(<span class="dv">80</span>) <span class="co"># Orange to red gradient for 500-4000</span></span>
<span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a> <span class="fu">colorRampPalette</span>(<span class="fu">c</span>(<span class="st">&quot;#e7f0fa&quot;</span>, <span class="st">&quot;#c9e2f6&quot;</span>, <span class="st">&quot;#95cbee&quot;</span>, <span class="st">&quot;#0099dc&quot;</span>, <span class="st">&quot;#4ab04a&quot;</span>, <span class="st">&quot;#ffd73e&quot;</span>, <span class="st">&quot;#eec73a&quot;</span>, <span class="st">&quot;#e29421&quot;</span>))(<span class="dv">20</span>),</span>
<span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a> <span class="fu">colorRampPalette</span>(<span class="fu">c</span>(<span class="st">&quot;#e29421&quot;</span>, <span class="st">&quot;#f05336&quot;</span>, <span class="st">&quot;#ce472e&quot;</span>))(<span class="dv">80</span>)</span>
<span id="cb5-4"><a href="#cb5-4" tabindex="-1"></a>)</span></code></pre></div>
</div>
<div id="create-advanced-temporal-heatmap" class="section level1">
Expand Down
8 changes: 4 additions & 4 deletions vaccination-heatmap.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This code reads a CSV file containing measles cases per million inhabitants per

```{r}
# Read the data
measles = readr::read_csv("measles_data_1928-2011.csv")
measles = readr::read_csv("https://raw.githubusercontent.com/holtzy/R-graph-gallery/refs/heads/master/measles_data_1928-2011.csv")

# Show the first few rows of the data
print(head(measles))
Expand All @@ -66,12 +66,12 @@ mdf <- measles %>%
# Create color palette
***

This code creates a **custom color gradient** for the heatmap that will represent different levels of measles cases. It combines two color palettes: a spectrum from white through blue, green, yellow, and orange (for lower case counts up to 500), followed by an orange-to-red gradient (for higher case counts from 500-4000). The `colorRampPalette()` function smoothly interpolates between these colors to create 100 total color steps.
This code creates a **custom color gradient** for the heatmap that will represent different levels of measles cases. It combines two color palettes: a spectrum from light blue through deeper blues, green, and yellows/oranges for lower case counts up to 500, followed by an orange-to-red gradient for higher case counts from 500-4000. The `colorRampPalette()` function smoothly interpolates between these colors to create 100 total color steps.

```{r}
cols <- c(
colorRampPalette(c("white", "blue", "green", "yellow", "orange"))(20), # Full spectrum until 500
colorRampPalette(c("orange", "red"))(80) # Orange to red gradient for 500-4000
colorRampPalette(c("#e7f0fa", "#c9e2f6", "#95cbee", "#0099dc", "#4ab04a", "#ffd73e", "#eec73a", "#e29421"))(20),
colorRampPalette(c("#e29421", "#f05336", "#ce472e"))(80)
)
```

Expand Down
6 changes: 3 additions & 3 deletions web-sankey-refugees.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ <h2>Visualization Layers</h2>
<span id="cb7-37"><a href="#cb7-37" tabindex="-1"></a> <span class="at">plot.caption =</span> <span class="fu">element_text</span>(<span class="at">margin =</span> <span class="fu">margin</span>(<span class="dv">20</span>, <span class="dv">0</span>, <span class="dv">0</span>, <span class="dv">0</span>))</span>
<span id="cb7-38"><a href="#cb7-38" tabindex="-1"></a> )</span>
<span id="cb7-39"><a href="#cb7-39" tabindex="-1"></a></span>
<span id="cb7-40"><a href="#cb7-40" tabindex="-1"></a><span class="fu">ggsave</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">&quot;refugee_flows.png&quot;</span>), p, <span class="at">width =</span> <span class="dv">12</span>, <span class="at">height =</span> <span class="dv">8</span>, <span class="at">dpi =</span> <span class="dv">320</span>, <span class="at">bg =</span> <span class="st">&quot;#FFFFFE&quot;</span>)</span>
<span id="cb7-40"><a href="#cb7-40" tabindex="-1"></a><span class="co">#ggsave(here::here(&quot;web-sankey-refugees&quot;,&quot;refugee_flows_viz.png&quot;), p, width = 12, height = 8, dpi = 320, bg = &quot;#FFFFFE&quot;, create.dir = TRUE)</span></span>
<span id="cb7-41"><a href="#cb7-41" tabindex="-1"></a></span>
<span id="cb7-42"><a href="#cb7-42" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(here<span class="sc">::</span><span class="fu">here</span>(<span class="st">&quot;refugee_flows.png&quot;</span>))</span></code></pre></div>
<p><img src="refugee_flows.png" width="100%" style="display: block; margin: auto;" /></p>
<span id="cb7-42"><a href="#cb7-42" tabindex="-1"></a>knitr<span class="sc">::</span><span class="fu">include_graphics</span>(<span class="st">&quot;https://raw.githubusercontent.com/holtzy/R-graph-gallery/master/web-sankey-refugees/refugee_flows_viz.png&quot;</span>)</span></code></pre></div>
<p><img src="https://raw.githubusercontent.com/holtzy/R-graph-gallery/master/web-sankey-refugees/refugee_flows_viz.png" width="100%" style="display: block; margin: auto;" /></p>
</div>
</div>
<div id="going-further" class="section level1">
Expand Down
5 changes: 3 additions & 2 deletions web-sankey-refugees.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,10 @@ p <- ref_eu_year %>%
plot.caption = element_text(margin = margin(20, 0, 0, 0))
)

ggsave(here::here("refugee_flows.png"), p, width = 12, height = 8, dpi = 320, bg = "#FFFFFE")
#ggsave(here::here("web-sankey-refugees","refugee_flows_viz.png"), p, width = 12, height = 8, dpi = 320, bg = "#FFFFFE", create.dir = TRUE)

knitr::include_graphics("https://raw.githubusercontent.com/holtzy/R-graph-gallery/master/web-sankey-refugees/refugee_flows_viz.png")

knitr::include_graphics(here::here("refugee_flows.png"))
```

# Going further
Expand Down