Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra

  • StatswithR
  • 2020-10-09
  • 721
How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra
  • ok logo

Скачать How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео How to draw a bivariate continuous function in R using ggplot2? | Heatmap | StatswithR | Arnab Hazra

Here we explain how to generate a presentation/publication-quality plot of a bivariate continuous function, or a heatmap, in R/R-studio using ggplot2. The codes for the steps explained in the video are as follows. Copy and paste them into R, run them one-by-one and try to understand what each argument is doing.

#datascience #datavisualization #visualization #ggplot2 #tidyverse #function #rstudio #rcoding #timeseries #continuous #bivariate #normal #heatmap

mu = c(1, 2)
sigma = c(1, 1.25)
rho = 0.5

covmat = diag(sigma^2)
covmat[1, 2] = covmat[2, 1] = rho * prod(sigma)

mu
covmat

x = seq(from = mu[1] - 3 * sigma[1], to = mu[1] + 3 * sigma[1], by = 0.05)
y = seq(from = mu[2] - 3 * sigma[2], to = mu[2] + 3 * sigma[2], by = 0.05)

loc = expand.grid(x=x, y=y)

#install.packages("emdbook")
library(emdbook)

norm2dens = apply(loc, 1, dmvnorm, mu = mu, Sigma = covmat)

library(ggplot2)

p = ggplot() + geom_tile(aes(x = loc[ , 1], y = loc[ , 2], fill = norm2dens))
ggsave(p, filename = "bivardens_ggplot1.pdf", height = 8, width = 8)

p = ggplot() + geom_tile(aes(x = loc[ , 1], y = loc[ , 2], fill = norm2dens)) +
coord_fixed(ratio = 1)
ggsave(p, filename = "bivardens_ggplot2.pdf", height = 8, width = 8)

p = ggplot() + geom_tile(aes(x = loc[ , 1], y = loc[ , 2], fill = norm2dens),
width = 0.06, height = 0.06) +
coord_fixed(ratio = 1)
ggsave(p, filename = "bivardens_ggplot3.pdf", height = 8, width = 8)

p = ggplot() + geom_tile(aes(x = loc[ , 1], y = loc[ , 2], fill = norm2dens),
width = 0.06, height = 0.06) +
coord_fixed(ratio = 1) +
xlab(expression(X[1])) + ylab(expression(X[2]))
ggsave(p, filename = "bivardens_ggplot4.pdf", height = 8, width = 8)

p0 = ggplot() + geom_tile(aes(x = loc[ , 1], y = loc[ , 2], fill = norm2dens),
width = 0.06, height = 0.06) +
coord_fixed(ratio = 1) +
xlab(expression(X[1])) + ylab(expression(X[2])) +
ggtitle(expression(paste("Density of BVN(", mu[1], "=1, ", mu[2], "=2, ",
sigma[1], "=1, ", sigma[2], "=1.25, ", rho, "=0.5)", sep = ""))) +
theme(plot.title = element_text(hjust = 0.5))
ggsave(p0, filename = "bivardens_ggplot5.pdf", height = 8, width = 8)

p = p0 + theme(axis.text=element_text(size=15),
axis.title=element_text(size=15),
plot.title = element_text(size=18))
ggsave(p, filename = "bivardens_ggplot6.pdf", height = 8, width = 8)

library(viridis)

p = p0 + theme(axis.text=element_text(size=15),
axis.title=element_text(size=15),
plot.title = element_text(size=18)) +
scale_fill_viridis()
ggsave(p, filename = "bivardens_ggplot7.pdf", height = 8, width = 8)

p = p0 + theme(axis.text=element_text(size=15),
axis.title=element_text(size=15),
plot.title = element_text(size=18)) +
scale_fill_viridis(name = "Density") +
theme(legend.title = element_text(size=18, hjust = 0.5),
legend.text=element_text(size=15))
ggsave(p, filename = "bivardens_ggplot8.pdf", height = 8, width = 8)

p = p0 + theme(axis.text=element_text(size=15),
axis.title=element_text(size=15),
plot.title = element_text(size=18)) +
scale_fill_viridis(name = "Density") +
theme(legend.title = element_text(size=18, hjust = 0.5),
legend.text=element_text(size=15),
legend.key.height = unit(1.5,"cm"),
legend.key.width = unit(1.5,"cm"))
ggsave(p, filename = "bivardens_ggplot9.pdf", height = 8, width = 8)

p = p0 + theme(axis.text=element_text(size=15),
axis.title=element_text(size=15),
plot.title = element_text(size=18)) +
scale_fill_viridis(name = "Density") +
theme(legend.title = element_text(size=18, hjust = 0.5),
legend.text=element_text(size=15),
legend.key.height = unit(1.5,"cm"),
legend.key.width = unit(1.5,"cm")) +
scale_x_continuous(expand = expansion(mult = c(0, 0))) +
scale_y_continuous(expand = expansion(mult = c(0, 0)))
ggsave(p, filename = "bivardens_ggplot10.pdf", height = 8, width = 8)

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]