Rishikesh Kumar Rishi has Published 1162 Articles

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

3K+ 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

7K+ 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

How to make more than 10 subplots in a figure using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

858 Views

To make more than 10 subplots in a figure, we can use subplots() method with some rows and columns.StepsSet the figure size and adjust the padding between and around the subplots.Initialize rows count and columns count.Create a figure and a set of subplots with rows☓cols subplots.To display the figure, use ... Read More

How to plot a jointplot with 'hue' parameter in Seaborn? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:20:58

312 Views

To plot a jointplot with hue parameter in Seaborn, we can take the following steps −StepsSet the figure size and adjust the padding between and around the subplots.Create x data points using numpy.Make a dictionary with some curve data.Make a dataframe for tabular data.Make a jointplot using jointplot() method.To display ... Read More

How to annotate the end of lines using Python and Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:20:16

1K+ Views

To annotate the end of lines using Python and Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initalize a variable, rows, to get the number of rows data.Get a Pandas dataframe in a rectangular tabular data.Calculate the cumsum (cumulative ... Read More

Defining multiple plots to be animated with a for loop in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:19:49

2K+ Views

To define multiple plots to be animated with a for loop in matplotlib, we can take followings 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.Add an axes to the current figure and make ... Read More

How to return a matplotlib.figure.Figure object from Pandas plot function?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

546 Views

To return a matplotlib.figure.Figure object from Pandas function, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe, df.Make a horizontal bar plot using barh() method.Get the current figure instance.Place a legend on the axes at the lower-right ... Read More

How to plot a half-black and half-white circle using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:19:01

1K+ Views

To plot a half-black and half-white circle using Matplotlib, 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.Initialize theta1 and theta2 to draw edges from theta1 to theta2 and vice-versa.Add the wedge instance ... Read More

Change the default background color for Matplotlib plots

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:17:07

476 Views

To change the default background color for Matplotlib plots, we can take the following steps −StepsSet the figure size and adjust the padding between and around the subplots.Get the current axis.Add a subplot to the current figure, with nrows=1, ncols=2 and index=1.Plot random x and y data points using plots() ... Read More

How to add a shared x-label and y-label to a plot created with Pandas' plot? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 12:16:44

679 Views

To add a shared x-label and shared y-label, we can use plot() method with kind="bar", sharex=True and sharey=True.StepsSet the figure size and adjust the padding between and around the subplots.Create a two-dimensional, size-mutable, potentially heterogeneous tabular data.Plot the dataframe with kind="bar", sharex=True and sharey=True.To display the figure, use show() method.Exampleimport ... Read More

Advertisements