STATS_FOR_SCIENCE Telegram 59
Мастер-класс: валентинки в R

Сегодня я нашла код, как сделать валентинку в R, чтобы порадовать любимого человека или друзей.
Код достаточно простой:
 r
library(ggplot2)
dat <- data.frame(t = seq(0, 2*pi, by = 0.01))
x <- function(t) 16 * sin(t)^3
y <- function(t) 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t)
dat$y <- y(dat$t)
dat$x <- x(dat$t)

heart <- ggplot(dat, aes(x,y)) +
geom_polygon(fill = "#f768a1", col = "firebrick", alpha = 0.9) +
theme_void()+
theme(panel.background = element_rect(fill = '#e7e1ef'))

heart + annotate("text", x = -12, y = 16, color = '#ae017e', label = "От кого: ")+
annotate('text', x = -12, y = 13, color = '#ae017e', label = 'Кому: ') +
annotate('text', x = -1, y = 0, color = '#49006a', label = 'Люблю тебя больше чем рисовать графики ❤️')+
annotate('text', x=-5:5,y=15,colour="red", label = '❤️')

С помощью annotate можно добавлять любые дополнительные элементы, чтобы узнать координаты куда, советую временно закомментировать строчку theme_void.

#R #stat_fun
31👍4😁2🐳1



tgoop.com/stats_for_science/59
Create:
Last Update:

Мастер-класс: валентинки в R

Сегодня я нашла код, как сделать валентинку в R, чтобы порадовать любимого человека или друзей.
Код достаточно простой:

 r
library(ggplot2)
dat <- data.frame(t = seq(0, 2*pi, by = 0.01))
x <- function(t) 16 * sin(t)^3
y <- function(t) 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t)
dat$y <- y(dat$t)
dat$x <- x(dat$t)

heart <- ggplot(dat, aes(x,y)) +
geom_polygon(fill = "#f768a1", col = "firebrick", alpha = 0.9) +
theme_void()+
theme(panel.background = element_rect(fill = '#e7e1ef'))

heart + annotate("text", x = -12, y = 16, color = '#ae017e', label = "От кого: ")+
annotate('text', x = -12, y = 13, color = '#ae017e', label = 'Кому: ') +
annotate('text', x = -1, y = 0, color = '#49006a', label = 'Люблю тебя больше чем рисовать графики ❤️')+
annotate('text', x=-5:5,y=15,colour="red", label = '❤️')

С помощью annotate можно добавлять любые дополнительные элементы, чтобы узнать координаты куда, советую временно закомментировать строчку theme_void.

#R #stat_fun

BY Статистика и R в науке и аналитике




Share with your friend now:
tgoop.com/stats_for_science/59

View MORE
Open in Telegram


Telegram News

Date: |

Ng Man-ho, a 27-year-old computer technician, was convicted last month of seven counts of incitement charges after he made use of the 100,000-member Chinese-language channel that he runs and manages to post "seditious messages," which had been shut down since August 2020. When choosing the right name for your Telegram channel, use the language of your target audience. The name must sum up the essence of your channel in 1-3 words. If you’re planning to expand your Telegram audience, it makes sense to incorporate keywords into your name. Avoid compound hashtags that consist of several words. If you have a hashtag like #marketingnewsinusa, split it into smaller hashtags: “#marketing, #news, #usa. How to Create a Private or Public Channel on Telegram? As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces.
from us


Telegram Статистика и R в науке и аналитике
FROM American