RObservations #44: Adding Frame and Custom Title Support To mapBliss

[This article was first published on r – bensstats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


The mapBliss package is a R package which I developed which allows for users to make custom souvenir quality maps of their flights, road trips and favorite cities by utilizing the power of the leaflet and other R packages (for a full list, see the Github README here). The goal of the package is to imitate the visualization and print-ability of maps produced by businesses like original inspiration), TheLittlePen, Mapiful and MaptracksMe (among many other such businesses).

To get caught up on how this package came to be check out the earlier blogs:

  1. I reverse-engineered (well, some of it)
  2. Using the MapBox API with Leaflet
  3. Plotting Flight Paths on Leaflet Maps
  4. Packaging My Route Map Code! Introducing mapBliss
  5. Control Individual Label Positions In mapBliss With _flex() Functions

In this blog I share the newest feature in the mapBliss package- frame and custom title support along with the ability to save framed maps as a .svg file for a print quality visuals.

Introducing frame_1() and save_map_svg()

Thanks to the folks at StackOverflow, I was able to figure out how create custom frame and title support. I initially looked into adding a title only, but quickly realized that I needed to incorperate a frame to get to get the desired functionality. This combined with my own trial and error allowed me to come up with the frame_1() and save_map_svg() functions. frame_1() is called such in hope that there will be more custom frames designed along the way (please feel free to add potential designs or share your solutions to on the Github Issues), but for now, there is currently only a standard white frame for maps created.

To preview your map you can just plot a map for your choosing and pipe it to the frame_1() function and add the relevant arguments.

(Since I’m blogging off of WordPress, I posted an image of the result below)

# devtools::install_github("benyamindsmith/mapBliss")
map<-plot_city_view("Jersalem, IL") |>
             subtitle_text="City of Gold",
             subtitle_font="Brush Script MT")


If you want to save your map, you can use the save_map_frame_svg() function.

map |>

Listening on
[1] "myTestMap.svg written in F:/"

And that’s pretty much it! With 3 functions its now possible to make a high quality, print ready “framed” and annotated map!

Next Steps/Conclusion

This is a pretty cool breakthrough in the overall progress of mapBliss. Some more ideas where this package can be improved would be with:

  • Creating more frames with CSS to have more framing options– if you know of any CSS codes for making nice frames please let me know!
  • Build a GUI…eventually…and work on all sorts of things to make that happen. Likely the GUI would be developed in shiny.

Right now I don’t really have a particular timeline for getting any of this done, but its some of the ideas that I have in mind for further development of the mapBliss package.

I really want to get more people to play around with this package and see what they make with it! If you notice any problems or want a new feature, feel free to open an issue on Github and let me know!

Thank you for reading!

Want to see more of my content?

Be sure to subscribe and never miss an update!

To leave a comment for the author, please follow the link and comment on their blog: r – bensstats. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)