Rishikesh Kumar Rishi has Published 1156 Articles

How to add a legend on Seaborn facetgrid bar plot using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:56:43

4K+ Views

StepsSet the figure size and adjust the padding between and around the subplots.Create a dataframe with col1 columns.Multi-plot grid for plotting conditional relationships.Use map_dataframe(). This method is suitable for plotting with functions that accept a long-form DataFrame as a 'data' keyword argument and access the data in that DataFrame using ... Read More

How to retrieve the list of supported file formats for Matplotlib savefig()function?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:56:19

344 Views

To retrieve the list of supported file formats for matplotlib savefig() function, we can use get_supported_filetypes().StepsFirst get the current figure.Set the canvas that contains the figure.Use get_supported_filetypes() method.Iterate the file type items.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt fs = plt.gcf().canvas.get_supported_filetypes() for key, ... Read More

Animation using Matplotlib with subplots and ArtistAnimation

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:41:05

2K+ Views

To animate using Matplotlib with subplots and ArtistAnimation, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Create a user-defined function, Init, to draw a clear frame.Use FuncAnimation to make an animation by repeatedly ... Read More

How to decrease colorbar width in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:40:30

2K+ Views

To decrease colorbar width in Matplotlib, we can use shrink in colorbar() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a random data using numpy.Display the data as an image, i.e., on a 2D regular raster, with data.Create a colorbar for a ScalarMappable instance, im.To ... Read More

How to make an arrow that loops in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:40:03

164 Views

To make an arrow that loops in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.To make an arrow loop in matplotlib, we can use make_loop() method.Make a wedge instance with center, radius, theta1, theta2 and width.To put the ... Read More

How to plot an angle spectrum using Matplotlib in Python?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:39:41

535 Views

To plot an angle spectrum, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Get random seed value.Initialize dt for sampling interval and find the sampling frequency.Create random data points for t.To generate noise, get nse, r, cnse and s, using ... Read More

How to change the datetime tick label frequency for Matplotlib plots?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 17-Jun-2021 11:34:41

5K+ Views

To change the datetime tick label frequency for Matplotlib plots, we can create a dataframe and plot them in some date rangeStepsSet the figure size and adjust the padding between and around the subplots.To make potentially heterogeneous tabular data, use Pandas dataframe.Plot the dataframe using plot() method.Set X-axis major locator, ... Read More

Plot animated text on the plot in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 14:59:27

3K+ Views

To animate text in a plot, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Set x and y axis limit.Initialize a variable, string.Use text() method to place text over the plot.Use FuncAnimation() to animate the text. Set text on the text ... Read More

How do you change the default font color for all text in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:23:21

4K+ Views

To change the default font color for all text in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Using rcParams['text.color'], we can get the default text color.We can update the text color and label color after updating the rcParams ... Read More

How to add a legend to a Matplotlib pie chart?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:22:53

8K+ Views

To add a legend to a Matplotlib pie chart, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of labels, colors, and sizes.Use pie() method to get patches and texts with colors and sizes.Place a legend on the ... Read More

Advertisements