Rishikesh Kumar Rishi has Published 1162 Articles

How to reuse plots in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Jun-2021 10:35:15

1K+ Views

To reuse plots in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure using figure() method.Plot a line with some input lists.To reuse the plot, update y data and the linewidth ... Read More

How to modify a Matplotlib legend after it has been created?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Jun-2021 10:34:44

2K+ Views

To modify a Matplotlib legend after it has been created, we can have multiple methods to modify the created legend.Set the figure size and adjust the padding between and around the subplots.Plot a line using plot() method, with two lists and a label.Use legend() method to place a legend over ... Read More

Plotting error bars from a dataframe using Seaborn FacetGrid (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Jun-2021 10:34:13

437 Views

To plot error bars from a dataframe using Seaborn FacetGrid, we can use following steps −Get a two-dimensional, size-mutable, potentially heterogeneous tabular data.Multi-plot grid for plotting conditional relationships.Apply a plotting function to each facet's subset of the data.To display the figure, use show() method.Exampleimport pandas as pd import seaborn as ... Read More

How can I get pyplot images to show on a console app? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Jun-2021 10:33:06

2K+ Views

To show pyplot images on a console, we can use pyplot.show() method.StepsSet the figure size and adjust the padding between and around the subplots.Create random data of 5☓5 dimension.Use imshow() method, with data. Display the data as an image, i.e., on a 2D regular raster.To display the figure, use show() ... Read More

How to produce a barcode in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Jun-2021 10:31:51

258 Views

To produce a barcode in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of binary numbers, i.e., 0s and 1s.Create a new figure or activate an existing figure with dpi=100Add an axes to the figure.Turn off ... Read More

How to set label for an already plotted line in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 12:09:33

1K+ Views

To set label for an already plotted line in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Plot the line with an input list.Set the label of the created line.Place a legend on the plot at the "upper right" ... Read More

How to handle times with a time zone in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 12:09:06

392 Views

To handle times with a time zone in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a dataframe, i.e., two-dimensional, size-mutable, potentially heterogeneous tabular data.To handle times with a time zone, use pytz library that brings the Olson ... Read More

How to change the default path for "save the figure" in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 12:06:03

4K+ Views

To change the default path for "save the figure", we can use rcParams["savefig.directory"] to set the directory path.StepsSet the figure size and adjust the padding between and around the subplots.Create random data using numpy.Use imshow() method. Display the data as an image, i.e., on a 2D regular raster.Save the figure ... Read More

How to have actual values in Matplotlib Pie Chart displayed?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 12:05:32

6K+ Views

To have actual or any custom values in Matplotlib pie chart displayed, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make lists of labels, fractions, explode position and get the sum of fractions to calculate the percentageMake a pie chart ... Read More

How to plot MFCC in Python using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 12:04:39

1K+ Views

To plot MFCC in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Open and read a WAV file.Compute MFCC features from an audio signal.Create a figure and a set of subplots.Interchange two axes of an arrayDisplay the data as ... Read More

Advertisements