Sorry it’s in german because I used it for a private project!
library(plotly)
Ind$Gentrification[which(Ind$Gentrification == 1)] <- 'Nicht eindeutig zuzuordnen'
Ind$Gentrification[which(Ind$Gentrification == 2)] <- 'Pionierphase (?)'
Ind$Gentrification[which(Ind$Gentrification == 3)] <- 'Pionierphase'
Ind$Gentrification[which(Ind$Gentrification == 4)] <- 'Pionier- bis Gentrifierphase'
Ind$Gentrification[which(Ind$Gentrification == 5)] <- 'Gentrifierphase bis Super Gentrification'
Ind$Gentrification[which(Ind$Gentrification == "NA")] <- 'Keine Gentrifizierung'
Ind$Gentrification[which(Ind$Gentrification == "Mitte")] <- 'Hamburger Durchschnitt'
Ind$Gentrification <- as.factor(Ind$Gentrification)
colors <- c('royalblue4','firebrick3','gainsboro','khaki1','lightskyblue2','steelblue3','mediumaquamarine')
p <- plot_ly(Ind, x = ~SI, y = ~MI, z = ~WI, color = ~Gentrification, colors = colors, marker = list(symbol = 'circle', sizemode = 'diameter'), sizes = c(5, 150), text = ~paste("Stadtteil:",id )) %>%
layout(title = "Indexwerte und Gentrifizierungsphasen",
paper_bgcolor = "rgb(243, 243, 243)"
) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = 'SozialIndex'),
yaxis = list(title = 'MobilitätsIndex'),
zaxis = list(title = 'WohnungsmarktIndex')))
p
## Warning: package 'bindrcpp' was built under R version 3.4.4
library(ggplot2)
p=ggplot(Ind, aes(x= SI, y= WI, color=Gentrification, size=MI)) + geom_point() + theme(legend.position=“none”) p