Rishikesh Kumar Rishi has Published 1162 Articles

How to make several legend keys to the same entry in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 05-Jun-2021 07:55:18

866 Views

To make several legend keys to the same entry in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Plot line1 and line2 using plot() method.Use legend() method to place a legend over the plot with numpoints=1To display the figure, ... Read More

Removing Horizontal Lines in image (OpenCV, Python, Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 05-Jun-2021 07:41:47

3K+ Views

To remove horizontal lines in an image, we can take the following steps −Read a local image.Convert the image from one color space to another.Apply a fixed-level threshold to each array element.Get a structuring element of the specified size and shape for morphological operations.Perform advanced morphological transformations.Find contours in a ... Read More

Specifying the line width of the legend frame in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 05-Jun-2021 07:39:47

3K+ Views

To specify the line width of the legend frame in Matplotlib, we can use set_linewidth() method.StepsSet 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 using subplots() method.Plot x and y using plot() ... Read More

How to plot a Pandas multi-index dataFrame with all xticks (Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 05-Jun-2021 07:38:30

4K+ Views

To plot a Pandas multi-index data frame with all xticks, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create index value with 1000 smaples data.Make a one-dimensional ndarray with axis labels.Get the mean value of the series.Plot g dataframe.Set the ... Read More

Is it possible to use pyplot without DISPLAY?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 05-Jun-2021 07:36:37

597 Views

We can save the current figure in the local machine and can display it.StepsSet the figure size and adjust the padding between and around the subplots.Create x data points using numpy.Plot x and y data points using plot() method.Save the figure using savefig() method.Exampleimport numpy as np import matplotlib.pyplot as ... Read More

How do I display real-time graphs in a simple UI for a Python program?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 13:50:18

675 Views

To display real-time graphs in a simple UI for a Python program, we can animate the contour plot.StepsSet the figure size and adjust the padding between and around the subplots.Create a random data of shape 10×10 dimension.Create a figure and a set of subplots using subplots() method.Make an animation by ... Read More

How to draw a line outside of an axis in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:39:48

2K+ Views

To draw a line (i.e., arrow) outside of an axis, we can use annotate() method, 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.Clear the current figure.Add an '~.axes.Axes' to the figure as part of ... Read More

How to use multiple font sizes in one label in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:35:58

743 Views

To use multiple font sizes in one label in Python, we can use fontsize in title() method.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y using plot() method.Initialize a variable, fontsize.Set the title of the plot ... Read More

How to put the Origin at the center of the cos curve in a figure in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:34:30

1K+ Views

To put the Origin at the center of the cos curve in a figure, 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.Set the position of the axes using spines, top, left, right ... Read More

How do I specify an arrow-like linestyle in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:33:07

746 Views

To draw an arrow-like linestyle in matplotlib, we can use quiver() method.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Use quiver() method to draw a line.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt ... Read More

Advertisements