Spatial Analysis in 2025: Key Trends Report
| Download Now
CARTO
Platform
Overview
Visualization
Analytics
App Development
Data Enrichment
AI Agents
Enterprise & Security
Pricing
CARTO for
Google Cloud
AWS
Azure
Snowflake
Databricks
Oracle
Solutions
By Industry
By Use Case
By Role
Telecoms
Icon/indus/Insurance-menu
Icon/indus/Insurance-menu-mobile
Insurance
Logistics
Real Estate
Financial Services
Retail
Marketing & Advertising
Mobility
All industries
Network Deployment
Catastrophe Modeling
Fraud Detection
Market Analysis
Environmental Management
Site Selection
Geomarketing
Data Monetization
IoT Analytics
Supply Chain Optimization
Healthcare Analytics
Territory Planning
All use cases
Data Analyst
Data Scientist
GIS Professional
Developer
Customers
Resources
Learn
Documentation
CARTO Academy
Blog
Reports
Glossary
Connect
Events
Partners
Webinars
Log inRequest a demo
Try for free
2050-01-01
1990-01-01
"ES", "GB"

This content applies to a previous version of CARTO

In October 2021 we released a new version of our platform. You can find the latest documentation at docs.carto.com

Back to Help Center

How to visualize more than ten categories

Overview

Category Maps, also called Qualitative Maps, are designed to visualize unique values in a data attribute. For instance, a dataset containing country names treats each unique name as a category. Since no category should appear more important than others, an ideal palette uses swatches with equal visual weight, such as CARTOColor schemes.

When using Style By Value in Builder to create a Category Map, up to 10 categories are given unique colors and the rest are bucketed into an “Other” category and colored gray.

Custom CartoCSS with Repeating Colors

If allowing some categories to share colors is acceptable, custom CartoCSS provides a solution. This approach involves writing conditional CartoCSS that defines specific colors for each category, enabling color reuse across different categories.

#layer {
  polygon-fill: #b3b3b3;

  [name = "Namibia"]{
    polygon-fill: #9eb9f3;
  }
  [name = "Sierra Leone"]{
    polygon-fill: #66c5cc;
  }
  // ... additional rules for each category
}

PostgreSQL Shortcut

A more efficient approach uses PostgreSQL with modulus to group countries and assign colors systematically:

SELECT cartodb_id, the_geom, the_geom_webmercator, name, cartodb_id % 11 as modulus
FROM africa_adm0

Then assign colors to each modulus value (0-10), reducing manual CartoCSS writing considerably.

CARTO VL Ramp

The simplest method uses CARTO VL’s ramp function for automatic color assignment: color: ramp($name, pastel). This automatically detects unique category values and assigns colors without manual intervention.

Aggregating Categories

For datasets with excessive categories, combine them into fewer groups using Builder’s Intersect and Aggregate analysis feature to simplify visualization.

CARTO
carto-logo
  • Platform

  • Overview

  • Visualization

  • Analytics

  • App Development

  • Data Enrichment

  • Security & Governance

  • Gen AI

  • Pricing

  • Solutions

  • Data Analyst

  • Developer

  • Data Scientist

  • GIS Professional

  • By Industry

  • By Use Case

  • Resources

  • Customer Stories

  • Blog

  • Glossary

  • Documentation

  • Academy

  • Reports

  • Events

  • Webinars

  • Partners

  • Company

  • About us

  • Newsroom

  • Careers

  • Brand

  • Grants

Unlock the power of spatial analysis.

youtube logofacebook logotwitter logolinkedin logo

© CARTO 2024

Terms

Privacy Notice

Whistleblower Form