add plt axis names in python

To add axis labels using matplotlib in python, you can use the xlabel() and ylabel() function. Here is an example:

main.py
import matplotlib.pyplot as plt

# create example data
x = [1, 2, 3, 4, 5]
y = [10, 8, 6, 4, 2]

# plot the data
plt.plot(x, y)

# add x and y axis labels
plt.xlabel('X-axis label')
plt.ylabel('Y-axis label')

# display the plot
plt.show()
240 chars
16 lines

In this example, xlabel() and ylabel() functions are used to add labels for x and y axis respectively. You can replace X-axis label and Y-axis label with your own desired labels.

gistlibby LogSnag