You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/ todo: add description how this can be added to the .Renviron / .Rprofile
For this chapter, you will need the following packages and datasets:
```{r}
library(arc2r)
library(sf)
library(raster)
data("gemeinde_zh")
data("swissAlti3D")
As we saw in chapter @ref(importing-vector-sf), we can quickly visualize an sf object by simply calling plot. This will return a small multiple of your geodata, where each facet is colour coded based on a column.
plot(gemeinde_zh)
You will get one facet for each column, where the maximum number of facets is set to 9 by default. I find this behaviour pretty annoying, since I usually just want get a quick look at the data in space, and these small multiples take ages to render. There are several workarounds to prevent small multiples:
Extract the geometry from the sf object and just plot that
Specify the column which should colourcode your data
Specify max.plot = 1 to just plot 1 facet (using the first column in your dataset for colour coding)
Set the option sf_max.plot to 1 with Option(sf_max.plot = 1) (this will persist throughout your R Session)
We dont have the "problem" of facets with raster data, so we can simply call plot() on a raster object to visualize it.
plot(swissAlti3D)
The plot() method is fine for quick view of the data, but as you want to add more layers, legend etc. plot() becomes complicated. There are many alternative methods to visualizing spatial data, we will showcase our favourite methods here.
Package ggplot2
f4a6f112fa74a6a851e4e325c6387bc660524d52
The text was updated successfully, but these errors were encountered:
add description how this can be added to the .Renviron / .Rprofile
book/01_Making_Maps/Static_Maps.Rmd
Line 32 in 055b1a0
As we saw in chapter @ref(importing-vector-sf), we can quickly visualize an
sf
object by simply callingplot
. This will return a small multiple of your geodata, where each facet is colour coded based on a column.You will get one facet for each column, where the maximum number of facets is set to 9 by default. I find this behaviour pretty annoying, since I usually just want get a quick look at the data in space, and these small multiples take ages to render. There are several workarounds to prevent small multiples:
sf
object and just plot thatmax.plot = 1
to just plot 1 facet (using the first column in your dataset for colour coding)sf_max.plot
to 1 withOption(sf_max.plot = 1)
(this will persist throughout yourR
Session)We dont have the "problem" of facets with raster data, so we can simply call
plot()
on a raster object to visualize it.The
plot()
method is fine for quick view of the data, but as you want to add more layers, legend etc.plot()
becomes complicated. There are many alternative methods to visualizing spatial data, we will showcase our favourite methods here.Package
ggplot2
The text was updated successfully, but these errors were encountered: