Answers for "matplotlib show labels"

0

matplotlib point labels

import matplotlib.pyplot as plt
import numpy as np

plt.clf()

# using some dummy data for this example
xs = np.arange(0,10,1)
ys = np.random.normal(loc=2.0, scale=0.8, size=10)

plt.plot(xs,ys)

# text is left-aligned
plt.text(2,4,'This text starts at point (2,4)')

# text is right-aligned
plt.text(8,3,'This text ends at point (8,3)',horizontalalignment='right')

plt.show()
Posted by: Guest on June-01-2021
0

matplotlib axis labels

ticks = [0, 1, 2]
labels = ["a", "b", "c"]

plt.figure()
plt.xticks(ticks, labels)
plt.show()
Posted by: Guest on June-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language