Giter Club home page Giter Club logo

ggirl's Introduction

ggirl - make ggplots in real life

need support? Email [email protected]

This package is a platform for taking ggplot2 objects and getting real life versions of them. Tired of saving your plots with the plain 'ol ggsave() function? Try this package instead!

The mediums in this package that you can choose from will change over time. Currently available are ggwatercolor(), ggartprint(), and ggpostcard(). This package can only mail physical items to addresses in the United States.

ggpostcard

ggpostcard() will take your ggplot2 object and will mail a postcard with it to the address of your choice! Great for friends and colleagues (or maybe holiday cards??). You can specify a single address or many addresses to mail to, and you can customize the message on the back. If you send postcards to many people, you can customize the backs for each recipient if you so chose. Each postcard costs $2.50 to send.

ORIGINAL GGPLOT2 PLOT A REAL LIFE POSTCARD
ggplot2 plot the resulting postcard

How to make a postcard

First, install the package with:

# install.packages("remotes") # if you don't already have it
remotes::install_github("jnolis/ggirl")

Then create a plot you like:

library(ggplot2)
plot <- ggplot(data.frame(x=1:10, y=runif(10)),aes(x=x,y=y)) + geom_line() + geom_point()

Now let's ship it! Specify your email address (for order updates), address to mail to, and the message to put on the back:

library(ggirl)
contact_email <- "[email protected]"

send_address_1 <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
                          city = "Boston", state = "MA",
                          postal_code = "22222", country = "US")

message_1 <- "This plot made me think of you!"

ggpostcard(plot, contact_email, messages = message_1, send_addresses = send_address_1)

(You can include multiple recipients too and customize the return address--check out the function help for more details.)

This will pop up a web page showing you what the order will look like. If both the front picture and back info look good to you click the button to make the payment and submit the order.

The screen to review the order

This will bring you to Stripe to finish the purchase.

The screen to make the purchase

And you're done! Postcards will arrive in around 1-2 weeks.

Examples for if you can't think of a cool postcard plot

Included in ggirl::ggpostcard functionality are a few plots that are ready for you to try!

Sunrise/sunset plot

You can use ggirl::ggpostcard_example_sunrise() to make a postcard of sunrise and sunset locations for a city. It defaults to Seattle, WA, but you can use any location (check the documentation for requirements). It takes a minute or so to query the sunrise/sunset api:

library(ggirl)
contact_email <- "[email protected]"
send_addresses <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
                          city = "Boston", state = "MA",
                          postal_code = "22222", country = "US")
messages <- "Look at this cool plot I found!"

plot <- ggpostcard_example_sunrise()
ggpostcard(plot = plot,
           contact_email = contact_email,
           send_addresses = send_addresses, messages = messages)

ContouR plot

You can use ggirl::ggpostcard_example_contouR() to make a postcard of the generative art of @Ijeamakaanyene. Check the help function on how to change the colors of the plot.

library(ggirl)
contact_email <- "[email protected]"
send_addresses <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
                          city = "Boston", state = "MA",
                          postal_code = "22222", country = "US")
messages <- "Look at this cool plot I found!"

plot <- ggpostcard_example_contouR()
ggpostcard(plot = plot,
           contact_email = contact_email,
           send_addresses = send_addresses, messages = messages)

rstereogram plot

You can use ggirl::ggpostcard_example_rstereogram() to make a postcard of a stereogram of an image using the rstereogram package by @ryantimpe. It defaults to the R logo but you can pass it any PNG file. Check the documentation for best practices around that, and if you're having trouble seeing the image you may need to zoom in on your monitor.

library(ggirl)
contact_email <- "[email protected]"
send_addresses <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
                          city = "Boston", state = "MA",
                          postal_code = "22222", country = "US")
messages <- "Look at this cool plot I found!"

plot <- ggpostcard_example_rstereogram()
ggpostcard(plot = plot,
           contact_email = contact_email,
           send_addresses = send_addresses, messages = messages)

ggartprint

