{"id":5913,"date":"2020-12-09T14:59:55","date_gmt":"2020-12-09T09:29:55","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/?p=5913"},"modified":"2024-01-01T14:36:28","modified_gmt":"2024-01-01T09:06:28","slug":"matplotlib-cmap","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/","title":{"rendered":"Matplotlib Cmap With Its Implementation In Python"},"content":{"rendered":"\n<p>Hello programmers, we will discuss the Matplotlib cmap() in Python. First,&nbsp;the <a href=\"https:\/\/matplotlib.org\/3.1.0\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">Matplotlib<\/a>&nbsp;library has several built-in colormaps available via the cmap() function. Pyplot module of the Matplotlib library provides a MATLAB-like interface. Moreover, it helps to plot lines, contours, Histogram, bars, Scatter plots, 3D plots, etc.<\/p>\n\n\n\n<p>The set_cmap() function in the pyplot module of the matplotlib library is used to set the default colormap that applies to the current image. In addition, colormaps are often split into several categories based on their function &#8211; sequential, diverging, qualitative, and cyclic. Before we cite examples of Matplotlib cmap(), let me briefly brief you about the function&#8217;s syntax and return type.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Syntax_of_Matplotlib_cmap\" title=\"Syntax of Matplotlib cmap\">Syntax of Matplotlib cmap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Parameters\" title=\"Parameters\">Parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Return_Type\" title=\"Return Type\">Return Type<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Example_of_Matplotlib_cmap_in_Python\" title=\"Example of Matplotlib cmap() in Python\">Example of Matplotlib cmap() in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Sequential_Colormaps\" title=\"Sequential Colormaps\">Sequential Colormaps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Diverging_Matplotlib_cmap\" title=\"Diverging Matplotlib cmap()\">Diverging Matplotlib cmap()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Cyclic_Matplotlib_cmap\" title=\"Cyclic Matplotlib cmap()\">Cyclic Matplotlib cmap()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Qualitatve_Matplotlib_cmap\" title=\"Qualitatve Matplotlib cmap()\">Qualitatve Matplotlib cmap()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Miscellaneous_Matplotlib_cmap\" title=\"Miscellaneous Matplotlib cmap()\">Miscellaneous Matplotlib cmap()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Matplotlib_Colormap_Alpha\" title=\"Matplotlib Colormap Alpha\">Matplotlib Colormap Alpha<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Matplotlib_Cmap_Invert\" title=\"Matplotlib Cmap Invert\">Matplotlib Cmap Invert<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Matplotlib_Cmap_Transparent\" title=\"Matplotlib Cmap Transparent\">Matplotlib Cmap Transparent<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#FAQs\" title=\"FAQs\">FAQs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-syntax-of-matplotlib-cmap\"><span class=\"ez-toc-section\" id=\"Syntax_of_Matplotlib_cmap\"><\/span>Syntax of Matplotlib cmap<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>syntax: <\/strong>matplotlib.pyplot.set_cmap(cmap)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-parameters\"><span class=\"ez-toc-section\" id=\"Parameters\"><\/span>Parameters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>cmap:<\/strong> This cmap parameter is the colormap instance or the name of a registered colormap.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-return-type\"><span class=\"ez-toc-section\" id=\"Return_Type\"><\/span>Return Type<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Returns:<\/strong> This method does not return any value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-of-matplotlib-cmap-in-python\"><span class=\"ez-toc-section\" id=\"Example_of_Matplotlib_cmap_in_Python\"><\/span>Example of Matplotlib cmap() in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt \nimport numpy as np \nfrom matplotlib.colors import LogNorm \n      \ndx, dy = 0.015, 0.05\nx = np.arange(-4.0, 4.0, dx) \ny = np.arange(-4.0, 4.0, dy) \nX, Y = np.meshgrid(x, y) \n   \nextent = np.min(x), np.max(x), np.min(y), np.max(y) \n    \n  \nZ1 = np.add.outer(range(8), range(8)) % 2\nplt.imshow(Z1, cmap =&quot;binary_r&quot;,  \n           interpolation ='nearest', \n           extent = extent, alpha = 1) \n   \ndef abc(x, y): \n    return (1 - x \/ 2 + x**5 + y**6) * np.exp(-(x**2 + y**2)) \n   \nZ2 = abc(X, Y) \n   \nplt.imshow(Z2, alpha = 0.7, \n           interpolation ='bilinear', \n           extent = extent) \n  \nplt.set_cmap(&quot;gist_rainbow&quot;) \nplt.title('matplotlib.pyplot.set_cmap() Example') \nplt.show() \n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"350\" height=\"306\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-24.png\" alt=\"example of cmap()\" class=\"wp-image-5914\" style=\"width:355px;height:310px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-24.png 350w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-24-300x262.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-24-150x131.png 150w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Firstly, in the above example, a colormap is the plot created using set_cmap() method. This default colormap passed as an argument to the Matplotlib cmap() function applies to the current image. Finally, the &#8216;gist_rainbow &#8216; passed to the cmap() function is a colormap instance of the LogNorm module imported from the Matplotlib.colors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-sequential-colormaps\"><span class=\"ez-toc-section\" id=\"Sequential_Colormaps\"><\/span>Sequential Colormaps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncmaps&#x5B;'Perceptually Uniform Sequential'] = &#x5B;\n            'viridis', 'plasma', 'inferno', 'magma', 'cividis']\n\ncmaps&#x5B;'Sequential'] = &#x5B;\n            'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',\n            'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',\n            'GnBu', 'PuBu']\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"611\" height=\"173\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-25.png\" alt=\"Perpetually Uniform and sequential colormaps\" class=\"wp-image-5917\" style=\"width:591px;height:167px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-25.png 611w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-25-300x85.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-25-150x42.png 150w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"716\" height=\"413\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-26.png\" alt=\"Sequential colormaps\" class=\"wp-image-5918\" style=\"width:636px;height:367px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-26.png 716w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-26-300x173.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-26-150x87.png 150w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation-1\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Sequential cmaps() change in lightness and often saturation of color incrementally, often using a single hue. They are used for representing information that has order. Perpetual Uniform colormaps represent monotonically increasing lightness. And Sequential colormaps represent a change in a hue like &#8216;YlOrBr&#8217; changes the shad of hue from Yellow to Orange to Brown. However, Perpetually Uniform colormaps are better than over sequential colormaps. Researchers have found that the human brain perceives changes in the lightness parameter as changes in <a href=\"https:\/\/www.pythonpool.com\/matplotlib-heatmap\/\" target=\"_blank\" rel=\"noreferrer noopener\">data visualization<\/a> much better than changes in hue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-diverging-matplotlib-cmap\"><span class=\"ez-toc-section\" id=\"Diverging_Matplotlib_cmap\"><\/span>Diverging Matplotlib cmap()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncmaps&#x5B;'Diverging'] = &#x5B;\n            'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',\n            'RdYlBu', 'RdYlGn', 'Spectral']\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"660\" height=\"269\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-27.png\" alt=\"diverging Matplotlib cmap() in Python\" class=\"wp-image-5919\" style=\"width:642px;height:262px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-27.png 660w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-27-300x122.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-27-150x61.png 150w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation-2\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Matplotlib Diverging colormaps represent a change in lightness and possibly saturation of two different colors that meet in the middle at an unsaturated color. Used in python programs where the information has a critical middle value, such as topography or when the data deviates around zero. We need a monotonically increasing value of a hue followed by a decreasing value of the another for diverging colormaps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cyclic-matplotlib-cmap\"><span class=\"ez-toc-section\" id=\"Cyclic_Matplotlib_cmap\"><\/span>Cyclic Matplotlib cmap()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncmaps&#x5B;'Cyclic'] = &#x5B;'twilight', 'twilight_shifted', 'hsv']\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"636\" height=\"123\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-28.png\" alt=\"cyclic matplotlib cmap() \" class=\"wp-image-5920\" style=\"width:619px;height:120px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-28.png 636w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-28-300x58.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-28-150x29.png 150w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation-3\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Cyclic cmap() in Python represents a change in the lightness of two different colors that meet in the middle and beginning\/end at an unsaturated color. These cyclic cmaps should be used for values that wrap around at the endpoints, such as phase angle, wind direction, or time of day.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-qualitatve-matplotlib-cmap\"><span class=\"ez-toc-section\" id=\"Qualitatve_Matplotlib_cmap\"><\/span>Qualitatve Matplotlib cmap()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncmaps&#x5B;'Qualitative'] = &#x5B;'Pastel1', 'Pastel2', 'Paired', 'Accent',\n                        'Dark2', 'Set1', 'Set2', 'Set3']\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" width=\"673\" height=\"255\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-29.png\" alt=\"Qualitative Matlotlib cmap()\" class=\"wp-image-5921\" style=\"width:568px;height:215px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-29.png 673w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-29-300x114.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/image-29-150x57.png 150w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation-4\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Qualitative colormaps are often are miscellaneous colors. Moreover, they should be used to represent information that does not have ordering or relationships.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-miscellaneous-matplotlib-cmap\"><span class=\"ez-toc-section\" id=\"Miscellaneous_Matplotlib_cmap\"><\/span>Miscellaneous Matplotlib cmap()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncmaps&#x5B;'Qualitative'] = &#x5B;'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',\n            'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg',\n            'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar']\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"829\" height=\"558\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/miscellaneious-colormaps.png\" alt=\"Miscellaneous Matplotlib cmap\" class=\"wp-image-8635\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/miscellaneious-colormaps.png 829w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/miscellaneious-colormaps-300x202.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/02\/miscellaneious-colormaps-768x517.png 768w\" sizes=\"(max-width: 829px) 100vw, 829px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-explanation-5\"><strong>Explanation:<\/strong><\/h3>\n\n\n\n<p>Miscellaneous colormaps allow you to create gradients and other interesting color palettes in Matplotlib. In addition, each of these strings are included in the code above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Matplotlib_Colormap_Alpha\"><\/span>Matplotlib Colormap Alpha<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To specify values of alpha in colormap so that the colormap is not transparent, use the given syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>alphas = np.linspace(0, 1, cmap.N)<\/code><\/pre>\n\n\n\n<p>This will provide you with alphas in the given range and then inculcate it in your colormap. The range of alpha is from 0 to 1 here.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmatplotlib colormap as list\ncolors =&#x5B; &quot;orange&quot;, &quot;blue&quot;, &quot;red&quot;]\ncmap = matplotlib.colors.ListedColormap(colors)\n<\/pre><\/div>\n\n\n<p>You may use this to make a colormap from a list of colors. The ListedColormap changes colors in RGBA values. It will result in colormap objects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Matplotlib_Cmap_Invert\"><\/span>Matplotlib Cmap Invert<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To invert the spectrum, go for the given syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Newcmap= matplotlib.cm.get_cmap('colormap title_r')<\/code><\/pre>\n\n\n\n<p>The &#8216;_r&#8217; reverses the order in which colors appear in colormap.<\/p>\n\n\n\n<p>reversed() function will also give similar results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Matplotlib_Cmap_Transparent\"><\/span>Matplotlib Cmap Transparent<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can set the alpha value to adjust transparency in cmap.<\/p>\n\n\n\n<p>Use linspace for the same:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>np.linspace(0, 1, cmap.N)<\/code><\/pre>\n\n\n\n<p>Or set the alpha value as 0 or 1 or between 0 and 1.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1682871238233\"><strong class=\"schema-faq-question\">What is the default CMAP in matplotlib?<\/strong> <p class=\"schema-faq-answer\">viridis is the default colormap available in matplotlib.\u00a0<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1682871251117\"><strong class=\"schema-faq-question\">How to use the color map in matplotlib?<\/strong> <p class=\"schema-faq-answer\">Functions like get_cmap and set_cmap provide better visualization of data using colormaps. You can change a plot to colormap using these functions and then use show() function to see the output.\u00a0<br\/>Example:<br\/>cmap = plt.get_cmap(&#8216;hot&#8217;)<br\/>plt.set_cmap(cmap) <\/p> <\/div> <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We learned about cmap() in python and its examples and discussed different ways of implementing colormaps in Python programs depending on the purpose. We also focused on the Qualitative, i.e., a miscellaneous case of Colormap implementation. Refer to this article in case of any queries regarding the Matplotlib cmap() function.<\/p>\n\n\n\n<p>However, please let me know in the comment section below if you have any questions. I will try to help you as soon as possible.<\/p>\n\n\n\n<p><strong><em>Happy Pythoning!<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello programmers, we will discuss the Matplotlib cmap() in Python. First,&nbsp;the Matplotlib&nbsp;library has several built-in colormaps available via the cmap() function. Pyplot module of the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Matplotlib Cmap With Its Implementation In Python\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#more-5913\" aria-label=\"More on Matplotlib Cmap With Its Implementation In Python\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":5969,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2071],"tags":[2649,2657,2651,2658,2655,2654,2648],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Matplotlib Cmap With Its Implementation In Python - Python Pool<\/title>\n<meta name=\"description\" content=\"Examples and Implementations of Matplotlib cmap() in Python along with sequential, diverging, cyclic, and miscellaneous colormaps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Matplotlib Cmap With Its Implementation In Python\" \/>\n<meta property=\"og:description\" content=\"Hello programmers, we will discuss the Matplotlib cmap() in Python. First,&nbsp;the Matplotlib&nbsp;library has several built-in colormaps available via\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-09T09:29:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-01T09:06:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Python Pool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Python Pool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\"},\"author\":{\"name\":\"Python Pool\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\"},\"headline\":\"Matplotlib Cmap With Its Implementation In Python\",\"datePublished\":\"2020-12-09T09:29:55+00:00\",\"dateModified\":\"2024-01-01T09:06:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\"},\"wordCount\":767,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png\",\"keywords\":[\"cmap colors matplotlib\",\"matplotlib cmap colors\",\"matplotlib cmap gray\",\"matplotlib cmap options\",\"matplotlib imshow cmap\",\"matplotlib scatter cmap\",\"python matplotlib cmap\"],\"articleSection\":[\"Matplotlib\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\",\"url\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\",\"name\":\"Matplotlib Cmap With Its Implementation In Python - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png\",\"datePublished\":\"2020-12-09T09:29:55+00:00\",\"dateModified\":\"2024-01-01T09:06:28+00:00\",\"description\":\"Examples and Implementations of Matplotlib cmap() in Python along with sequential, diverging, cyclic, and miscellaneous colormaps.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233\"},{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png\",\"width\":1350,\"height\":650,\"caption\":\"Matplotlib Cmap\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Matplotlib Cmap With Its Implementation In Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\",\"name\":\"Python Pool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"caption\":\"Python Pool\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233\",\"position\":1,\"url\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233\",\"name\":\"What is the default CMAP in matplotlib?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"viridis is the default colormap available in matplotlib.\u00a0\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117\",\"position\":2,\"url\":\"https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117\",\"name\":\"How to use the color map in matplotlib?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Functions like get_cmap and set_cmap provide better visualization of data using colormaps. You can change a plot to colormap using these functions and then use show() function to see the output.\u00a0<br\/>Example:<br\/>cmap = plt.get_cmap('hot')<br\/>plt.set_cmap(cmap) \",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Matplotlib Cmap With Its Implementation In Python - Python Pool","description":"Examples and Implementations of Matplotlib cmap() in Python along with sequential, diverging, cyclic, and miscellaneous colormaps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/","og_locale":"en_US","og_type":"article","og_title":"Matplotlib Cmap With Its Implementation In Python","og_description":"Hello programmers, we will discuss the Matplotlib cmap() in Python. First,&nbsp;the Matplotlib&nbsp;library has several built-in colormaps available via","og_url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/","og_site_name":"Python Pool","article_published_time":"2020-12-09T09:29:55+00:00","article_modified_time":"2024-01-01T09:06:28+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png","type":"image\/png"}],"author":"Python Pool","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Python Pool","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/"},"author":{"name":"Python Pool","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998"},"headline":"Matplotlib Cmap With Its Implementation In Python","datePublished":"2020-12-09T09:29:55+00:00","dateModified":"2024-01-01T09:06:28+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/"},"wordCount":767,"commentCount":0,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png","keywords":["cmap colors matplotlib","matplotlib cmap colors","matplotlib cmap gray","matplotlib cmap options","matplotlib imshow cmap","matplotlib scatter cmap","python matplotlib cmap"],"articleSection":["Matplotlib"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/","name":"Matplotlib Cmap With Its Implementation In Python - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png","datePublished":"2020-12-09T09:29:55+00:00","dateModified":"2024-01-01T09:06:28+00:00","description":"Examples and Implementations of Matplotlib cmap() in Python along with sequential, diverging, cyclic, and miscellaneous colormaps.","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233"},{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/12\/Theatre-Actor-Portfolio-Website-9.png","width":1350,"height":650,"caption":"Matplotlib Cmap"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Matplotlib Cmap With Its Implementation In Python"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998","name":"Python Pool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","caption":"Python Pool"}},{"@type":"Question","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233","position":1,"url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871238233","name":"What is the default CMAP in matplotlib?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"viridis is the default colormap available in matplotlib.\u00a0","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117","position":2,"url":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/matplotlib-cmap\/#faq-question-1682871251117","name":"How to use the color map in matplotlib?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Functions like get_cmap and set_cmap provide better visualization of data using colormaps. You can change a plot to colormap using these functions and then use show() function to see the output.\u00a0<br\/>Example:<br\/>cmap = plt.get_cmap('hot')<br\/>plt.set_cmap(cmap) ","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5913"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=5913"}],"version-history":[{"count":21,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5913\/revisions"}],"predecessor-version":[{"id":31534,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/5913\/revisions\/31534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/5969"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=5913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=5913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=5913"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926031658\/https:\/\/api.w.org\/{rel}","templated":true}]}}