Commit 37120bde authored by numeroteca's avatar numeroteca

add analisis de reparto de anuncios en hosts

parent 77cd6f88
......@@ -31,8 +31,8 @@ attach(local_activo)
# shapes
barrios <- readOGR("../data/original/shapes/barrios.valencia.wgs84.geojson")
distritos <- readOGR("../data/original/shapes/distritos.valencia.wgs84.geojson")
municipios <- distritos
# municipios <- readOGR("../data/original/shapes/municipios.provincia.valencia.geojson")
# municipios <- distritos
municipios <- readOGR("../data/original/shapes/municipios.provincia.valencia.geojson")
# Define paleta de color
# palette1 <- c("#2171b5","#6baed6","#bdd7e7","#fee5d9")
......@@ -100,7 +100,7 @@ ggplot(data = n_alojamientos[1:25,] ,aes(x = reorder(host_name,alojamientos), y
legend.position = "bottom"
) +
labs(title = "Número de alojamientos por anfitrión: top 25",
subtitle = "Septiembre 2018.",
subtitle = "Febrero 2019.",
y = "número de anuncios",
x = "anfitriones",
caption = "Datos: InsideAirbnb. Gráfico: lab.montera34.com/airbnb") +
......@@ -116,23 +116,23 @@ ggplot(data = n_alojamientos[1:25,] ,aes(x = reorder(host_name,alojamientos), y
local_activo$host_id <- as.factor(local_activo$host_id)
ggplot() +
# geom_polygon(data = municipios,
# aes(x = long, y = lat, group = group),
# color = "grey", fill="white", size = 0.1) +
geom_polygon(data = municipios,
aes(x = long, y = lat, group = group),
color = "grey", fill="white", size = 0.1) +
geom_polygon(data = barrios,
aes(x = long, y = lat, group = group),
color = "grey", fill="white", size = 0.1) +
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[1:5,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
coord_quickmap(1.3) + #xlim=c(2.125, 2.225), ylim=c(41.37,41.4142),
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
panel.grid = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
# axis.title = element_blank(),
# axis.text = element_blank(),
panel.background = element_rect(fill="#EEEEFF",color = "grey",size = 0.25),
legend.position = "top"
) +
......@@ -151,9 +151,8 @@ geom_polygon(data = barrios,
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[1,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
# coord_quickmap(xlim=c(2.125, 2.225), ylim=c(41.37,41.4142)) +
coord_fixed(1.3) +
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
......@@ -182,9 +181,8 @@ geom_polygon(data = barrios,
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[2,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
# coord_quickmap(xlim=c(2.125, 2.225), ylim=c(41.37,41.4142)) +
coord_fixed(1.3) +
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
......@@ -211,8 +209,8 @@ geom_polygon(data = barrios,
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[3,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
coord_quickmap(xlim=c(2.125, 2.225), ylim=c(41.37,41.4142)) +
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
......@@ -240,8 +238,8 @@ geom_polygon(data = barrios,
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[4,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
coord_quickmap(xlim=c(2.125, 2.225), ylim=c(41.37,41.4142)) +
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
......@@ -270,8 +268,8 @@ geom_polygon(data = barrios,
geom_point(data= local_activo,
aes(x=longitude, y=latitude),alpha=0.03,size = 0.07)+
geom_point(data= local_activo[host_id %in% n_alojamientos[5,]$host_id,],
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1,) + #color="blue"
coord_quickmap(xlim=c(2.125, 2.225), ylim=c(41.37,41.4142)) +
aes(x=longitude, y=latitude, color=host_name),alpha=0.6,size = 1) + #color="blue"
coord_fixed(xlim= c(-0.4, -0.3),ylim=c(39.45,39.5),ratio=1.3 ) +
theme_nothing(legend = TRUE) +
theme_minimal(base_family = "Roboto Condensed", base_size = 12) +
theme(
......@@ -301,7 +299,7 @@ ggplot(data=n_alojamientos, aes(alojamientos)) +
legend.position = "bottom"
) +
labs(title="Histograma de número de alojamientos por usuario",
subtitle = "Septiembre 2018.",
subtitle = "Febrero 2019.",
x="número de alojamientos por anfitrión",
y="número de propoietarios",
caption = "Datos: InsideAirbnb. Gráfico: lab.montera34.com/airbnb")
......@@ -336,7 +334,7 @@ ggplot(data = naccommodates[1:25,] ,aes(x = reorder(host_name,plazas), y = plaza
legend.position = "bottom"
) +
labs(title = "Número de plazas por usuario: top 25",
subtitle = "Septiembre 2018.",
subtitle = "Febrero 2019.",
y = "número de plazas",
x = "anfitriones",
caption = "Datos: InsideAirbnb. Gráfico: lab.montera34.com/airbnb") +
......@@ -357,7 +355,7 @@ ggplot(data=naccommodates, aes(plazas)) +
) +
labs(
title="Histograma de plazas por usuario",
subtitle="Usuarios con 30 plazas o menos (cajones de 1). Septiembre 2018.",
subtitle="Usuarios con 30 plazas o menos (cajones de 1). Febrero 2019.",
y="número de plazas",
x="número de plazas por usuario",
caption = "Datos: InsideAirbnb. Gráfico: lab.montera34.com/airbnb")
......@@ -373,7 +371,7 @@ ggplot(data=naccommodates, aes(plazas)) +
) +
labs(
title="Histograma de plazas por usuario",
subtitle="Usuarios con 30 plazas o más (cajones de 10). Septiembre 2018.",
subtitle="Usuarios con 30 plazas o más (cajones de 10). Febrero 2019.",
y="número de plazas",
x="número de plazas por usuario",
caption = "Datos: InsideAirbnb. Gráfico: lab.montera34.com/airbnb")
......@@ -434,7 +432,7 @@ ggplot(dist.melt, aes(x = tipo, y = value,fill=variable)) +
subtitle = "Anfitriones, alojamientos y plazas",
y = "cantidad",
x = NULL,
caption = "Datos: Insideairbnb (septiembre 2018). Gráfico: lab.montera34.com/airbnb",
caption = "Datos: Insideairbnb (Febrero 2019). Gráfico: lab.montera34.com/airbnb",
fill = "Nº de anuncios por anfitrión") +
geom_text(data = dist.melt[dist.melt$value > 1600,], aes(label = format(value, big.mark="."), group=variable),
position = position_stack(vjust = 0.5), hjust = 0.4,
......@@ -476,7 +474,7 @@ ggplot(dist_per.melt, aes(x = tipo, y = value,fill=variable)) +
subtitle = "Anfitriones, alojamientos y plazas",
y = "porcentaje",
x = NULL,
caption = "Datos: Insideairbnb (septiembre 2018). Gráfico: lab.montera34.com/airbnb",
caption = "Datos: Insideairbnb (Febrero 2019). Gráfico: lab.montera34.com/airbnb",
fill = "Nº de anuncios por anfitrión") +
geom_text(data = dist_per.melt, aes(label = format(value, nsmall = 1, decimal.mark=','), group=variable),
position = position_stack(vjust = 0.5), hjust = 0.4,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment