I’ve been researching the distribution of firearms in Mexico and international legislation on exports and imports for a few months now. The topic is somewhat complex but very interesting. During my research, I came across a database that I cleaned and used to develop my first Shiny app in R.

I created the Sankey diagram, bar charts, and line charts in R using the plotly library; however, for the treemap, I had to use a couple of workarounds to achieve the result I wanted. I used reticulate in R to implement this chart using the Python version of plotly, since the R version doesn’t support grouped treemaps.

2026 Update: I need to migrate this app from shinyapps.io to Posit Connect Cloud, because the shinyapps.io service will be discontinued in 2026. For this reason, the app may take a while to load, or you may need to “reload” it in your browser several times.

Application not loading properly? Open app directly in a new tab 🚀