1

I'm trying to map the state of Ohio out in ggplot2 and I would like different variables within a range to the same color. I can do a scale_fill_continuous, but I can't seem to get the range down. Ideally I like to have 0-10 green, 11-20 blue, 21-30 orange and so on.

Here is my code:

ggplot(oh_map, aes(x = long, y = lat)) +
  geom_polygon(aes(fill = wheat_pmt, group = group)) +
  geom_path(aes(group = group)) +
  geom_text(data = cnames, 
            aes(label = paste0("$", round(wheat_pmt, digits = 0)),
                        family="A", fontface="bold", size=4.2)) +
  scale_fill_continuous(low = "white", high = "red", na.value = "black",
                        limit=c(0,34), oob=squish)+
  labs(title = "Ohio Wheat ARC-CO Payments: Program Year 2018", 
       subtitle = "Rounded to Nearest Dollar, adusted for 85% of Base Acres and a 6.8% Government Sequestration", 
       fill = "Dollars per Acre", 
       caption = "Data Source: Author Calculation")+
  theme(axis.line=element_blank(), 
        axis.text.x=element_blank(),  
        axis.text.y=element_blank(),  
        axis.ticks=element_blank(),  
        axis.title.x=element_blank(),  
        axis.title.y=element_blank(),  
        panel.grid.major = element_blank(),  
        panel.grid.minor = element_blank(),  
        panel.border = element_blank(), 
        panel.background = element_blank(), 
        legend.position = "", 
        plot.title = element_text(hjust = 0.5,family="A",face="bold",size = 20.0),  
        plot.subtitle = element_text(hjust = 0.5,family="A",face="bold"))
Z.Lin
  • 28,055
  • 6
  • 54
  • 94
Ben Brown
  • 11
  • 1
  • Ben, it would be much easier to look at your code and help out if you edited your question to format it with newlines, whitespace, and indentation. If you need help, https://stackoverflow.com/editing-help#syntax-highlighting provides good advice. – r2evans Oct 19 '19 at 02:11
  • [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. Right now we can't run your code because we don't have your data, and we can't see any output. – camille Oct 19 '19 at 02:47
  • 1
    If you only want three colors, that sounds like a discrete scale, not a continuous scale. Continuous color/fill scales are gradients. I'd suggest binning your data, and then use `scale_fill_manual`. – Gregor Thomas Oct 19 '19 at 02:51

0 Answers0