Rishikesh Kumar Rishi has Published 1156 Articles

How to remove the digits after the decimal point in axis ticks in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 07:11:23

8K+ Views

To remove the digits after the decimal point in axis ticks 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.To set the xtick labels ... Read More

How to set the unit length of an axis in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 07:08:34

5K+ Views

To set the unit length of an axis in Matplotlib, we can use xlim or ylim with scale factor of the axes, i.e., of unit length times.stepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot the x and y ... Read More

Hiding major tick labels while showing minor tick labels in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 07:06:44

879 Views

To hide major tick labels while showing minor ticklabels 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.Plot the x and y data points.Set a property on an artist object, using ... Read More

How to mark a specific level in a contour map on Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 07:04:23

983 Views

To mark a specific level in a contour map on Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x, y and z data points using Numpy.Use contour() method to make contour plot.Label the contour plot.To display the figure, ... Read More

How to label a patch in matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 07:01:05

3K+ Views

To label a patch in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize the center of the rectangle patch.Create a new figure or activate an existing figure.Add an 'ax' to the figure as part of a subplot arrangement.Add ... Read More

How to sort bars in a bar plot in ascending order (Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 06:58:34

15K+ Views

To sort bars in a bar plot in ascending order, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of data for bar plots.Create a bar plot using bar() method, with sorted data.To display the figure, use show() ... Read More

How to add titles to the legend rows in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 06:52:57

2K+ Views

To add titles to the legend rows in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create y data points using numpy.Make lists of markers and labels.Create a figure and a set of subplots.Plot the lines using plot() method, ... Read More

What is the difference between importing matplotlib and matplotlib.pyplot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 06:51:02

1K+ Views

When we import matplotlib, we are importing all its libraries, whereas importing matplotlib.pyplot only imports pyplot's properties.stepsImport matplotlib.pyplot as pltSet 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 display the figure, ... Read More

Plotting a heatmap for 3 columns in Python with Seaborn

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 06:49:00

1K+ Views

To plot a heatmap for 3 columns in Python with Seaborn, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a dataframe, df, with 3 columns.Plot the rectangular data as a color-encoded matrix.To display the figure, use show() method.Exampleimport seaborn ... Read More

How to plot two histograms side by side using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 10-Aug-2021 06:45:16

14K+ Views

To plot two histograms side by side using matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make two dataframes, df1 and df2, of two-dimensional, size-mutable, potentially heterogeneous tabular data.Create a figure and a set of subplots.Make a histogram of ... Read More

Advertisements