Todos los gráficos de , 3D y la combinación de estos en esta presentación son ilustrativos y no representan el estilo ni el gusto de quien lo presenta
hchart
shiny
, rmarkdown
. Si el tiempo da
Haciendo visualizaciones desde 2000 AC
y <- rpois(100, lambda = 3)
plot(table(y))
Rápido para hacer cosas simples, pero no escala de la mejor manera.
plot(AirPassengers)
lattice
basado en trellisggplot2
basado en gramar of graphicsggplot2
es el rey de los gráficos estáticosrCharts
para graficar usando librerías de javascript (basadas en web).htmlwidgets
viene shiny
& rmarkdown
readyPara la mayoría de las librerías sueltas en la web existe un paquete para R
R es muy flexible lo que lleva a:
hc_*
title
) se debe usar hc_title()
y así…# install.package("highcharter")
# source("https://install-github.me/jbkunst/highcharter")
library(highcharter)
hc <- highchart()
hc
hc <- hc %>%
hc_title(text = "Stock") %>%
hc_subtitle(text = "Fuente: Imaginación")
hc
ventas <- abs(1:12 + rnorm(12) + 2)
hc <- hc %>%
hc_add_series(data = ventas, name = "Ventas")
hc
ventas2 <- abs(ventas*.7 + rnorm(12, sd = 0.8))
hc <- hc %>%
hc_add_series(data = ventas2, name = "Competencia")
hc
hc %>%
hc_chart(
type = "column", borderColor = '#EBBA95', borderRadius = 10, borderWidth = 3,
options3d = list(enabled = TRUE, alpha = 15, beta = 15))
hc <- hc %>%
hc_xAxis(categories = month.abb) %>%
hc_yAxis(labels = list(format = "${value:.1f}"))
hc
hcf <- highchart() %>%
hc_title(text = "Stock") %>%
hc_subtitle(text = "Fuente: Imaginación") %>%
hc_add_series(data = ventas, name = "Ventas", color = "#3B5997",
type = "area", fillOpacity = 0.15, lineWidth = 2) %>%
hc_add_series(data = ventas2, name = "Compentencia", visible = FALSE) %>%
hc_xAxis(categories = month.abb) %>%
hc_yAxis(labels = list(format = "${value:.1f}"), min = 0) %>%
hc_tooltip(valueDecimals = 2, valuePrefix = "$", table = TRUE)
hchart
al rescate hchart
plot
hchart(objeto)
hchart
x <- rnorm(1000)
hchart(x)
hchart
hchart(density(x), color = "skyblue", name = "Densidad!")
hchart
(+ bonus!)library(forecast)
hchart(forecast(AirPassengers, h = 30)) %>%
hc_exporting(enabled = TRUE)
hchart
hchart(princomp(USArrests, cor = TRUE))
hchart
hchart(cor(mtcars))
hchart
en data.frame
sdata(economics, economics_long, package = "ggplot2")
print(economics, n = 3); print(economics_long, n = 3)
## # A tibble: 574 x 6
## date pce pop psavert uempmed unemploy
## <date> <dbl> <int> <dbl> <dbl> <int>
## 1 1967-07-01 507.4 198712 12.5 4.5 2944
## 2 1967-08-01 510.5 198911 12.5 4.7 2945
## 3 1967-09-01 516.3 199113 11.7 4.6 2958
## # ... with 571 more rows
## # A tibble: 2,870 x 4
## # Groups: variable [5]
## date variable value value01
## <date> <fctr> <dbl> <dbl>
## 1 1967-07-01 pce 507.4 0.0000000000
## 2 1967-08-01 pce 510.5 0.0002660008
## 3 1967-09-01 pce 516.3 0.0007636797
## # ... with 2,867 more rows
hchart
en data.frame
shchart(economics_long, "line", hcaes(date, value01, group = variable)) %>%
hc_tooltip(shared = TRUE, valueDecimals = 2)
hciconarray
hciconarray(c("auto", "camion", "avion"), c(40, 15, 10),
icons = c("car", "truck", "plane"), size = 6)
hcmap
hcmap("countries/cl/cl-all")
hcmap
data("USArrests", package = "datasets")
USArrests <- mutate(USArrests, "woe-name" = rownames(USArrests))
hcmap(map = "countries/us/us-all", data = USArrests,
joinBy = "woe-name", value = "UrbanPop", name = "Urban Population")