Skip to content

Instantly share code, notes, and snippets.

@michellemho
Created December 20, 2016 23:10
Show Gist options
  • Save michellemho/26ccefe1deb4faffa4d3c669c0f81dee to your computer and use it in GitHub Desktop.
Save michellemho/26ccefe1deb4faffa4d3c669c0f81dee to your computer and use it in GitHub Desktop.
CARTOColor ramp unexpected behavior

Context

Please explain here below what you were doing when the issue happened I was making a choropleth map of the presidential election and noticed that CartoCSS styling was not behaving as expected.

Steps to Reproduce

Please break down here below all the needed steps to reproduce the issue

  1. Create map with this election dataset: https://team.carto.com/u/michellemho-carto/dataset/michellemho-carto.education_by_race_county_copy_copy_2

  2. Style using CartoCSS:

#selector{

  polygon-gamma: 0.4;
  polygon-opacity: 0.9;

  [county_winner = 'dem'] {
  polygon-fill: ramp([pct_dem], (#9CC0E3, #6193C7, #006AAB), equal);
  line-width: 0.25
  }
  [county_winner = 'gop'] {
   polygon-fill: ramp([pct_gop], (#FBD0D0, #E99D99, #CF615D), equal);
      line-width: 0.25
  }

  polygon-fill: #d3d3d3;
}

Current Result

Please describe here below the current result you got There appears to only be two shades of blue and red.

Expected result

Please describe here below what should be the expected behaviour I would like to have three shades of blue and red.

Browser and version

What internet browser (Chrome, Firefox, etc) and version was you using and version Chrome

.carto file

Don't forget to rename .carto file to .zip file to be able to upload to github https://team.carto.com/u/michellemho-carto/builder/e75b77e2-c636-11e6-9e8d-0e3ebc282e83/embed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment