{"action":"created","issue":{"url":"https://api.github.com/repos/r-spatial/sf/issues/760","repository_url":"https://api.github.com/repos/r-spatial/sf","labels_url":"https://api.github.com/repos/r-spatial/sf/issues/760/labels{/name}","comments_url":"https://api.github.com/repos/r-spatial/sf/issues/760/comments","events_url":"https://api.github.com/repos/r-spatial/sf/issues/760/events","html_url":"https://github.com/r-spatial/sf/issues/760","id":327577235,"node_id":"MDU6SXNzdWUzMjc1NzcyMzU=","number":760,"title":"Plotting points and multipolygon objects together","user":{"login":"noriegaedu","id":29818621,"node_id":"MDQ6VXNlcjI5ODE4NjIx","avatar_url":"https://avatars1.githubusercontent.com/u/29818621?v=4","gravatar_id":"","url":"https://api.github.com/users/noriegaedu","html_url":"https://github.com/noriegaedu","followers_url":"https://api.github.com/users/noriegaedu/followers","following_url":"https://api.github.com/users/noriegaedu/following{/other_user}","gists_url":"https://api.github.com/users/noriegaedu/gists{/gist_id}","starred_url":"https://api.github.com/users/noriegaedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noriegaedu/subscriptions","organizations_url":"https://api.github.com/users/noriegaedu/orgs","repos_url":"https://api.github.com/users/noriegaedu/repos","events_url":"https://api.github.com/users/noriegaedu/events{/privacy}","received_events_url":"https://api.github.com/users/noriegaedu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-30T05:17:18Z","updated_at":"2018-06-01T16:40:04Z","closed_at":"2018-06-01T16:40:03Z","author_association":"NONE","body":"I managed to plot both `points` and `multipolygon` sf objects with an older version of the sf package but with the newest version I can't run my old scripts. Following is a reproducible example of my problem.\r\n```\r\nlibrary(sf)\r\nlibrary(magrittr)\r\nlibrary(RColorBrewer)\r\n\r\nnc <- st_read(system.file(\"shape/nc.shp\", package = \"sf\")) %>% \r\n    st_transform(crs = 4326)\r\npoints <- data.frame(p = seq(15, 75, 15), \r\n                     long = c(-85, -80, -78, -75, -82), \r\n                     lat = c(34, 36, 37, 38, 35)) %>% \r\n        st_as_sf(coords = c('long', 'lat'), crs = 4326) \r\npoints$p_cut <- cut(points$p, seq(0, 100, 20))\r\n\r\n#plot1\r\nplot(points['p_cut'], axes = TRUE, graticule = TRUE, pch = 16, \r\n     pal = brewer.pal(5, 'Paired'))\r\nplot(st_geometry(nc), axes = TRUE, graticule = TRUE, add = TRUE)\r\n```\r\n![](https://i.imgur.com/Z7NzPgl.png)\r\n\r\nThe `multipolygon` doesn't appear but if I inverse the order:\r\n```\r\n#plot2\r\nplot(st_geometry(nc), axes = TRUE, graticule = TRUE)\r\nplot(points['p_cut'], axes = TRUE, graticule = TRUE, pch = 16, \r\n     pal = brewer.pal(5, 'Paired'), add = TRUE)\r\n```\r\n![](https://i.imgur.com/Nc5sjbs.png)\r\n\r\nTwo points and the key are missing from the final plot.\r\n\r\n```\r\n> sessionInfo()\r\nR version 3.3.1 (2016-06-21)\r\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\r\nRunning under: Windows >= 8 x64 (build 9200)\r\n\r\nlocale:\r\n[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252    LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                   LC_TIME=Spanish_Spain.1252    \r\n\r\nattached base packages:\r\n[1] stats     graphics  grDevices utils     datasets  methods   base     \r\n\r\nother attached packages:\r\n[1] RColorBrewer_1.1-2 magrittr_1.5       sf_0.6-3           raster_2.5-8       sp_1.2-3          \r\n\r\nloaded via a namespace (and not attached):\r\n [1] class_7.3-14    DBI_1.0.0       tools_3.3.1     units_0.5-1     yaml_2.1.13     Rcpp_0.12.13    udunits2_0.13   grid_3.3.1      e1071_1.6-7    \r\n[10] classInt_0.1-23 lattice_0.20-33\r\n```\r\nI managed to make a partial answer [here](https://stackoverflow.com/questions/50499991/plotting-points-and-multipolygon-objects-in-r-with-sf) but there must be a simpler way to solve this and also include a key in the final plot. Thank you."},"comment":{"url":"https://api.github.com/repos/r-spatial/sf/issues/comments/393938432","html_url":"https://github.com/r-spatial/sf/issues/760#issuecomment-393938432","issue_url":"https://api.github.com/repos/r-spatial/sf/issues/760","id":393938432,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzkzODQzMg==","user":{"login":"noriegaedu","id":29818621,"node_id":"MDQ6VXNlcjI5ODE4NjIx","avatar_url":"https://avatars1.githubusercontent.com/u/29818621?v=4","gravatar_id":"","url":"https://api.github.com/users/noriegaedu","html_url":"https://github.com/noriegaedu","followers_url":"https://api.github.com/users/noriegaedu/followers","following_url":"https://api.github.com/users/noriegaedu/following{/other_user}","gists_url":"https://api.github.com/users/noriegaedu/gists{/gist_id}","starred_url":"https://api.github.com/users/noriegaedu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noriegaedu/subscriptions","organizations_url":"https://api.github.com/users/noriegaedu/orgs","repos_url":"https://api.github.com/users/noriegaedu/repos","events_url":"https://api.github.com/users/noriegaedu/events{/privacy}","received_events_url":"https://api.github.com/users/noriegaedu/received_events","type":"User","site_admin":false},"created_at":"2018-06-01T16:40:03Z","updated_at":"2018-06-01T16:40:03Z","author_association":"NONE","body":"It worked. Thank you. "}}
{"actor":{"display_login":"noriegaedu"}}