-
Notifications
You must be signed in to change notification settings - Fork 85
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
Project - Jorge Ramos #81
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for mucss-dataviz ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Some comments below.
toc: true | ||
--- | ||
|
||
First I load the libraries that I will need to make the plot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please divide your post in sections (e.g. ## Introduction
) and subsections e.g. ### Some subsection
) for readability. See other posts in the gallery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And first of all, please show the graph you selected and talk a little bit about it. See other published projects for reference.
library(showtext) | ||
library(extrafont) | ||
library(png) | ||
library(devtools) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is devtools really needed? In general, keep the number of libraries to a minimum. Just those strictly used by you directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you only need to load the libraries once. Please remove repeated calls below.
library(flagon) | ||
``` | ||
|
||
Now, I can start with the data i need to make the graph. In the original plot from El Orden Mundial there is one papers where they extract the information. These are: UNODC (2018): World Drug Report 2018: opioid crisis, prescription drug abuse expands; cocaine and opium hit record highs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the text for typos, please (e.g. "i need"). RStudio has autocorrect tools. ;-)
#Install the package: | ||
library(devtools) | ||
install_local("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/flagon-master") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. No, it's better to avoid this. Just mention that the flagon package is avaiable only on GitHub and link the project in the text.
Australia <- readPNG(flagon::flags("au")) | ||
Albania <- readPNG(flagon::flags("al")) | ||
Estados_Unidos <- readPNG(flagon::flags("us")) | ||
Escocia <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/flagon-master/inst/png/sct.png") | ||
Inglaterra <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/Images/England and Wales.png") | ||
España <- readPNG(flagon::flags("es")) | ||
Paises_Bajos <- readPNG(flagon::flags("nl")) | ||
Irlanda_norte <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/Images/Northern Ireland.png") | ||
Uruguay <- readPNG(flagon::flags("uy")) | ||
Argentina <- readPNG(flagon::flags("ar")) | ||
Irlanda <- readPNG(flagon::flags("ie")) | ||
Canada <- readPNG(flagon::flags("ca")) | ||
Polonia <- readPNG(flagon::flags("pl")) | ||
Chile <- readPNG(flagon::flags("cl")) | ||
CostaRica <- readPNG(flagon::flags("cr")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need 3 special flags not included in flagon, right? Then remove the rest of them from the "Flags" directory. And those 3 should be just
Inglaterra <- readPNG("Flags/blablabla.png")
etc.
logo1 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/eom.png") | ||
logo2 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/cuch.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include these images (in general, any external files) in the PR close to this Rmd, then call them just by their name, without any path (note that these paths are in YOUR computer).
|
||
The next step is to introduce the logos. These original figures were difficult to find, so I decided to made a screenshot of the original plot and introduce the pictures with patchwork package. | ||
|
||
```{r, fig.width= 8.5, fig.height= 6} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk produces the final replication, right? Then please include preview = TRUE
as a chunk option in order to show this in the project list.
logo3 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/tur.png") | ||
logo3_grob <- rasterGrob(logo3, interpolate = TRUE) | ||
logo4 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/tur1.png") | ||
logo4_grob <- rasterGrob(logo4, interpolate = TRUE) | ||
logo5 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/ray.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before.
Buenas noches Iñaki,
estaba revisando las cosas que tengo que mejorar pero no acabo de entender
la parte de las imágenes. You only need 3 special flags not included in
flagon, right? Then remove the rest of them from the "Flags" directory. And
those 3 should be just
Inglaterra <- readPNG("Flags/blablabla.png")
o esto Please include these images (in general, any external files) in the
PR close to this Rmd, then call them just by their name, without any path
(note that these paths are in YOUR computer).
¿Tendría que ponerlos en la carpeta del proyecto, cambiar el código y luego
hacer el commit?
Muchas gracias de antemano.
El jue, 9 ene 2025 a las 20:04, Iñaki Ucar ***@***.***>)
escribió:
… ***@***.**** requested changes on this pull request.
Great work! Some comments below.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> @@ -0,0 +1,997 @@
+---
+title: "Cocaine consumption"
+description: |
+ This project aims to provide insights into the principal consumers of cocaine through a bar plot. I chose this topic because I find it interesting and relevant, especially in relation to the global issues surrounding drug trafficking.
+ The bar plot serves as an effective tool to visually compare the data, making complex information more accessible and understandable. I was particularly inspired by the work of El Orden Mundial, which I consider they do a great job of visualizing data.
+categories: "2024"
+author: Jorge Ramos
+date: "`r Sys.Date()`"
+output:
+ distill::distill_article:
+ self_contained: false
+ toc: true
+---
+
+First I load the libraries that I will need to make the plot:
Please divide your post in sections (e.g. ## Introduction) and
subsections e.g. ### Some subsection) for readability. See other posts in
the gallery.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +library(ggplot2)
+library(sf)
+library(ggspatial)
+library(rnaturalearth)
+library(rnaturalearthdata)
+library(tibble)
+library(ggimage)
+library(tibble)
+library(grid)
+library(png)
+library(ggtext)
+library(tidyverse)
+library(showtext)
+library(extrafont)
+library(png)
+library(devtools)
Is devtools really needed? In general, keep the number of libraries to a
minimum. Just those strictly used by you directly.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +library(rnaturalearthdata)
+library(tibble)
+library(ggimage)
+library(tibble)
+library(grid)
+library(png)
+library(ggtext)
+library(tidyverse)
+library(showtext)
+library(extrafont)
+library(png)
+library(devtools)
+library(flagon)
+```
+
+Now, I can start with the data i need to make the graph. In the original plot from El Orden Mundial there is one papers where they extract the information. These are: UNODC (2018): World Drug Report 2018: opioid crisis, prescription drug abuse expands; cocaine and opium hit record highs.
Check the text for typos, please (e.g. "i need"). RStudio has autocorrect
tools. ;-)
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +#Install the package:
+library(devtools)
+install_local("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/flagon-master")
Ah, I see. No, it's better to avoid this. Just mention that the flagon
package is avaiable only on GitHub and link the project in the text.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +Australia <- readPNG(flagon::flags("au"))
+Albania <- readPNG(flagon::flags("al"))
+Estados_Unidos <- readPNG(flagon::flags("us"))
+Escocia <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/flagon-master/inst/png/sct.png")
+Inglaterra <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/Images/England and Wales.png")
+España <- readPNG(flagon::flags("es"))
+Paises_Bajos <- readPNG(flagon::flags("nl"))
+Irlanda_norte <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/Images/Northern Ireland.png")
+Uruguay <- readPNG(flagon::flags("uy"))
+Argentina <- readPNG(flagon::flags("ar"))
+Irlanda <- readPNG(flagon::flags("ie"))
+Canada <- readPNG(flagon::flags("ca"))
+Polonia <- readPNG(flagon::flags("pl"))
+Chile <- readPNG(flagon::flags("cl"))
+CostaRica <- readPNG(flagon::flags("cr"))
You only need 3 special flags not included in flagon, right? Then remove
the rest of them from the "Flags" directory. And those 3 should be just
Inglaterra <- readPNG("Flags/blablabla.png")
etc.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +logo1 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/eom.png")
+logo2 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/cuch.png")
Please include these images (in general, any external files) in the PR
close to this Rmd, then call them just by their name, without any path
(note that these paths are in YOUR computer).
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> + annotation_raster(Australia, xmin = 14.6, xmax = 15.3, ymin = -0.62, ymax = -0.34)
+
+
+#Now, we can display the final plot with flags
+flag_plot
+
+```
+
+
+As we can see, one problem I encountered was with the quality of the flags in the graph. Despite using the annotation_raster() function to add them, the quality of the flags appeared quite poor.
+For the shades that has the authentic graph, I tried to introduce grey rectangles on the back of the flags but it wasn't a good option. Also I tried to edit the images of the packages but then when I tried to introduce those flags in the graph they dissappeared.
+
+
+The next step is to introduce the logos. These original figures were difficult to find, so I decided to made a screenshot of the original plot and introduce the pictures with patchwork package.
+
+```{r, fig.width= 8.5, fig.height= 6}
This chunk produces the final replication, right? Then please include preview
= TRUE as a chunk option in order to show this in the project list.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +logo3 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/tur.png")
+logo3_grob <- rasterGrob(logo3, interpolate = TRUE)
+logo4 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/tur1.png")
+logo4_grob <- rasterGrob(logo4, interpolate = TRUE)
+logo5 <- readPNG("C:/Users/jorge/Desktop/CSS/Data-Visualization/Cocaine in Europe - Datavis/ray.png")
Same as before.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> @@ -0,0 +1,997 @@
+---
+title: "Cocaine consumption"
+description: |
+ This project aims to provide insights into the principal consumers of cocaine through a bar plot. I chose this topic because I find it interesting and relevant, especially in relation to the global issues surrounding drug trafficking.
+ The bar plot serves as an effective tool to visually compare the data, making complex information more accessible and understandable. I was particularly inspired by the work of El Orden Mundial, which I consider they do a great job of visualizing data.
+categories: "2024"
+author: Jorge Ramos
+date: "`r Sys.Date()`"
+output:
+ distill::distill_article:
+ self_contained: false
+ toc: true
+---
+
+First I load the libraries that I will need to make the plot:
And first of all, please show the graph you selected and talk a little bit
about it. See other published projects for reference.
------------------------------
In _projects/2024/100541120/100541120.Rmd
<#81 (comment)>:
> +library(ggplot2)
+library(sf)
+library(ggspatial)
+library(rnaturalearth)
+library(rnaturalearthdata)
+library(tibble)
+library(ggimage)
+library(tibble)
+library(grid)
+library(png)
+library(ggtext)
+library(tidyverse)
+library(showtext)
+library(extrafont)
+library(png)
+library(devtools)
Also, you only need to load the libraries once. Please remove repeated
calls below.
—
Reply to this email directly, view it on GitHub
<#81 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BMFJBZ4USORTT26H2KW4WU32J3B5RAVCNFSM6AAAAABT7QUSVCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNBQG4YDGNJVHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Quería decir que has incluido imágenes de banderas en el PR, pero por otra parte cargas la mayoría de las banderas desde flagon. Entonces elimina las banderas que no se necesitan del PR. Por otro lado, las especiales no están aquí en PNG, solo veo SVG.
Sí. Esto tiene que ser replicable. Si hay rutas de tu ordenador a archivos que no están incluidos aquí, no puedo darle a knitr y replicar tu post. Todo lo que uses externo (imágenes, datos...) tiene que estar incluido en el pull request en la misma carpeta que el Rmd. Y referirte a ellos simplemente por el nombre del archivo, porque ya están junto al Rmd, no hace falta que incluyas la ruta completa al archivo. |
Good Evening Iñaki,
I have already uploaded the initial version of the project.
I look forward to receiving your contribution.