Rishikesh Kumar Rishi has Published 1156 Articles

How to pass RGB color values to Python's Matplotlib eventplot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

2K+ Views

To pass RGB color values to Python's Matplotlib eventplot, we can take the following stepsStepsSet the figure size and adjust the padding between and around the subplots.Create a 1D array, pos, to define the positions of one sequence of eventsMake a list of color tuple r, g, b.Plot identical parallel ... Read More

How to put gap between Y-axis and the first bar in a vertical barchart in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

2K+ Views

To put gap between Y-axis and the first bar in vertical barchart, we can reduce the X-axis scale.StepsSet the figure size and adjust the padding between and around the subplots.Create lists x_val, x_names andvaldata points. Also, initialize width and interval variables.Make a bar plot using bar() method.Get or set the ... Read More

How to embed fonts in PDFs produced by Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

1K+ Views

To embed fonts in PDFs produced by Matplotlib, we can use rc.Params['pdf.fonttype']=42.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure, using figure() method.Create x and y data points using numpy.Plot x and y data points using scatter() method.Set ... Read More

How to animate the colorbar in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 09:08:33

2K+ Views

To animate the colorbar 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.Add an '~.axes.Axes' to the figure as part of a subplot arrangement.Instantiate Divider based on the pre-existing axes, ... Read More

Matplotlib animation not working in IPython Notebook?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 16-Jun-2021 09:05:40

2K+ Views

To animate a plot in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a random data of shape 10X10 dimension.Create a figure and a set of subplots, using subplots() method.Makes an animation by repeatedly calling a function *func*, ... Read More

How to display the count over the bar in Matplotlib histogram?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Jun-2021 13:19:36

4K+ Views

To display the count over the bar in matplotlib histogram, we can iterate each patch and use text() method to place the values over the patches.StepsSet the figure size and adjust the padding between and around the subplots.Make a list of numbers to make a histogram plot.Use hist() method to ... Read More

How to replace auto-labelled relative values by absolute values in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Jun-2021 13:18:13

748 Views

To replace auto-labelled relayive values by absolute values in matplotlib, we can use autopct=lambda p: .StepsSet 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 percentage.Make a pie chart using labels, fracs ... Read More

How to make simple double head arrows on the axes in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Jun-2021 13:17:12

3K+ Views

To make simple double head arrows on the axes in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Use annotate() method to annotate the point xy with text='Arrows'. Start the tuple and end it for positions. In arrowprops dictionary, ... Read More

How to add legends and title to grouped histograms generated by Pandas? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Jun-2021 13:16:24

4K+ Views

To add legends and title to grouped histograms generated by Pandas, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe with "a", "b", "c" and "d" keys.Plot data frame with kind="hist"Set a title for the axes.To display ... Read More

Plot scatter points on polar axis in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-Jun-2021 13:15:37

1K+ Views

To plot scatter points on polar axis in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for number of sample data.Get r, theta, area and color data using numpyCreate a new figure or activate an ... Read More

Advertisements