How to Analyze Data: 6 Useful Ways To Use Color In Graphs
[This article was first published on Plotly Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Effectively using color means your graphs clearly communicate your data. This post shows how. We summarize and apply visualization research to real-world examples. You can make graphs like these with Plotly’s web app, or APIs for Python, MATLAB, and R.
For users who want to securely share graphs and data within a team, or create interactive dashboards, contact us about Plotly on-premise. In other Plotly news:
- We’ve released maps for our Python API.
- We’ve released a free version of our JavaScript graphing library.
- Plotly has a brand new R API for interactive plotting and maps.
1. Consider Hue, Value & Saturation
Hue refers to the color’s name (green, red), value is the perceived lightness of the color (dark green, light green), and saturation describes its colorfulness relative to its own brightness. High saturation colors look vivid, while low saturation colors look grayish and muted.
The chart below shows sequential, diverging, and categorial scales. Each is an option to display data about the depth of a lake. The top right option gives us an informative chart and perspective on our sequential data. The darker colors in the middle clearly show where the water is deepest.2. Use Semantic Color Associations
Love is red, nature is green. These semantic color associations pair concepts and colors. To test our associations, the Harvard Business Review used these two graphs and asked which would quickly allow you to tell whether blueberries or bananas sold more. Using semantic color associations–literally making the bars the color of each fruit–decreased the time it took to analyze the chart.
Here they are made in Plotly. Making the plot interactive so you can see data when you hover and labeling the bars makes interpretation even faster.
Color associations can vary by culture. Depending on your audience, colors might suggest concepts, making your graph easier or harder to read.3. One Hue for Continuous Data
But colors don’t intuitively represent values. Does blue represent a larger number than green? Is orange “more” than purple? For example, the map below represents GDP per capita by country using a rainbow color sequence. If I asked whether New Zealand or Australia has a higher GDP per capita, you’d most likely have to check both colors on the legend to know.
Instead, we can represent continuous data and ranges by varying the saturation or value of a color. To do this in Plotly, you can use our color scales, RGB colors like (134,190,229), and hexadecimal color codes like #e6842a. A darker blue in this value scale represents a larger number than a lighter blue.
We can also blend scales. This plot shows net energy imports and exports as a percentage of energy. One hue shows positive values and one represents negative values. You can only use 100% of your energy, but you can export way more than you use.
4. Save High Saturation for the Most Important Data
Contrast draws attention, so having too much contrast will cause clutter. Instead, consider using muted colors as a general rule. Use high contrast colors only for important data. The first graph below doesn’t highlight anything, but muting every color except red allows us to highlight the declining viewership of the Simpsons in the second graph.
5. Use Color Psychology
Colors have a psychological effect. Green is a calming color representing possibility and stability. Red is an exciting color that conveys passion and power. Using color psychology can reinforce your ideas. Visual.ly’s infographic shows more.
PayPal and LinkedIn use blue for trustworthiness. CNN, ESPN and RedBull use a powerful red. British Petroleum has been trying to brand itself as an eco-friendly organization. Hence the use of green.6. Keep It Legible
The higher the luminance contrast between two colors, the more legible it will be. Two different overlapping colors with the same saturation will be hard to distinguish. The green text below has a high saturation and hue contrast with the background, but the portions where the values are similar are still hard to read.
The plot below, made with Plotly’s Python API shows how you can use a gray background to emphasize the green scale for curvature in this Enneper surface.
Using color as a tool can either greatly improve or completely ruin your graph. Follow these guidelines and you’ll be able to optimize the colors in your graph to make your data stand out. If you have sensitive data, need to collaborate with your team, and need interactive dashboards, contact us about Plotly on-premise. If you liked what you read, please consider sharing. Find us at [email protected] and @plotlygraphs.
To leave a comment for the author, please follow the link and comment on their blog: Plotly Blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.