Help us understand the problem. What is going on with this article?

ニューイヤーカードをggplotで作りました。

More than 1 year has passed since last update.

はじめに

タイトルのとおり、ニューイヤーカードをggplotで作りました。参照元は下記の通りです。

コード

デザインとggplotを操る技術はお察しの通り残念ですが…。

R
library(ggplot2)
library(png)

image <- readPNG("ino.png")

f <- function(x) {
  ifelse(abs(x) <= 1, (x^4 - x^2 + 6), 12/(abs(x) + 1))
}

g <- function(x) {
  ifelse(abs(x) <= 2, (1/2 * cos(15 * x * pi) + 7/2), 12/(abs(x) + 1))
}

ggplot() + xlim(c(-2.5, 20)) + ylim(c(0, 13)) + 
  geom_point(aes(x, y), data.frame(x=0, y=6), size=70, col = "#fa8072") + 
  stat_function(aes(y=0),  fun = f, geom='density', fill='#FFFFFF') +
  stat_function(aes(y=0),  fun = g, geom='density', fill= "#6495ed") + 
  annotation_raster(image, xmin = 6, xmax = 9, ymin = 1.2, ymax = 4) + 
  annotation_raster(image, xmin = 9.2, xmax = 11.2, ymin = 1, ymax = 3) + 
  annotation_raster(image, xmin = 11.4, xmax = 13.4, ymin = 0.8, ymax = 2.8) + 
  annotate('text', x = 11, y = 11, label = "HappyNewYear",
           size = 30,  family = "HiraKakuPro-W6", col = "#ffd700") + 
  annotate('text', x = 16.5, y = 8, label = "2019",
           size = 30,  family = "HiraKakuPro-W6", col = "#ffd700") + 
  annotate('text', x = 18, y = 1.5, label = "2019.01.01",
           size = 10,  family = "HiraKakuPro-W6", col = "black") +
  theme(axis.text.y = element_blank(),
        axis.text.x = element_blank(),
        axis.title.x = element_blank(), 
        axis.title.y = element_blank()) +
  ggtitle("New Year's card")

Rplot01 4.04.42.png

あけましておめでとうございます。今年もよろしくお願いします。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away