Matplotlib

How to Display an Image as Grayscale in Python Matplotlib?

How to Display an Image as Grayscale in Python Matplotlib? You can convert a given image to a grayscale image using four simple steps: Import the PIL and Matplotlib libraries Open the image with PIL.Image.open(filename). Convert the opened image to grayscale using img.convert(“L”) with greyscale mode “L”. Display the image using Matplotlib’s plt.imshow(gray_img, cmap=’gray’) function. …

How to Display an Image as Grayscale in Python Matplotlib? Read More »

Python OpenCV Image Processing – Resize, Blend, Blur, Threshold, Convert

This tutorial is an introduction to the OpenCV library. Learn how to convert color channels, resize, blend, blur, and threshold images in Python. The OpenCV [1] library contains most of the functions we need for working with images. Handling images in programming requires a different intuition than handling text data. An image is made up …

Python OpenCV Image Processing – Resize, Blend, Blur, Threshold, Convert Read More »

How to Extract Text from Images in Python using OpenCV and EasyOCR

You can extract text from images with EasyOCR, a deep learning-based OCR tool in Python. EasyOCR performs very well on invoices, handwriting, car plates, and public signs. First released in 2007, PyTesseract [1] is the to-go library for extracting text from images. It uses classical computer vision methods to perform optical character recognition (OCR), then …

How to Extract Text from Images in Python using OpenCV and EasyOCR Read More »

How to Customize Multiple Subplots in Matplotlib

This article will cover a specific issue that most Python users encounter when using Matplotlib for plotting their graphs. I am talking about defining multiple subplots and being able to access and change their properties individually. In the following sections, we will see how to use the Matplotlib function .subplots() for generating multiple subplots and …

How to Customize Multiple Subplots in Matplotlib Read More »

How to Plot the Confidence Interval in Python?

Problem Formulation: How to plot the confidence interval in Python? To plot a filled interval with the width ci and interval boundaries from y-ci to y+ci around function values y, use the plt.fill_between(x, (y-ci), (y+ci), color=’blue’, alpha=0.1) function call on the Matplotlib plt module. The first argument x defines the x values of the filled …

How to Plot the Confidence Interval in Python? Read More »

How to Plot Matplotlib’s Color Palette — and Choose Your Plot Color?

In this article, we’ll learn how to generate the matplotlib color palette and then we will use it to select a specific color for our plot. When presenting data, the color that you assign to a plot is very important; a bad color choice can make your data difficult to understand or even less interesting. …

How to Plot Matplotlib’s Color Palette — and Choose Your Plot Color? Read More »

How to Calculate Percentiles in Python

This article deals with calculating percentiles. Percentiles are statistical indicators that are used to describe specific portions of a sample population. The following sections will explain what percentiles are, what they are used for and how to calculate them, using Python. As you will see, Python allows solving this problem in multiple ways, either by …

How to Calculate Percentiles in Python Read More »

Matplotlib Cursor — How to Add a Cursor and Annotate Your Plot

This article explains how to insert a cursor to your plot, how to customize it and how to store the values that you selected on the plot window. In lots of situations we may want to select and store the coordinates of specific points in our graph; is it just for assessing their value or …

Matplotlib Cursor — How to Add a Cursor and Annotate Your Plot Read More »

Matplotlib Widgets — How to Make Your Plot Interactive With Buttons

This article presents different types of widgets that can be embedded within a matplotlib figure, in order to create and personalize highly interactive plots. Exploiting the matplotlib package .widget(), it is hence possible to create personalized buttons that allows controlling different properties of the graphs that are plotted in the main window. This represents a …

Matplotlib Widgets — How to Make Your Plot Interactive With Buttons Read More »