ggplot()+geom_line(DATA, aes(X,Y)) (Normal) hchart(DATA,'line',hcaes(X,Y)) (Interactif) library(ggplot)
ggplot(data= YOUR_DATASET)+
#geom_line(aes(x= X_AXIS_VAR, y= Y_AXIS_VAR, color= COLOR_VAR)) +
geom_point(aes(x= X_AXIS_VAR, y= Y_AXIS_VAR, color= COLOR_VAR)) +
ggtitle("YOUR TITLE")+ # The Graph title
xlab("YOUR X LABEL") + # If you want something different
ylab("YOUR Y LABEL") + # from X_AXIS_VAR & Y_AXIS_VAR
theme_minimal() + # Optional
theme(plot.title = element_text(size = 15, hjust = 0.5), # Optional
panel.grid.minor = element_blank(), # Optional
panel.grid.major.x = element_blank(), # Optional
)luxflat.rds luxflat <- read_rds('/data/luxflat.rds')
sub_luxflat <- luxflat %>%
filter(quartier %in% c('Beggen', 'Belair', 'Gasperich','Kirchberg') & meuble==0)
ggplot(data=sub_luxflat) +
geom_point(aes(x=surface, y=prix, color=quartier)) +
ggtitle("Loyer d'appartements en Ville par\n rapport à la surface au 1er Juin 2020") +
labs(fill = "Quartiers") +
xlab("Surface (m²)") +
ylab("Loyer (€)") +
theme_minimal() +
theme(plot.title = element_text(size = 15, face = "bold", hjust = 0.5),
panel.grid.minor = element_blank(),
legend.justification=c(1,0),
legend.position=c(0.95,0.02)) ?slice) facet_wrap() meublemeuble_quartier <- luxflat %>%
filter(meuble==1) %>%
group_by(quartier) %>%
summarise(n_appart=n()) %>%
ungroup() %>%
arrange(desc(n_appart)) %>%
slice(1:3)
luxflat %>%
filter(meuble==1) %>%
group_by(quartier) %>%
summarise(n_appart=n()) %>%
ungroup() %>%
arrange(n_appart) %>%
slice(1:3)
luxflat %>%
group_by(quartier) %>%
summarise(prix_max = max(prix),
prix_min = min(prix),
prix_med = median(prix),
surf_max = max(surface),
surf_min = min(surface),
surf_med = median(surface) )ggplot(data=luxflat %>%
filter(quartier %in% meuble_quartier$quartier) %>%
mutate(meuble= ifelse(meuble==1,
'Appartements meublés','Appartements non meublés'))) +
geom_point(aes(x=surface, y=prix, color=quartier), alpha=0.8, position = 'jitter') +
facet_wrap(~meuble, nrow = 2) +
ggtitle("Loyer d'appartements en Ville par\n rapport à la surface au 1er Juin 2020") +
xlab("Surface (m²)") +
ylab("Loyer* (€)") +
theme_light()+
theme(plot.title = element_text(size = 15,
face = "bold", hjust = 0.5),
plot.caption = element_text(size = 8,
face = "bold",color='#cecece'),
#panel.grid.minor = element_blank(),
legend.position= 'bottom')+
labs(color = " ",
caption = "Source: atHome \n*Le loyer comprend les charges mensuelles")library(highcharter)
hchart(sub_luxflat, type='scatter', hcaes(x=surface, y=prix, group=quartier)) %>%
hc_tooltip(pointFormat = " Surface: <b>{point.x} m²</b> <br/>
Prix: <b>{point.y} €</b>") %>%
hc_title( text="Loyer d'appartements en Ville<br>par rapport à la surface au 1er Juin 2020") %>%
hc_xAxis(title = list(text = "Surface (m²)")) %>%
hc_yAxis(title = list(text = "Loyer* (€)")) %>%
hc_caption(
text = "*Le loyer comprend les charges mensuelles",
align = "right") %>%
hc_credits(
enabled = TRUE, text = "Source: atHome",
href = "https://www.athome.lu/srp/?tr=rent&q=119ebefe,dea70e87,0258f3cd,f37c45a0&loc=L10-beggen,L10-kirchberg,L10-gasperich,L10-belair",
style = list(fontSize = "12px"))ggplot()+geom_point(DATA,aes(X,Y)) (Normal) hchart(DATA,'scatter',hcaes(X,Y)) (Interactif) slice() en Manipulation de données Merci pour votre attention