{"id":3887,"date":"2020-08-19T17:25:31","date_gmt":"2020-08-19T11:55:31","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=3887"},"modified":"2024-01-01T14:52:33","modified_gmt":"2024-01-01T09:22:33","slug":"matplotlib-imshow","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/","title":{"rendered":"How to Display Images Using Matplotlib Imshow Function"},"content":{"rendered":"\n<p>Do you know that images are represented in the <strong>form of numbers<\/strong> in computer programming? Any of the operations that we perform on an image using programming languages, we perform on the arrays of numbers. We can also <strong>visualize those images using the imshow function of the matplotlib <\/strong>library. <strong><em>Matplotlib is a library in python that is built over the numpy library and is used to represent different plots, graphs, and images using numbers.<\/em><\/strong><\/p>\n\n\n\n<p><strong>The basic function of Matplotlib Imshow is to show the image object. As Matplotlib is generally used for data visualization, images can be a part of data, and to check it, we can use imshow. Moreover, the imshow method is also famous for the OpenCV module to show the images.<\/strong><\/p>\n\n\n\n<p><strong>GreyScale images can be visualized using a 2-Dimensional array<\/strong>, and colored images are displayed using a 3-Dimensional array. Using <em>Matplotlib, <\/em>we can represent both colored and black and white images. We can also perform many different operations on the image using the variety of parameters of the imshow function. Let us study everything in detail.&nbsp;<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 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\" style=\"cursor:inherit\">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-imshow\/#Syntax_of_Matplotlib_Imshow\" >Syntax of Matplotlib Imshow&nbsp;<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#Parameters\" >Parameters-&nbsp;&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#Return_Type\" >Return Type-&nbsp;<\/a><\/li><\/ul><\/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-imshow\/#Using_the_Matplotlib_Imshow_Function\" >Using the Matplotlib Imshow Function<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#Creating_a_chessboard\" >Creating a chessboard&nbsp;&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#Displaying_a_cat_using_Matplotlib_imshow\" >Displaying a cat using Matplotlib imshow<\/a><\/li><\/ul><\/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-imshow\/#Must_Read\" >Must Read:<\/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-imshow\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-syntax-of-matplotlib-imshow\"><span class=\"ez-toc-section\" id=\"Syntax_of_Matplotlib_Imshow\"><\/span>Syntax of Matplotlib Imshow&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To use the matplotlib library, we first need to install matplotlib using \u2013<strong> pip install matplotlib.<\/strong> We then need to import the submodule <em>pyplot<\/em>, which contains the imshow function.&nbsp;&nbsp;<\/p>\n\n\n\n<p>After you have successfully installed matplotlib library, use the below code to use the imshow function.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">plt.imshow(X,&nbsp;cmap=None,&nbsp;norm=None,&nbsp;aspect=None,&nbsp;interpolation=None, alpha=None, vmin=None, vmax=None,&nbsp;origin=None,&nbsp;extent=None)&nbsp;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-parameters\"><span class=\"ez-toc-section\" id=\"Parameters\"><\/span>Parameters-&nbsp;&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>X<\/strong> \u2013 It is the data that we want to display using imshow. This can be in the form of lists or array. For <em>Grey images, it is a 2-D array, <\/em>and for colored images, we use 3-D images. <strong>Every element in the array acts as a pixel.&nbsp;<\/strong><\/p>\n\n\n\n<p><strong>Cmap<\/strong>&#8211; This parameter is used to <strong>give colors to non-colored images<\/strong>. We can pass any of the below values as the argument for this parameter. If the image is already colored, the cmap parameter is ignored.&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"268\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-393-1024x268.png\" alt=\"cmap parameter is ignored\" class=\"wp-image-3894\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-393-1024x268.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-393-300x79.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-393-768x201.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-393.png 1107w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Norm<\/strong>&#8211; This parameter is used to normalize the color values from<em><strong> 0.0 to 1.0<\/strong><\/em>. This is ignored in the case of colored images.&nbsp;<\/p>\n\n\n\n<p><strong>Aspect <\/strong>\u2013 This parameter is used to adjust the size of images. There are two options for arguments \u2013 <strong>auto and equal<\/strong>. We will better understand when we look at an example.&nbsp;<\/p>\n\n\n\n<p><strong>Alpha<\/strong>&#8211; If we want to change the transparency of the image, we can use this parameter. For <strong>opaque image, use \u20181\u2019 <\/strong>as the argument for this parameter. And for a <strong>completely transparent image, use 0.<\/strong> The range is 0-1.&nbsp;<\/p>\n\n\n\n<p><strong>Origin<\/strong>&#8211; If we want to change the origin ((0,0)) from upper to lower, we can set the value of origin parameter as <strong>\u2018lower.\u2019&nbsp;<\/strong><\/p>\n\n\n\n<p>There are many more parameters in imshow, but these are the most important ones.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-return-type\"><span class=\"ez-toc-section\" id=\"Return_Type\"><\/span>Return Type-&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong><em>`~matplotlib.image.AxesImage`&nbsp;<\/em><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-using-the-matplotlib-imshow-function\"><span class=\"ez-toc-section\" id=\"Using_the_Matplotlib_Imshow_Function\"><\/span>Using the Matplotlib Imshow Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before directly jumping into displaying some already existing images, let us see how we can create our images using <em>numpy array<\/em> and display it using imshow function.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-creating-a-chessboard\"><span class=\"ez-toc-section\" id=\"Creating_a_chessboard\"><\/span>Creating a chessboard&nbsp;&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We know that the chessboard is an <strong>8&#215;8 matrix<\/strong> with only two colors i.e., white and black. So, let us use numpy to create a numpy array consisting of two numbers 0 and 1. In programming, one is used <strong>for bright color, and 0 is used for dark\/dull colors.&nbsp;<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# create a 8x8 matrix of two numbers-0 and 1. \n# O represents dark color and 1 represents bright color \narr=np.array(&#x5B;&#x5B;1,0]*4,&#x5B;0,1]*4]*4)\nprint(arr)\n# use the imshow function to display the image made from the above array\nplt.imshow(arr)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-\n[[1 0 1 0 1 0 1 0]\n [0 1 0 1 0 1 0 1]\n [1 0 1 0 1 0 1 0]\n [0 1 0 1 0 1 0 1]\n [1 0 1 0 1 0 1 0]\n [0 1 0 1 0 1 0 1]\n [1 0 1 0 1 0 1 0]\n [0 1 0 1 0 1 0 1]]<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"245\" height=\"248\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/colored_chessboard.png\" alt=\"matplotlib imshow\" class=\"wp-image-3888\"\/><\/figure><\/div>\n\n\n<p>As we can see that we have got the desired matrix, but the colors are not adequate. Also, we know that to color a 2-d array, we use the <a href=\"http:\/\/www.pythonpool.com\/matplotlib-cmap\/\" target=\"_blank\" rel=\"noreferrer noopener\">cmap<\/a> parameter.&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\narr=np.array(&#x5B;&#x5B;1,0]*4,&#x5B;0,1]*4]*4)\n# use the 'gray' argument in cmap argument to make the image black and white\nplt.imshow(arr,cmap=&quot;gray&quot;)\n<\/pre><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"245\" height=\"248\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/bw_chessboard.png\" alt=\"matplotlib imshow\" class=\"wp-image-3889\"\/><\/figure><\/div>\n\n\n<p>One more important thing about this method is that the origin starts at the top left corner. We can change it using the &#8216;origin&#8217; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Parameter_(computer_programming)\" target=\"_blank\" rel=\"noreferrer noopener\">parameter<\/a>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\narr=np.array(&#x5B;&#x5B;1,0]*4,&#x5B;0,1]*4]*4)\n# to change the origin of the image from upper left to lower left,\n# use the origin parameter.\nplt.imshow(arr,origin=&quot;lower&quot;,cmap=&quot;gray&quot;)\n<\/pre><\/div>\n\n\n<p>&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"245\" height=\"248\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/cb.png\" alt=\"matplotlib imshow\" class=\"wp-image-3890\"\/><\/figure><\/div>\n\n\n<p>We can clearly observe the change between the above two images. Now the origin starts from lower left. <\/p>\n\n\n\n<p>Let us now show an already existing image using imshow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-displaying-a-cat-using-matplotlib-imshow\"><span class=\"ez-toc-section\" id=\"Displaying_a_cat_using_Matplotlib_imshow\"><\/span>Displaying a cat using Matplotlib imshow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Let us now see how we can display the following cat using the imshow function. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"682\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3-1024x682.jpeg\" alt=\"Displaying a cat using Matplotlib imshow\" class=\"wp-image-3891\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3-1024x682.jpeg 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3-300x200.jpeg 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3-768x512.jpeg 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3-1536x1024.jpeg 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/3.jpeg 1880w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>For displaying this image, we first need to read this image using the <a href=\"http:\/\/www.pythonpool.com\/matplotlib-imread\/\" target=\"_blank\" rel=\"noreferrer noopener\">imread<\/a> function of <strong>matplotlib.pyplo<\/strong>t library. <\/p>\n\n\n\n<p>We have to give the path of this image to the imread function. I am working in the same location where the image is present, so I can just write the name of the image along with its extension.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt\n# read the image in \nphoto=plt.imread(&quot;cat_image.jpeg&quot;)\n#lET US SEE THE SHAPE OF THE IMAGE.\nprint(photo.shape)\nplt.imshow(photo)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">(1253, 1880, 3)<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"439\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-392-1024x439.png\" alt=\"matplotlib imshow\" class=\"wp-image-3892\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-392-1024x439.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-392-300x129.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-392-768x329.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Screenshot-392.png 1171w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p> As we know that colored images are stored in a 3-d array (the third dimension represents RGB( Red, Green, Blue) colors). <\/p>\n\n\n\n<p> We can make this image more or less transparent using the alpha parameter.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport matplotlib.pyplot as plt\n# read the image in \nphoto=plt.imread(&quot;cat_image.jpeg&quot;)\n# set the transparency to 0.5\nplt.imshow(photo,alpha=0.5)\n<\/pre><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"373\" height=\"252\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/image-5.png\" alt=\"matplotlib imshow\" class=\"wp-image-3893\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/image-5.png 373w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/image-5-300x203.png 300w\" sizes=\"(max-width: 373px) 100vw, 373px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading has-vivid-red-color has-text-color\" id=\"h-must-read\"><span class=\"ez-toc-section\" id=\"Must_Read\"><\/span>Must Read:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"http:\/\/www.pythonpool.com\/python-lowercase\/\">How to Convert String to Lowercase in<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/www.pythonpool.com\/square-root-in-python\/\">How to Calculate Square Root<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/www.pythonpool.com\/python-user-input\/\">User Input | Input () Function | Keyboard Input<\/a><\/li>\n\n\n\n<li><a href=\"http:\/\/www.pythonpool.com\/python-book\/\">Best Book to Learn Python<\/a><\/li>\n<\/ul>\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 have studied how to show the images using a <strong>matplotlib imshow function<\/strong>. We have made changes in the image using various parameters available. You can be more creative and use these concepts to create more cool images.<\/p>\n\n\n\n<p><em>Try to run the programs on your side and let us know if you have any queries.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you know that images are represented in the form of numbers in computer programming? Any of the operations that we perform on an image &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Display Images Using Matplotlib Imshow Function\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#more-3887\" aria-label=\"More on How to Display Images Using Matplotlib Imshow Function\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":3900,"comment_status":"open","ping_status":"open","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":[2059,2054,2048,2051,2052,2049,2058,2057,2068,2050,2053,2065,2069,2056,2064,2067,2066,2070,2063,2047,2055,2062,2061,2060],"class_list":["post-3887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-matplotlib","tag-fft-power-spectrum-matplotlib-heatmap","tag-heatmap-in-matplotlib","tag-heatmap-matplotlib","tag-heatmap-python-matplotlib","tag-matplotlib-3d-heatmap","tag-matplotlib-heatmap","tag-matplotlib-heatmap-color-scale-white-at-0","tag-matplotlib-heatmap-colorbar","tag-matplotlib-heatmap-colorbar-title","tag-matplotlib-heatmap-colors","tag-matplotlib-heatmap-example","tag-matplotlib-heatmap-with-values","tag-matplotlib-heatmap-xyc","tag-matplotlib-lat-long-heatmap","tag-matplotlib-pyplot-2-dimensional-heatmap-color-and-shade","tag-matplotlib-us-maps-heatmap","tag-max-number-of-values-in-heatmap-matplotlib","tag-pandas-heatmap-matplotlib","tag-pyplot-heatmap-sharper-borders-matplotlib-1-5","tag-python-heatmap-matplotlib","tag-python-matplotlib-heatmap","tag-python-matplotlib-heatmap-colorbar","tag-subplots-heatmap-spacing-matplotlib","tag-using-matplotlib-cursor-with-heatmap","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Display Images Using Matplotlib Imshow Function - Python Pool<\/title>\n<meta name=\"description\" content=\"In computer science, the images are represented in the form of arrays of numbers. To display it, use the matplotlib imshow function.\" \/>\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-imshow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Display Images Using Matplotlib Imshow Function\" \/>\n<meta property=\"og:description\" content=\"Do you know that images are represented in the form of numbers in computer programming? Any of the operations that we perform on an image using\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-19T11:55:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-01T09:22:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.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=\"Ashwini Mandani\" \/>\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=\"Ashwini Mandani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\"},\"author\":{\"name\":\"Ashwini Mandani\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056\"},\"headline\":\"How to Display Images Using Matplotlib Imshow Function\",\"datePublished\":\"2020-08-19T11:55:31+00:00\",\"dateModified\":\"2024-01-01T09:22:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\"},\"wordCount\":832,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png\",\"keywords\":[\"fft power spectrum matplotlib heatmap\",\"heatmap in matplotlib\",\"heatmap matplotlib\",\"heatmap python matplotlib\",\"matplotlib 3d heatmap\",\"matplotlib heatmap\",\"matplotlib heatmap color scale white at 0\",\"matplotlib heatmap colorbar\",\"matplotlib heatmap colorbar title\",\"matplotlib heatmap colors\",\"matplotlib heatmap example\",\"matplotlib heatmap with values\",\"matplotlib heatmap xyc\",\"matplotlib lat long heatmap\",\"matplotlib pyplot 2 dimensional heatmap color and shade\",\"matplotlib us maps heatmap\",\"max number of values in heatmap matplotlib\",\"pandas heatmap matplotlib\",\"pyplot heatmap sharper borders matplotlib 1.5\",\"python heatmap matplotlib\",\"python matplotlib heatmap\",\"python matplotlib heatmap colorbar\",\"subplots heatmap spacing matplotlib\",\"using matplotlib cursor with heatmap\"],\"articleSection\":[\"Matplotlib\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\",\"url\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\",\"name\":\"How to Display Images Using Matplotlib Imshow Function - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png\",\"datePublished\":\"2020-08-19T11:55:31+00:00\",\"dateModified\":\"2024-01-01T09:22:33+00:00\",\"description\":\"In computer science, the images are represented in the form of arrays of numbers. To display it, use the matplotlib imshow function.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png\",\"width\":1350,\"height\":650,\"caption\":\"matplotlib imshow\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Display Images Using Matplotlib Imshow Function\"}]},{\"@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\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"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\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/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:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056\",\"name\":\"Ashwini Mandani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f765ed1940ac0ae1d30ce4cb2f1452c1e83143b07354d25a42c1cd118980e269?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f765ed1940ac0ae1d30ce4cb2f1452c1e83143b07354d25a42c1cd118980e269?s=96&d=wavatar&r=g\",\"caption\":\"Ashwini Mandani\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Display Images Using Matplotlib Imshow Function - Python Pool","description":"In computer science, the images are represented in the form of arrays of numbers. To display it, use the matplotlib imshow function.","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:\/\/www.pythonpool.com\/matplotlib-imshow\/","og_locale":"en_US","og_type":"article","og_title":"How to Display Images Using Matplotlib Imshow Function","og_description":"Do you know that images are represented in the form of numbers in computer programming? Any of the operations that we perform on an image using","og_url":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/","og_site_name":"Python Pool","article_published_time":"2020-08-19T11:55:31+00:00","article_modified_time":"2024-01-01T09:22:33+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png","type":"image\/png"}],"author":"Ashwini Mandani","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Ashwini Mandani","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/"},"author":{"name":"Ashwini Mandani","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056"},"headline":"How to Display Images Using Matplotlib Imshow Function","datePublished":"2020-08-19T11:55:31+00:00","dateModified":"2024-01-01T09:22:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/"},"wordCount":832,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png","keywords":["fft power spectrum matplotlib heatmap","heatmap in matplotlib","heatmap matplotlib","heatmap python matplotlib","matplotlib 3d heatmap","matplotlib heatmap","matplotlib heatmap color scale white at 0","matplotlib heatmap colorbar","matplotlib heatmap colorbar title","matplotlib heatmap colors","matplotlib heatmap example","matplotlib heatmap with values","matplotlib heatmap xyc","matplotlib lat long heatmap","matplotlib pyplot 2 dimensional heatmap color and shade","matplotlib us maps heatmap","max number of values in heatmap matplotlib","pandas heatmap matplotlib","pyplot heatmap sharper borders matplotlib 1.5","python heatmap matplotlib","python matplotlib heatmap","python matplotlib heatmap colorbar","subplots heatmap spacing matplotlib","using matplotlib cursor with heatmap"],"articleSection":["Matplotlib"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/matplotlib-imshow\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/","url":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/","name":"How to Display Images Using Matplotlib Imshow Function - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png","datePublished":"2020-08-19T11:55:31+00:00","dateModified":"2024-01-01T09:22:33+00:00","description":"In computer science, the images are represented in the form of arrays of numbers. To display it, use the matplotlib imshow function.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/matplotlib-imshow\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/Theatre-Actor-Portfolio-Website.png","width":1350,"height":650,"caption":"matplotlib imshow"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/matplotlib-imshow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"How to Display Images Using Matplotlib Imshow Function"}]},{"@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":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"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":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/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:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056","name":"Ashwini Mandani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f765ed1940ac0ae1d30ce4cb2f1452c1e83143b07354d25a42c1cd118980e269?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f765ed1940ac0ae1d30ce4cb2f1452c1e83143b07354d25a42c1cd118980e269?s=96&d=wavatar&r=g","caption":"Ashwini Mandani"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=3887"}],"version-history":[{"count":6,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3887\/revisions"}],"predecessor-version":[{"id":31560,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3887\/revisions\/31560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/3900"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=3887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=3887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=3887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}