शुरू करेंमुफ़्त में शुरू करें

A first plot

So far, you've read in some spatial files, transformed spatial data to the same projection, and merged a data frame with a spatial object. Time to put your work together and see how your map looks. For each dataset, you need a tm_shape() call to specify the data source, followed by a tm_* layer (like tm_fill(), tm_borders() or tm_bubbles()) to draw on the map.

First, you'll add the neighborhoods and water areas to your plot from the previous exercise.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Visualizing Geospatial Data in R

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Add a layer for the water object with tm_shape(). Then use tm_fill() and set the color to "grey90".
  • Similarly, add a layer for the neighborhoods object. Use tm_borders() to draw the neighborhood outlines.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

library(tmap)

tm_shape(nyc_tracts_merge) +
  tm_fill(col = "estimate") +
  # Add a water layer, tm_fill() with col = "grey90"
  tm_shape(___)             +
  tm_fill(___)              +
  # Add a neighborhood layer, tm_borders()
                            +
  
कोड संपादित करें और चलाएँ