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: |

During the meeting with TSE Minister Edson Fachin, Perekopsky also mentioned the TSE channel on the platform as one of the firm's key success stories. Launched as part of the company's commitments to tackle the spread of fake news in Brazil, the verified channel has attracted more than 184,000 members in less than a month. To delete a channel with over 1,000 subscribers, you need to contact user support The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. The optimal dimension of the avatar on Telegram is 512px by 512px, and it’s recommended to use PNG format to deliver an unpixelated avatar. Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots.
from us


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