View source: R/ggpostcard_example_rstereogram.R
ggpostcard_example_rstereogram | R Documentation |
This example makes a postcard where if you cross your eyes you see a secret image! It uses the package rstereogram by Ryan Timpe.
ggpostcard_example_rstereogram(
image_filename = NULL,
colors = c("#00436b", "#ffed89"),
alpha_only = FALSE,
...
)
image_filename |
(optional) The path of the PNG file to be the image. If NULL defaults to the R logo |
colors |
(optional) vector of visually distinct colors to make the image |
alpha_only |
(optional) If the alpha channel of the png file |
Depending on the size of the image preview the image may be distorted. Try zooming in and out of the picture on your monitor to see the effect.
The default image is the R logo, however you can pass your own PNG file. Suggestions for your own file:
It should have the aspect ratio 5.875in x 3.875in
It should be grayscale
It should be a small file (height around 500 pixels)
a ggplot2 plot to pass to ggpostcard
Other ggpostcard_examples:
ggpostcard_example_contouR()
,
ggpostcard_example_sunrise()
library(ggirl)
return_address <- address(name = "Jacqueline Nolis", address_line_1 = "111 North St",
city = "Seattle", state = "WA",
postal_code = "11111", country = "US")
contact_email <- "fakeemailforreal@gmail.com"
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, return_address = return_address,
send_addresses = send_addresses, messages = messages)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.