Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

CRAN_Status_Badge

smpic

When you have created an awesome plot you want to share it with the world. But you want it to look just as awesome when you do as it looked in Rstudio on your local machine.

Enter smpic... This package helps you scale your awesome plots so they fit perfectly for whatever social media platform you want to share them on.

This is a walk though of how you do it...

First load the libraries:

library(dplyr)
library(ggplot2)
library(smpic)

The create a plot:

p <- ggplot(iris) +
  geom_point(aes(Petal.Length, Petal.Width, color = Species), show.legend = FALSE) +
  geom_label(data = summarise_if(group_by(iris, Species), is.numeric, mean),
             aes(Petal.Length, Petal.Width, label = Species, color = Species),
             show.legend = FALSE) +
  labs(x = "Petal Length", y = "Petal Width",
       title = "Look mom, a flower plot!",
       subtitle = "Yet another iris data set visualization.",
       caption = "Source: iris") +
  theme_minimal()

See the plot:

p

Play around with the text_factor to get your text just right.

Scale it for Facebook:

smpic_view(p, sm = "facebook_shared_images", text_factor = 2.2)

Scale it for Twitter:

smpic_view(p, sm = "twitter_in-stream_photo", text_factor = .8)

smpic_save(p, filename = "my_new_social_media_plot.png",
           sm = "facebook_shared_images", text_factor = 2.2)

About

R package for scaling images to fit social media

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.