To set the color of a line plot in Python using seaborn and matplotlib, you can use the lineplot
function from seaborn and specify the desired color using the color
parameter.
Here is an example of how to set the color of a line plot:
main.py316 chars18 lines
In the above example, we import the seaborn
and matplotlib.pyplot
libraries. Then, we create some sample data for the x and y values. We pass these data to the lineplot
function and specify the desired color ('red') using the color
parameter. Finally, we add labels and title to the plot and display it using plt.show()
.
You can replace the 'red'
color with any other valid color in Python, such as 'blue'
, 'green'
, 'yellow'
, etc., or you can use hexadecimal color codes like '#FF0000'
for red.
Remember to adjust the code according to your own data and preferences.
gistlibby LogSnag