- Mastering Matplotlib 2.x
- Benjamin Walter Keller
- 374字
- 2021-06-10 19:29:08
Questions to ask when choosing a color map
Different color maps can perform better or worse at conveying metrics, letting the viewer know the value of pixels on the screen, and conveying form—showing how those pixels relate to one another. Whether or not form or metrics or both are important for a given image is really key to deciding what kind of color map to use for that image.
The different questions that can be asked when choosing a color map are as follows:
- Do we need to think whether or not the shape, the value, or-again-both are important for that field?
- Are there critical values or transitions in the data?
- Are there ranges of numbers that really want to pop out to the viewer?
- What is the intuitive choice of colors for the dataset?
For most people, a dataset that conveys temperature should usually have hot red colors to denote high temperatures and cool blue colors to denote cold temperatures; to reverse that would violate the intuitive sense that the viewer has and set up an initial set of stressors in their mind that's going to make interpreting the image harder than it needs to be.
Taking an example, have a look at the color map here, showing population density in the United States:
Using one kind of color map—one that's not perceptually uniform—washes out a lot of the high values. Simply changing it to another different kind of color map that has less high-valued whitish colors at the high end allows you to see more detail in the higher density, more populated eastern parts of the US.
To take a look at all of the color maps that Matplotlib provides, visit the website provided here: http://matplotlib.org/examples/color/colormaps_reference.html. This offers a little swatch of each different color map to give you an idea of what the color map can do in terms of the ranges.
Before we move ahead with the code, we will start by importing the following set of default packages, as shown here:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
# Set up figure size and DPI for screen demo
plt.rcParams['figure.figsize'] = (6,4)
plt.rcParams['figure.dpi'] = 150
- 火格局的時空變異及其在電網(wǎng)防火中的應(yīng)用
- Go Machine Learning Projects
- Cinema 4D R13 Cookbook
- 并行數(shù)據(jù)挖掘及性能優(yōu)化:關(guān)聯(lián)規(guī)則與數(shù)據(jù)相關(guān)性分析
- 讓每張照片都成為佳作的Photoshop后期技法
- Supervised Machine Learning with Python
- PVCBOT機器人控制技術(shù)入門
- Web編程基礎(chǔ)
- Hands-On SAS for Data Analysis
- Learn Microsoft Azure
- FreeCAD [How-to]
- 暗戰(zhàn)強人:黑客及反黑客工具快速精通
- 傳感器技術(shù)及實訓(xùn)(第2版)
- 寫給數(shù)據(jù)產(chǎn)品經(jīng)理新人的工作筆記
- 變化之魅:徹底改造你的Word文檔