Rishikesh Kumar Rishi has Published 1162 Articles

How to plot two violin plot series on the same graph using Seaborn?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 08-Oct-2021 12:33:15

1K+ Views

To plot two violin plot series on the same graph using Seaborn, we can take the following Steps.StepsSet the figure size and adjust the padding between and around the subplots.Load an example dataset from the online repository (requires Internet).Create a violin plot using violinplot() method.To display the figure, use Show() ... Read More

How to autosize text in matplotlib Python?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 08-Oct-2021 12:31:29

317 Views

To autosize text in matplotlib, we can make a tight layout and rotate the ticks.StepsSet the figure size and adjust the padding between and around the subplots.Plot data points of the range of 10.Make a list of labels.Put ticks and labels on the X-axis with 30 rotation.To display the figure, ... Read More

How to change the scale of imshow in matplotlib without stretching the image?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 08-Oct-2021 12:29:16

13K+ Views

To change the scale of imshow in matplotlib without stretching the image, we can take the following steps.StepsSet the figure size and adjust the padding between and around the subplots.Create random data points with 4×4 dimension.Display the data as an image, i.e., on a 2D regular raster.Use the extent parameter ... Read More

How to use ax.get_ylim() in matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 08-Oct-2021 12:14:22

411 Views

To use ax.get_ylim() method in matplotlib, we can take the following steps.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Add an 'ax' to the figure as part of a subplot arrangement.Create random data points using numpy.Plot y data ... Read More

Store mouse click event coordinates with Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 07-Oct-2021 07:19:40

2K+ Views

To store mouse event coordinates with matplotlib, we can use "button_press_event" event.−StepsSet the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Plot a line in the range of 10Bind the function *onclick* to the event *button_press_event*.Print the x and y data ... Read More

How to plot a density map in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 29-Sep-2021 12:38:42

3K+ Views

To plot a density map in Python, we can take the following steps −Create side, x, y, and z using numpy. Numpy linspace helps to create data between two points based on a third number.Return coordinate matrices from coordinate vectors using side data.Create exponential data using x and y (Step 2).Create ... Read More

How to put the title at the bottom of a figure in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 23-Sep-2021 11:12:10

5K+ Views

To put the line title at the bottom of a figure 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, to get the number of sample data.Plot the x and y data points using scatter() ... Read More

How to make a simple lollipop plot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 23-Sep-2021 11:10:59

353 Views

To make a simple lollipop plot in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a dataframe, df, of two-dimensional, size-mutable, potentially heterogeneous tabular data.Make an ordered dataframe, using sort_values().Make a list in the range of dataframe index.Create ... Read More

What is the correct way to replace matplotlib tick labels with computed values?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 23-Sep-2021 11:08:28

255 Views

We can use ax.loglog(x, y) and set_major_formatter() methods to replace tick labels with computed values.StepsSet the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Make a plot with log scaling on both the X and Y axis.Set the formatter of the ... Read More

How to have a function return a figure in Python (using Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 23-Sep-2021 11:07:08

13K+ Views

To have a function return a figure in Python (using 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.Make a function plot(x, y) that creates a new figure or activate an existing ... Read More

Advertisements