3/6/2023
library(plotly)
# Crear gráfico de serie de tiempo con Plotly y agregar título y subtítulo
grafico <- plot_ly(data = dataset, x = ~meses, y = ~desocupa, type = 'scatter', mode = 'lines') %>%
layout(
title = list(text = "Tasa de desocupación urbanda mensual"),
subtitle = list(text = "Enero 2018 - Diciembre 2022"),
xaxis = list(title = "Período", range = c(as.Date("2015-10-01"), as.Date("2022-12-31"))),
yaxis = list(title = "En porcentaje"),
showlegend = TRUE,
legend = list(x = 0, y = 1, orientation = "h"),
annotations = list(text = "Pie de página", showarrow = FALSE, x = 0, y = -0.2),
margin = list(l = 50, r = 50, b = 50, t = 50)
)
# Visualizar el gráfico
grafico
## Warning: 'layout' objects don't have these attributes: 'subtitle' ## Valid attributes include: ## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'smith', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'