## OGR data source with driver: ESRI Shapefile
## Source: "/Users/florence-vd/florencevdubois.github.io/documentation/fas1003/montreal", layer: "LIMADMIN"
## with 34 features
## It has 9 fields
## Object of class SpatialPolygonsDataFrame
## Coordinates:
## min max
## x -73.9966 -73.47387
## y 45.3854 45.70758
## Is projected: FALSE
## proj4string :
## [+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]
## Data attributes:
## MUNID CODEID CODEMAMROT
## Min. :66023 10 : 1 66007 : 1
## 1st Qu.:66023 11 : 1 66032 : 1
## Median :66023 16 : 1 66047 : 1
## Mean :66023 2 : 1 66058 : 1
## 3rd Qu.:66023 22 : 1 66062 : 1
## Max. :66023 28 : 1 66072 : 1
## (Other):28 (Other):28
## NOM TYPE ABREV
## Ahuntsic-Cartierville : 1 Arrondissement:19 AC : 1
## Anjou : 1 Ville liée :15 AJ : 1
## Baie-d'Urfé : 1 BF : 1
## Beaconsfield : 1 BU : 1
## Côte-des-Neiges-Notre-Dame-de-Grâce: 1 BV : 1
## Côte-Saint-Luc : 1 CL : 1
## (Other) :28 (Other):28
## NUM AIRE PERIM
## Min. : 1.00 Min. : 180509 Min. : 1814
## 1st Qu.: 9.25 1st Qu.: 8535644 1st Qu.:16348
## Median :17.50 Median :16181943 Median :20747
## Mean :26.35 Mean :18177972 Mean :22184
## 3rd Qu.:25.75 3rd Qu.:25128577 3rd Qu.:28068
## Max. :77.00 Max. :50047004 Max. :51360
##
## MUNID CODEID CODEMAMROT
## Min. :66023 10 : 1 66007 : 1
## 1st Qu.:66023 11 : 1 66032 : 1
## Median :66023 16 : 1 66047 : 1
## Mean :66023 2 : 1 66058 : 1
## 3rd Qu.:66023 22 : 1 66062 : 1
## Max. :66023 28 : 1 66072 : 1
## (Other):28 (Other):28
## NOM TYPE ABREV
## Ahuntsic-Cartierville : 1 Arrondissement:19 AC : 1
## Anjou : 1 Ville liée :15 AJ : 1
## Baie-d'Urfé : 1 BF : 1
## Beaconsfield : 1 BU : 1
## Côte-des-Neiges-Notre-Dame-de-Grâce: 1 BV : 1
## Côte-Saint-Luc : 1 CL : 1
## (Other) :28 (Other):28
## NUM AIRE PERIM
## Min. : 1.00 Min. : 180509 Min. : 1814
## 1st Qu.: 9.25 1st Qu.: 8535644 1st Qu.:16348
## Median :17.50 Median :16181943 Median :20747
## Mean :26.35 Mean :18177972 Mean :22184
## 3rd Qu.:25.75 3rd Qu.:25128577 3rd Qu.:28068
## Max. :77.00 Max. :50047004 Max. :51360
##
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 66023 66023 66023 66023 66023 66023
## [,1] [,2]
## [1,] -73.53013 45.53476
## [2,] -73.53019 45.53461
## [3,] -73.53031 45.53421
## [4,] -73.53037 45.53380
## [5,] -73.53038 45.53338
## [6,] -73.53033 45.53297
## [7,] -73.53023 45.53257
## [8,] -73.51987 45.49921
## [9,] -73.52044 45.49912
## [10,] -73.51922 45.49519
## [11,] -73.52922 45.49180
## [12,] -73.52918 45.49171
## [13,] -73.52973 45.49152
## [14,] -73.53541 45.48959
## [15,] -73.53991 45.48805
## [16,] -73.54025 45.48818
## [17,] -73.54060 45.48829
## [18,] -73.54097 45.48838
## [19,] -73.54126 45.48844
## [20,] -73.54931 45.48999
## [21,] -73.54949 45.49003
## [22,] -73.54967 45.49007
## [23,] -73.54990 45.49014
## [24,] -73.55009 45.49019
## [25,] -73.55027 45.49025
## [26,] -73.55048 45.49033
## [27,] -73.55069 45.49041
## [28,] -73.55085 45.49048
## [29,] -73.55097 45.49053
## [30,] -73.55114 45.49061
## [31,] -73.55135 45.49071
## [32,] -73.55152 45.49081
## [33,] -73.55177 45.49096
## [34,] -73.55199 45.49111
## [35,] -73.55275 45.49166
## [36,] -73.55344 45.49246
## [37,] -73.55382 45.49303
## [38,] -73.55428 45.49417
## [39,] -73.55464 45.49492
## [40,] -73.55510 45.49544
## [41,] -73.55564 45.49585
## [42,] -73.55607 45.49607
## [43,] -73.55866 45.49706
## [44,] -73.55955 45.49744
## [45,] -73.56138 45.49832
## [46,] -73.56234 45.49647
## [47,] -73.56309 45.49525
## [48,] -73.56384 45.49416
## [49,] -73.56450 45.49326
## [50,] -73.56718 45.49009
## [51,] -73.56873 45.49085
## [52,] -73.56985 45.49136
## [53,] -73.57307 45.49291
## [54,] -73.57618 45.49055
## [55,] -73.57698 45.48996
## [56,] -73.57825 45.48898
## [57,] -73.57844 45.48884
## [58,] -73.57885 45.48853
## [59,] -73.58032 45.48750
## [60,] -73.58078 45.48720
## [61,] -73.58152 45.48672
## [62,] -73.58175 45.48700
## [63,] -73.58313 45.48813
## [64,] -73.58241 45.48834
## [65,] -73.58250 45.48837
## [66,] -73.58257 45.48840
## [67,] -73.58347 45.48868
## [68,] -73.58360 45.48872
## [69,] -73.58385 45.48880
## [70,] -73.58430 45.48895
## [71,] -73.58465 45.48906
## [72,] -73.58488 45.48914
## [73,] -73.58658 45.48969
## [74,] -73.58849 45.49031
## [75,] -73.58933 45.49058
## [76,] -73.59261 45.49165
## [77,] -73.59572 45.49261
## [78,] -73.59647 45.49170
## [79,] -73.59687 45.49187
## [80,] -73.59825 45.49244
## [81,] -73.59985 45.49313
## [82,] -73.60121 45.49370
## [83,] -73.60091 45.49427
## [84,] -73.60160 45.49435
## [85,] -73.60285 45.49449
## [86,] -73.60274 45.49502
## [87,] -73.60295 45.49495
## [88,] -73.60315 45.49490
## [89,] -73.60382 45.49476
## [90,] -73.60460 45.49475
## [91,] -73.60491 45.49477
## [92,] -73.60684 45.49528
## [93,] -73.60668 45.49548
## [94,] -73.60625 45.49542
## [95,] -73.60488 45.49562
## [96,] -73.60466 45.49570
## [97,] -73.60452 45.49578
## [98,] -73.60263 45.49767
## [99,] -73.60052 45.49960
## [100,] -73.59862 45.50116
## [101,] -73.59738 45.50188
## [102,] -73.59696 45.50207
## [103,] -73.59644 45.50228
## [104,] -73.59591 45.50242
## [105,] -73.59540 45.50258
## [106,] -73.59495 45.50278
## [107,] -73.59458 45.50296
## [108,] -73.59434 45.50317
## [109,] -73.59423 45.50332
## [110,] -73.59561 45.50406
## [111,] -73.59349 45.50611
## [112,] -73.59146 45.50807
## [113,] -73.59419 45.50979
## [114,] -73.59351 45.51053
## [115,] -73.59436 45.51091
## [116,] -73.59497 45.51091
## [117,] -73.59567 45.51112
## [118,] -73.59668 45.51155
## [119,] -73.59690 45.51178
## [120,] -73.59688 45.51250
## [121,] -73.59682 45.51258
## [122,] -73.59679 45.51264
## [123,] -73.59678 45.51273
## [124,] -73.59682 45.51291
## [125,] -73.59694 45.51304
## [126,] -73.59703 45.51310
## [127,] -73.59718 45.51316
## [128,] -73.59733 45.51318
## [129,] -73.59751 45.51320
## [130,] -73.59772 45.51320
## [131,] -73.59791 45.51319
## [132,] -73.59807 45.51317
## [133,] -73.59842 45.51310
## [134,] -73.59868 45.51309
## [135,] -73.59879 45.51309
## [136,] -73.59890 45.51311
## [137,] -73.59842 45.51360
## [138,] -73.59786 45.51416
## [139,] -73.59770 45.51429
## [140,] -73.59755 45.51437
## [141,] -73.59737 45.51445
## [142,] -73.59720 45.51450
## [143,] -73.59706 45.51453
## [144,] -73.59686 45.51456
## [145,] -73.59560 45.51458
## [146,] -73.59217 45.51448
## [147,] -73.59203 45.51447
## [148,] -73.59184 45.51447
## [149,] -73.59160 45.51451
## [150,] -73.59142 45.51458
## [151,] -73.59129 45.51465
## [152,] -73.59120 45.51471
## [153,] -73.59021 45.51575
## [154,] -73.58980 45.51628
## [155,] -73.58933 45.51675
## [156,] -73.58825 45.51628
## [157,] -73.58662 45.51555
## [158,] -73.58243 45.51360
## [159,] -73.58019 45.51246
## [160,] -73.57961 45.51215
## [161,] -73.57920 45.51181
## [162,] -73.57857 45.51134
## [163,] -73.57815 45.51085
## [164,] -73.57850 45.51029
## [165,] -73.57899 45.50988
## [166,] -73.57954 45.50930
## [167,] -73.58013 45.50820
## [168,] -73.57610 45.50622
## [169,] -73.57344 45.50495
## [170,] -73.57303 45.50543
## [171,] -73.57267 45.50600
## [172,] -73.57195 45.50721
## [173,] -73.57130 45.50831
## [174,] -73.57082 45.50924
## [175,] -73.57018 45.51075
## [176,] -73.56943 45.51249
## [177,] -73.56773 45.51630
## [178,] -73.56556 45.52111
## [179,] -73.56556 45.52137
## [180,] -73.56554 45.52175
## [181,] -73.56548 45.52272
## [182,] -73.56538 45.52316
## [183,] -73.56511 45.52417
## [184,] -73.56459 45.52582
## [185,] -73.56299 45.53092
## [186,] -73.56138 45.53583
## [187,] -73.56017 45.53816
## [188,] -73.55923 45.53990
## [189,] -73.55651 45.53960
## [190,] -73.55112 45.53908
## [191,] -73.55041 45.53900
## [192,] -73.54947 45.53885
## [193,] -73.54880 45.53863
## [194,] -73.54852 45.53850
## [195,] -73.54825 45.53836
## [196,] -73.54792 45.53814
## [197,] -73.54751 45.53782
## [198,] -73.54736 45.53767
## [199,] -73.54592 45.53590
## [200,] -73.54399 45.53368
## [201,] -73.54328 45.53177
## [202,] -73.54063 45.53127
## [203,] -73.53543 45.53300
## [204,] -73.53013 45.53476
## # A tibble: 6 × 7
## long lat order hole piece group id
## <dbl> <dbl> <int> <lgl> <fct> <fct> <chr>
## 1 -73.8 45.5 1 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
## 2 -73.8 45.5 2 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
## 3 -73.8 45.5 3 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
## 4 -73.8 45.5 4 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
## 5 -73.8 45.5 5 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
## 6 -73.8 45.5 6 FALSE 1 Ahuntsic-Cartierville.1 Ahuntsic-Cartierville
ggplot
à la rescousse!## numero nom_projet nom_rue nb_log hlm_familles hlm_pa hlm_autres
## 1 3 Saint-Sulpice Louvain 150 148 0 2
## 2 6 Adrien Trudeau 10e 32 0 32 0
## 3 7 Montmorency Grand Trunk 80 0 74 6
## 4 16 Place Normandie Chartrand 168 167 0 1
## 5 19 Étienne-Desmarteaux 13e 117 0 108 9
## 6 22 Parc-Royal Elizabeth 33 0 32 1
## projettype type_prog an_orig an_effect arrond villelie qr
## 1 HLM 1971 NA Ahuntsic-Cartierville 5
## 2 HLM 1994 NA Lachine 70
## 3 HLM 1978 NA Le Sud-Ouest 47
## 4 HLM 1972 NA Montréal-Nord 61
## 5 HLM 1978 NA Rosemont–La Petite-Patrie 17
## 6 HLM 1979 NA Saint-Laurent 57
## localisation aired_id longitude latitude xnad83 ynad83
## 1 Aire de diffusion 24662617 -73.64593 45.55639 293406.7 5046286
## 2 Aire de diffusion 24663149 -73.67244 45.44596 291311.1 5034017
## 3 Aire de diffusion 24661252 -73.56073 45.48607 300052.5 5038462
## 4 Aire de diffusion 24662813 -73.62353 45.62378 295167.3 5053772
## 5 Aire de diffusion 24662089 -73.58012 45.55837 298545.0 5046498
## 6 Aire de diffusion 24660563 -73.68213 45.52477 290573.0 5042778
## [[1]]
## [1] "Ahuntsic-Cartierville"
## [2] "Lachine"
## [3] "Le Sud-Ouest"
## [4] "Montréal-Nord"
## [5] "Rosemont–La Petite-Patrie"
## [6] "Saint-Laurent"
## [7] "Villeray–Saint-Michel–Parc-Extension"
## [8] "Ville-Marie"
## [9] "Mercier–Hochelaga-Maisonneuve"
## [10] "Pointe-Claire"
## [11] "Le Plateau-Mont-Royal"
## [12] "LaSalle"
## [13] "Rivière-des-Prairies–Pointe-aux-Trembles"
## [14] "Westmount"
## [15] "Verdun"
## [16] "Côte-des-Neiges–Notre-Dame-de-Grâce"
## [17] "Outremont"
## [18] "Anjou"
## [19] "Saint-Léonard"
## [20] "Dorval"
## [21] "L'Île-Bizard–Sainte-Geneviève"
## [22] "Sainte-Anne-de-Bellevue"
## [23] "Montréal-Est"
## [24] "Côte-Saint-Luc"
## [25] "Dollard-Des Ormeaux"
## [26] "Mont-Royal"
## [27] "Pierrefonds-Roxboro"
## [28] "Beaconsfield"
## [[1]]
## [1] "Ahuntsic-Cartierville"
## [2] "Anjou"
## [3] "Baie-d'Urfé"
## [4] "Beaconsfield"
## [5] "Côte-des-Neiges-Notre-Dame-de-Grâce"
## [6] "Côte-Saint-Luc"
## [7] "Dollard-des-Ormeaux"
## [8] "Dorval"
## [9] "Hampstead"
## [10] "Kirkland"
## [11] "L'Île-Bizard-Sainte-Geneviève"
## [12] "L'Île-Dorval"
## [13] "Lachine"
## [14] "LaSalle"
## [15] "Le Plateau-Mont-Royal"
## [16] "Le Sud-Ouest"
## [17] "Mercier-Hochelaga-Maisonneuve"
## [18] "Mont-Royal"
## [19] "Montréal-Est"
## [20] "Montréal-Nord"
## [21] "Montréal-Ouest"
## [22] "Outremont"
## [23] "Pierrefonds-Roxboro"
## [24] "Pointe-Claire"
## [25] "Rivière-des-Prairies-Pointe-aux-Trembles"
## [26] "Rosemont-La Petite-Patrie"
## [27] "Saint-Laurent"
## [28] "Saint-Léonard"
## [29] "Sainte-Anne-de-Bellevue"
## [30] "Senneville"
## [31] "Verdun"
## [32] "Ville-Marie"
## [33] "Villeray-Saint-Michel-Parc-Extension"
## [34] "Westmount"
p = ggplot(data = dat,
aes(x = long,
y = lat,
group = group,
fill = somme_log)) +
geom_polygon() +
scale_fill_viridis_c(name = "Nombre de logements et/ou chambres",
breaks = c(0,2500,5000,7500,10000),
guide = guide_colorbar(title.position = "top",
title.hjust = .5,
ticks = F,
nbin = 4,
barheight = .5,
barwidth = 10)) +
labs(title = "Nombre total\nde logements sociaux\nconstruits entre\n1959 et 2019",
subtitle = "Données ouvertes, Ville de Montréal") +
coord_map()
p + theme_void() +
theme(legend.position = "bottom",
plot.title = element_text(vjust = -35,
size = 18,
face = "bold",
color = "midnightblue"),
plot.subtitle = element_text(vjust = -80,
hjust = .02,
size = 8,
color = "midnightblue"),
plot.margin = margin(0,1,2.5,1,"cm"),
legend.title = element_text(size = 8,
color = "midnightblue"),
legend.text = element_text(color = "midnightblue"))
## [1] -73.64593 -73.67244 -73.56073 -73.62353 -73.58012 -73.68213
## [1] 45.55639 45.44596 45.48607 45.62378 45.55837 45.52477
p = ggplot() +
geom_polygon(data = dat,
aes(x = long,
y = lat,
group = group),
fill = "ivory2",
color = "grey10") +
geom_point(data = logements,
aes(x = longitude,
y = latitude,
color = projettype),
size = .9,
alpha = .8) +
scale_color_brewer(name = "",
palette = "Set1") +
labs(title = "Logements sociaux construits\nentre 1959 et 2019",
subtitle = "Données ouvertes, Ville de Montréal")
p + coord_map() +
theme_void() +
theme(legend.position = "bottom",
legend.text = element_text(color = "ivory2"),
plot.background = element_rect(fill = "grey10"),
plot.title = element_text(vjust = -35,
size = 18,
face = "bold",
color = "ivory2"),
plot.subtitle = element_text(vjust = -80,
size = 8,
color = "ivory2"),
plot.margin = margin(0,1,2.5,1,"cm"))
# Nous utilisons l'objet "montreal",
# et non l'objet "montreal_table"
montreal_int = montreal
table(montreal_int@data$NOM)
##
## Ahuntsic-Cartierville
## 1
## Anjou
## 1
## Baie-d'Urfé
## 1
## Beaconsfield
## 1
## Côte-des-Neiges-Notre-Dame-de-Grâce
## 1
## Côte-Saint-Luc
## 1
## Dollard-des-Ormeaux
## 1
## Dorval
## 1
## Hampstead
## 1
## Kirkland
## 1
## L'Île-Bizard-Sainte-Geneviève
## 1
## L'Île-Dorval
## 1
## Lachine
## 1
## LaSalle
## 1
## Le Plateau-Mont-Royal
## 1
## Le Sud-Ouest
## 1
## Mercier-Hochelaga-Maisonneuve
## 1
## Mont-Royal
## 1
## Montréal-Est
## 1
## Montréal-Nord
## 1
## Montréal-Ouest
## 1
## Outremont
## 1
## Pierrefonds-Roxboro
## 1
## Pointe-Claire
## 1
## Rivière-des-Prairies-Pointe-aux-Trembles
## 1
## Rosemont-La Petite-Patrie
## 1
## Saint-Laurent
## 1
## Saint-Léonard
## 1
## Sainte-Anne-de-Bellevue
## 1
## Senneville
## 1
## Verdun
## 1
## Ville-Marie
## 1
## Villeray-Saint-Michel-Parc-Extension
## 1
## Westmount
## 1
##
## Ahuntsic-Cartierville
## 1
## Anjou
## 1
## Beaconsfield
## 1
## Côte-des-Neiges-Notre-Dame-de-Grâce
## 1
## Côte-Saint-Luc
## 1
## Dollard-Des Ormeaux
## 1
## Dorval
## 1
## L'Île-Bizard-Sainte-Geneviève
## 1
## Lachine
## 1
## LaSalle
## 1
## Le Plateau-Mont-Royal
## 1
## Le Sud-Ouest
## 1
## Mercier-Hochelaga-Maisonneuve
## 1
## Mont-Royal
## 1
## Montréal-Est
## 1
## Montréal-Nord
## 1
## Outremont
## 1
## Pierrefonds-Roxboro
## 1
## Pointe-Claire
## 1
## Rivière-des-Prairies-Pointe-aux-Trembles
## 1
## Rosemont-La Petite-Patrie
## 1
## Saint-Laurent
## 1
## Saint-Léonard
## 1
## Sainte-Anne-de-Bellevue
## 1
## Verdun
## 1
## Ville-Marie
## 1
## Villeray-Saint-Michel-Parc-Extension
## 1
## Westmount
## 1
maps
maps
maps
(quelques limites)mapcan
Auteur: Andrew McCormack
mapcan
mapcan
mapcan
mapcan
_join
Voir la documentation: https://dplyr.tidyverse.org/reference/mutate-joins.html