• Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar

Python and R Tips

Learn Data Science with Python and R

  • Home
  • Python
  • Pandas
    • Pandas 101
  • tidyverse
    • tidyverse 101
  • R
  • Linux
  • Conferences
  • Python Books
  • About
    • Privacy Policy
You are here: Home / Python / Matplotlib / Cividis Colormap / Python’s Matplotlib Version 2.2 is here

Python’s Matplotlib Version 2.2 is here

March 8, 2018 by cmdlinetips

Matplotlib Version 2.2
Matplotlib Version 2.2

Matplotlib, the python’s core plotting library, Matplotlib Version 2.2 is available now. The new Matplotlib Version 2.2 has a lot of new things to try including

  • A new method to automatically decide spacing between subplots. In the current version, one typically uses tight_layout method to tighten the spaces around plot objects The new method called by constrained_layout=True is hoping to replace tight_layout method.
  • Pillow, Python Imaging Library can now be used for creating animations. Pillow can support gif (Pillow>=3.4) output format and webp format (Pillow>=5.0)
  • Matplotlib will now support numpy.datetime64 in addition to datetime.datetime. Now you can use numpy.datetime64 anywhere dateime.datetime could be used
  • Matplotlib 2.2 has a new color style supporting colorblind-friendly plots. The new style, tableau-colorblind10, offers another colorblind-friendly plot option in addition to the current ‘seaborn-colorblind’ option.
  • The new version also has a new dark blue/yellow colormap named ‘cividis’. Cividis colormap is not only colorblind friendly and will also look “effectively identical to colorblind and non-colorblind users”

and many more. Check what’s in new in Matplotlib 2.2, https://matplotlib.org/users/whats_new.html.

Happy to announce Matplotlib 2.2.0!

This is the first release of the 2.2LTS series which will get bug-fixes until 2020.

A big thank you to everyone who worked on this!https://t.co/QUGTrqBMLg

— Matplotlib (@matplotlib) March 7, 2018

You can check your current version of Matplotlib using

import matplotlib
matplotlib.__version__

If you are using Anaconda, you can easily upgrade to Matplotlib version 2.2 using

conda update gatplotlib

Let us see examples of using these two new colorblind options in the new Matplotlib version 2.2 using code examples from Matplotlib website.

Cividis: A new Colorblind friendly colormap in Matplotlib 2.2

Let us see the difference between default color map option and the new Cividis colormap that is colorblind friendly.

import matplotlib.pyplot as plt
import numpy as np
np.random.RandomState(42)
fig, ax = plt.subplots()
pcm = ax.pcolormesh(np.random.rand(10,10))
fig.colorbar(pcm)
Default Colormap in Matplotlib 2.2
Default Colormap in Matplotlib 2.2
# initialize random seed
np.random.RandomState(42)
# initialize plot objects
fig, ax = plt.subplots()
# create a 10x10 matrix with random numbers
# and plot heatmap with Cividis colormap
pcm = ax.pcolormesh(np.random.rand(10,10),cmap='cividis')
# plot colorbar on the side
fig.colorbar(pcm)
Colorblind friendly colormap Cividis
Colorblind friendly colormap Cividis

Tableau Colorblind: A new Colorblind friendly color style in Matplotlib 2.2

Here are some examples comparing the new colorblind-friendly color style, tableau-colorblind10, with the existing colorblind-friendly plot option ‘seaborn-colorblind’ and default color style option. We will be looking at three kind of plots to see the differences, including scatter plots, bar chart and histogram. These plots below were generated by using slightly modified version of Matplotlib’s stylesheet reference code available at https://matplotlib.org/gallery/style_sheets/style_sheets_reference.html.

Default color style

Seaborn colorblind-friendly color style

Tableu colorblind-friendly color style

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X

Related posts:

Plot with two different y-axis with twinx in PythonHow to Make a Plot with Two Different Y-axis in Python with Matplotlib ? How To Specify Colors to Scatter Plots in Python Seaborn Version 0.11.0 is HereSeaborn Version 0.11.0 is here with displot, histplot and ecdfplot Default Thumbnailggplot2 Version 3.0.0 Brings Tidy Evaluation to ggplot

Filed Under: Cividis Colormap, Colorblind friendly plots, Matplotlib, Matplotlib Version 2.2, Python Tips Tagged With: Cividis colormap, colorblind friendly colormap, Matplotlib version 2.2.

Primary Sidebar

Subscribe to Python and R Tips and Learn Data Science

Learn Pandas in Python and Tidyverse in R

Tags

Altair Basic NumPy Book Review Data Science Data Science Books Data Science Resources Data Science Roundup Data Visualization Dimensionality Reduction Dropbox Dropbox Free Space Dropbox Tips Emacs Emacs Tips ggplot2 Linux Commands Linux Tips Mac Os X Tips Maximum Likelihood Estimation in R MLE in R NumPy Pandas Pandas 101 Pandas Dataframe Pandas Data Frame pandas groupby() Pandas select columns Pandas select_dtypes Python Python 3 Python Boxplot Python Tips R rstats R Tips Seaborn Seaborn Boxplot Seaborn Catplot Shell Scripting Sparse Matrix in Python tidy evaluation tidyverse tidyverse 101 Vim Vim Tips

RSS RSS

  • How to convert row names to a column in Pandas
  • How to resize an image with PyTorch
  • Fashion-MNIST data from PyTorch
  • Pandas case_when() with multiple examples
  • An Introduction to Statistical Learning: with Applications in Python Is Here
  • 10 Tips to customize ggplot2 title text
  • 8 Plot types with Matplotlib in Python
  • PCA on S&P 500 Stock Return Data
  • Linear Regression with Matrix Decomposition Methods
  • Numpy’s random choice() function

Copyright © 2025 · Lifestyle Pro on Genesis Framework · WordPress · Log in

Go to mobile version