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
hchartshiny, 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()
hchc <- hc %>%
hc_title(text = "Stock") %>%
hc_subtitle(text = "Fuente: Imaginación")
hcventas <- abs(1:12 + rnorm(12) + 2)
hc <- hc %>%
hc_add_series(data = ventas, name = "Ventas")
hcventas2 <- abs(ventas*.7 + rnorm(12, sd = 0.8))
hc <- hc %>%
hc_add_series(data = ventas2, name = "Competencia")
hchc %>%
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}"))
hchcf <- 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 hchartplothchart(objeto)hchartx <- rnorm(1000)
hchart(x)hcharthchart(density(x), color = "skyblue", name = "Densidad!")hchart (+ bonus!)library(forecast)
hchart(forecast(AirPassengers, h = 30)) %>%
hc_exporting(enabled = TRUE)hcharthchart(princomp(USArrests, cor = TRUE))hcharthchart(cor(mtcars))hchart en data.framesdata(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.frameshchart(economics_long, "line", hcaes(date, value01, group = variable)) %>%
hc_tooltip(shared = TRUE, valueDecimals = 2)hciconarrayhciconarray(c("auto", "camion", "avion"), c(40, 15, 10),
icons = c("car", "truck", "plane"), size = 6)hcmaphcmap("countries/cl/cl-all")hcmapdata("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")