Rishikesh Kumar Rishi has Published 1162 Articles

How to plot an image with non-linear Y-axis with Matplotlib using imshow?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:35:11

714 Views

To plot an image with non-linear Y-axis with matplotlib using imshow() method, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Add a subplot to the current figure.Set nonlinear Y-axis ticks.Create random data points using numpy.Display data as an image, i.e., ... Read More

How to create a matplotlib colormap that treats one value specially?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:33:09

497 Views

To create a matplotlib colormap that treats one value specially, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Get a colormap instance, name is "rainbow".Set the color for low out-of-range values, using set_under('red') method.Create random data and eps using numpy.Create ... Read More

How to show a figure that has been closed in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:31:25

724 Views

To show a figure that has been closed in Matplotlib, we can create a new Canvas Manager and store the previous figure into a new Canvas figure.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Create x and y ... Read More

How to set the Y-axis in radians in a Python plot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:29:24

721 Views

To set the Y-axis in radians in a Python plot, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data point using numpy.Create a new figure or activate an existing figure using figure() method.Add an axes, ax, ... Read More

How to plot histograms from dataframes in Pandas using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:24:36

474 Views

To plot histograms against Pandas/Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a potentially hetrogeneous tabular data using Pandas dataframe.Use the dataframe to make a histogram.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt import ... Read More

How can box plot be overlaid on top of swarm plot in Seaborn?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:22:32

378 Views

To plot a Box plot overlaid on top of a Swarm plot in Seaborn, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe, i.e., two-dimensional, size-mutable, potentially heterogeneous tabular data.Initialize the plotter, swarmplot.To plot the box plot, ... Read More

Setting the display range suplot of errorbars in matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:17:31

94 Views

To set the display range subplot or errorbars in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Create a figure and a set of subplots.Plot y versus x as lines and/or markers ... Read More

Adjust the width of box in boxplot in Python Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:14:33

6K+ Views

To adjust the width of box in boxplot in Python matplotlib, we can use width in the boxplot() method.StepsSet the figure size and adjust the padding between and around the subplots.Make a Pandas dataframe, i.e., two-dimensional, size-mutable, potentially heterogeneous tabular data.Make a box and whisker plot, using boxplot() method with ... Read More

How to draw a heart with pylab?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:12:27

1K+ Views

To draw a heart with pylab/pyplot, we can follow the steps given below −StepsSet the figure size and adjust the padding between and around the subplots.Create x, y1 and y2 data points using numpy.Fill the area between (x, y1) and (x, y2) using fill_between() method.Place text on the plot using ... Read More

How to save an image with matplotlib.pyplot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Aug-2021 12:10:48

5K+ Views

To save an image with matplotlib.pyplot.savefig(), we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y data points using plot() method.To save the figure, use savefig() method.Exampleimport numpy as np import ... Read More

Advertisements