How do I assign polygon colors in CARTO based on whether it is a positive or negative number? For example, I want the range of negatives to be one color, and the range of positives another, with a gradient in each.


Are you making your map in Builder? If so you can use Style By Value with one of the default diverging color schemes.

If that's not what you need you can make your own bin breaks instead. To do that set Builder's STYLE panel toggle to CartoCSS and write your own conditional CartoCSS code or write your own TurboCARTO code there.

  • The diverging color scheme doesn't allow me to set zero as the defining separator. Sadly, I cannot figure out how to write code that sets zero as the defining middle of the colors, either. I've never written CSS, so I need more guidance than the references have. Ugh. Sorry. Any ideas where to look? – Michelle Jan 15 '19 at 21:01
  • Example in this question: stackoverflow.com/questions/32848253/…. The conditions are in brackets. Each bracket & it's code block = one choropleth bin, plus technically the 1st code block is a bin also. You can create conditions using operators, ie >0. Bottom conditions override top ones. – Steph Jan 15 '19 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.