Art prints made by ggartprint From left to right: ggartprint_example_map plot, Palmer Penguin data, and ggplot2 art by @ijeamakaanyene.

With ggartprint() you can order a beautiful art print to be mailed to you! The prints are on archival photo-rag paper and come in a number of sizes from "cute and small" to "large and centerpiece of a room"

How to make an art print

First, install the package with:

# install.packages("remotes") # if you don't already have it
remotes::install_github("jnolis/ggirl")

Then create a plot you like:

library(ggplot2)
plot <- ggplot(data.frame(x=1:10, y=runif(10)),aes(x=x,y=y)) +
  geom_line() + geom_point() + theme_gray(48)

Now let's order the prints! You'll need to specify your email address and the physical address to mail to. You'll also need to specify the size (ex: "11x14"), the orientation (ex: "portrait"), and quantity (typically 1).

library(ggirl)
delivery_address <- address(name = "Fake person", address_line_1 = "101 12th st",
address_line_2 = "Apt 17", city = "Seattle", state = "WA",
  postal_code = "98102", country = "US")
contact_email = "[email protected]"
ggartprint(plot, size="11x14", orientation = "landscape", quantity = 1,
           contact_email = contact_email, address = delivery_address)

This will open a web page to preview the art print. if you like how it looks you can submit the order and pay via Stripe.

The screen to review the order

And you're done! Art prints will arrive in around 2-3 weeks.

Examples for if you can't think of a cool art print plot

Open Street Map plot

Try making a map! With ggartprint_example_map() you can make a map that would cost you twice as much from a non-R based tool. This uses the osmdata package to get data from Open Street Maps, and is based on a tutorial by Joshua McCrain.

library(ggirl)
contact_email <- "[email protected]"
delivery_address <- address(name = "Fake Personname", address_line_1 = "250 North Ave",
                          city = "Boston", state = "MA",
                          postal_code = "22222", country = "US")
plot <- ggartprint_example_map("Seattle", "Washington")
# use the background option to avoid white boundaries
ggartprint(plot, background = "#FEFDF7", size = "11x14", orientation = "portrait",
                                contact_email = contact_email,
                                address = delivery_address))

The screen to review the order

ggwatercolor

ORIGINAL GGPLOT2 PLOT A REAL LIFE WATERCOLOR
ggplot2 plot the resulting watercolor

With ggwatercolor() you have a hand-painted watercolor painting of your ggplot2. These paintings are done on heavy cold-pressed 8"x10" watercolor paper with lightfast paints, meaning your beautiful watercolor will withstand the test of time.

How to request a watercolor commission

First, install the package with:

# install.packages("remotes") # if you don't already have it
remotes::install_github("jnolis/ggirl")

Then create a plot you like:

library(ggplot2)
plot <- ggplot(data.frame(x=1:10, y=runif(10)),aes(x=x,y=y)) +
  geom_line() + geom_point() + theme_gray(48)

Then to request the commission! The ggwatercolor() function can be called to do so. Just specify the plot, the orientation, a contact email, and the address to mail the commission to.

library(ggirl)
delivery_address <- address(name = "Fake person", address_line_1 = "101 12th st",
address_line_2 = "Apt 17", city = "Seattle", state = "WA",
  postal_code = "98102", country = "US")
contact_email = "[email protected]"
ggartprint(plot, orientation = "landscape", contact_email = contact_email, address = delivery_address)

This will open a web page to preview the watercolor. If you like it, you can request the commission, and in a few days you'll get an email with details about the commission and request for payment.

The screen to review the order

The email will include the price, between $100-$175 depending on the complexity of the picture, and a link to pay. If the plot is complex it may also need to be simplified by the artist. After payment, the commission should be complete in up to 4 weeks.

Get involved

If you think this package is interesting you can help in multiple ways! Maybe you have an R package that could call one of these functions! Maybe you could come up with a new form of fulfillment, like making plots out of clay! Email [email protected] to discuss it.

Acknowledgments

Thanks to:

ggirl's People

