0

I have a contour plot and I would like to line all the labels along the same line. In the image below for example I would like to arrange each label along the vertical dashed line.

import matplotlib.pyplot as plt
col1 = np.array(list(range(0,1000,100))[::-1])
mat = np.array(col1)
for i in range(1,len(col1)):
    mat = np.vstack((mat,col1+100*i))
print(mat)
cont = plt.contour(mat, colors='blue')
plt.clabel(cont, inline=True, fontsize=10)
plt.plot([4.5,4.5],[0,9],color='grey', linestyle='dashed')
plt.show()

enter image description here

  • See [Matplotlib Contour Clabel Location](https://stackoverflow.com/a/13015194/12046409) and [change the positions and the labels for clabel](https://stackoverflow.com/questions/26320557/change-the-positions-and-the-labels-for-clabel). Each label will be set *near* the provided positions. – JohanC Nov 22 '22 at 06:51

0 Answers0