- 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 change the plot line color from blue to black in Matplotlib?
To change the plot line color from blue to black, we can use setcolor() method−
- Create x and y data points using numpy.
- Plot line x and y using plot() method; store the returned value in line.
- Set the color as black using set_color() method.
- To display the figure, use show() method.
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-2, 2, 10) y = 4 * x + 5 line, = plt.plot(x, y, c='b') line.set_color('black') plt.show()
- How to plot a gradient color line in matplotlib?
- How to change the color of a plot frame in Matplotlib?
- How to change the face color of a plot using Matplotlib?
- How to change the color of a line using radiobuttons in Matplotlib?
- How to change line color in EditText
- How to plot a single line in Matplotlib that continuously changes color?
- How to change the color and add grid lines to a Python Matplotlib surface plot?
- How to plot a line graph from histogram data in Matplotlib?
- How to change the axis color in base R plot?
- How to change the color of the axis, ticks and labels for a plot in matplotlib?
- How to change axes background color in Matplotlib?
- How to animate a line plot in Matplotlib?
- How to change the color of line in xyplot in R?
- How to change the color of line of a plot created for an xts object in R?
- How to change the axis ticks color in base R plot?