- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove a specific line or curve in Matplotlib?
63 Lectures 6 hours
To remove a specific line or curve 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.
- Pop the second line and remove it.
- To display the figure, use show() method.
from matplotlib import pyplot as plt, image as mimg plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True line_1 = plt.plot([1, 2, 3]) line_2 = plt.plot([2, 4, 6]) line = line_2.pop(0) line.remove() plt.show()
- How to animate a sine curve in Matplotlib?
- Draw a curve connecting two points instead of a straight line in matplotlib
- How to add a cursor to a curve in Matplotlib?
- How to fill color below a curve in Matplotlib?
- How to curve text in a polar plot in matplotlib?
- How to fill rainbow color under a curve in Python Matplotlib?
- How to change the curve using radiobuttons in Matplotlib?
- Draw a parametrized curve using pyplot.plot() in Matplotlib
- How to animate a line plot in Matplotlib?
- How to label a line in Matplotlib (Python)?
- How to draw a precision-recall curve with interpolation in Python Matplotlib?
- How to assign specific colors to specific cells in a Matplotlib table?
- How to fill color above the curve in Matplotlib Program?
- How to remove or hide X-axis labels from a Seaborn / Matplotlib plot?
- How to remove lines in a Matplotlib plot?