Modifying map colors
ggplot2 version 3.0 integrated the viridis color palettes, which are perceptually uniform and legible to colorblind individuals and in black and white. For these reasons, the viridis palettes have become very popular for data visualization, including for choropleth mapping. In this exercise, you'll learn how to use the viridis palettes for choropleth mapping in ggplot2.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Analyzing US Census Data in R
คำแนะนำการฝึกหัด
- Set a color aesthetic to align the color palettes of the tract fills and tract boundaries.
- Use
scale_fill_viridis_c()to request a continuous viridis palette for the tract fill. - Use
scale_color_viridis_c()to request a continuous viridis palette for the tract borders.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Set continuous viridis palettes for your map
ggplot(___, aes(fill = ___, ___ = estimate)) +
geom_sf() +
___() +
___()