Contributors

jnolis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ggirl's Issues

Minor Issue - Quantity does not seem to be working

Hi @jnolis ,

Thank you for your excellent package. I tried to make a couple of prints from one of our Maps; however, when I went to the app site, there was only one plot ($30 instead of $60). I am not sure if this is a bug or something wrong with my code.

For your reference, I am attaching the code that I used below (not really a minimal example but not huge either):

if(require(remotes) == FALSE) install.packages("remotes")
if(require(pacman)==FALSE) install.packages("pacman")
if(require(ggirl) == FALSE) remotes::install_github("jnolis/ggirl")

pacman::p_load(tidyverse, magrittr, lubridate, albersusa, tigris) # loading the required packages


clusterCounties = readRDS(url("https://github.com/fmegahed/covid19/blob/master/Data/clusterCounties.rds?raw=true")) # myData
clusterCounties$fips = str_pad(clusterCounties$key_numeric, width = 5, side = 'left', pad = '0')
clusterCounties %<>% ungroup()


cty_sf = counties_sf("aeqd") %>% filter(!state %in% c('Alaska', 'Hawaii')) # map from albersusa package
cty_sf %<>% left_join(clusterCounties[, c('fips', 'cluster_group')], by = 'fips') # adding cluster_group to cty_sf


cty_sf %>% # ggplot for the map inspired by https://stackoverflow.com/a/60843261/10156153
  ggplot() +
  geom_sf(mapping = aes(fill = cluster_group), color = "black") +
  coord_sf(datum = NA) +   
  scale_fill_brewer(palette = 'Set2') +
  theme_bw(base_size = 24) + theme(legend.position="bottom", panel.border = element_blank()) +
  labs(caption = 'Based on Data from March 01, 2020 - January 02, 2021') -> p


delivery_address <- address(name = "My Name", address_line_1 = "My Address",
                            address_line_2 = "", city = "Oxford", state = "OH",
                            postal_code = "45056", country = "US")
contact_email = "[email protected]"

ggartprint(p, background = "#FEFDF7", size="11x14", orientation = "landscape", quantity = 2,
           contact_email = contact_email, address = delivery_address)

Regex doesn't work in message

if my message is:

"message_1 <- "Hi, \n Thanks for the message. \n Emily"

The \n doesn't appear in the preview, but it also doesn't put the following text on a new line.

Postcards won't ship internationally

For some reason they don't realize the postcards are non US and are being rejected for having invalid US states. I am working it out with the postcard provider currently.

not able to download package

Error in get(genname, envir = envir) : object 'testthat_print' not found
Downloading GitHub repo jnolis/ggirl@master
Error: Failed to install 'ggirl' from GitHub:
  HTTP error 404.
  No commit found for the ref master

  Did you spell the repo owner (`Ijeamakaanyene`) and repo name (`contouR`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

looks like it's around the new remote dependency you added?

Sometimes postcards have lots of image artifacts

image

Somehow with the postcard provider then end up printing the postcards in ways that look really low res and with lots of compression artifacts. I don't think this has anything to do with me--it happens on the back too and I use the same back image for everything.

I am currently in contact with the provider to see what they say

Text annotation previews

Text annotations in ggplot resize depending on the graphics window size and I have to trial & error. Would be cool if there were a shiny app or other way to preview the printed output of the chart before uploading it to the ggirl server.

grid.draw method error?

Hey! love this! trying it out for the first time I got this:

> ggpostcard(plot,
+            contact_email, 
+            messages = message_1,
+            send_addresses = send_address_1)
Waiting 10 seconds for ggirl server to come online
Error in UseMethod("grid.draw") : 
  no applicable method for 'grid.draw' applied to an object of class "function"

Do you know if that's on my ggplot itself or some bug in your shiny app?

Make warning that postcards will be smudged more obvious

The US Postal Service machines are not really made for postcards and apparently these super tough rubber belts that leave marks on postcards. I have wording on the preview page that there will be smudges but I should make it more obvious

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.