0

Using CARTO VL (which is awesome by the way), I have made the following groundwater harvest potential map that is styled using 10 quantiles.

enter image description here

Although the "temps" palette works well, is it possible to reverse the colors? I read a thread on GitHub that mentioned using "inverse" like this:

color: ramp(globalQuantiles($sa_m3_km2, 10), inverse(temps))

But this have never worked for me. Is inverting a quantile palette possible?

3

Yes, it is possible by using the reverse expression. Using the code from your example, it would be:

color: ramp(globalQuantiles($sa_m3_km2, 10), reverse(temps))

You can find more about this expression in our documentation: https://carto.com/developers/carto-vl/reference/#cartoexpressionsreverse

And an example from the reference using the JavaScript API:

const s = carto.expressions;
const viz = new carto.Viz({
  color: s.ramp(s.prop('type'), s.reverse(s.palettes.PRISM));
});
New contributor
Elena Torró is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    Thanks Elena, much appreciated. – JohnGIS Feb 11 at 11:39
  • You're welcome! Thanks for asking :) – Elena Torró Feb 12 at 14:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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