Matplotlib.colors.LogNorm class in Python
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack.
The matplotlib.colors.LogNorm() class belongs to the matplotlib.colors module. The matplotlib.colors module is used for converting color or numbers arguments to RGBA or RGB.This module is used for mapping numbers to colors or color specification conversion in a 1-D array of colors also known as colormap.
The matplotlib.colors.LogNorm class is used to normalize a value to the range of 0-1 on a log scale. If vmax or vmin is not set, they are initialized from the maximum and minimum value of the first input processed respectively. This means
__call__(A) calls autoscale_None(A). If the clip is set to True and the value given falls outside range, the value returned is 0 or 1, whichever is closest. If vmin==vmax than it returns 0. It works with arrays or scalars that also includes masked arrays. If the clip is set True the masked values are set to else they remain masked. The default of the clip is set to False.
Methods of the class:
- autoscale(self, A): It is used to set the vmax, vmin to maximum and minimum of A respectively.
- autoscale_None(self, A): It is used to autoscale only the none-valued vmin or vmax.
- inverse(self, value): It returns reversed value of the colormap.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course