0

enter image description here Kindly provide me with some assistance, I'm unable to plot my map as I am unable to identify the longitude and latitude coordinates in my shapefile. Also when I run my code I keep getting this error message. I fairly new to using R so everything is still overwhelming. Attached is my merged data please help me identify these coordinates.

ggplot() +
   geom_polygon(data = merged_data, aes(x = long, y = lat, group = group, fill = Unemployment_Rate)) +
   labs(title = "Unemployment Rates in the U.S. (2015)",
        fill = "Unemployment Rate") +
   scale_fill_gradient(low = "white", high = "red") +
   theme_void()

Error in geom_polygon(): ! Problem while computing aesthetics. ℹ Error occurred in the 1st layer. Caused by error: ! object 'long' not found

Dave2e
  • 22,192
  • 18
  • 42
  • 50
  • 2
    Try: `ggplot() + geom_sf(data= merged_data, aes(fill=Unemployment Rate))` – Dave2e Jun 10 '23 at 04:30
  • Thank you for the suggestion, I tried that and got this error message: Error in `geom_polygon()`: ! Problem while setting up geom. ℹ Error occurred in the 1st layer. Caused by error in `compute_geom_1()`: ! `geom_polygon()` requires the following missing aesthetics: x and y – Anisha Caynes Jun 10 '23 at 11:49
  • Welome to Stackoverflow; Please provide a minimal reproducible example(s) that others can run using copy and paste. Use dput() for data. Don't embed pictures for data or code. [Helpful guidance for asking questions](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Peter Jun 10 '23 at 12:46
  • Use `geom_sf()` not `geom_polygon()`! – Dave2e Jun 10 '23 at 13:24
  • Also, my map seems to be sized too small. Is there a code I can use to increase the size? – Anisha Caynes Jun 10 '23 at 13:49
  • Time to close. No data. Read [MCVE] – IRTFM Jun 11 '23 at 04:54

0 Answers0