My overlays overlap in matplotlib

I am working on graphics with matplotlib in Python 3.4, which represents:

x = (months) y = (12 values)

import matplotlib.pyplot as plt
import numpy as np
import calendar

N = 12
mult = 12500
x = np.arange(N)
y = mult *np.random.randn(12)

plt.plot(x, y, 'r')
plt.xticks(x, calendar.month_name[1:13], rotation=20 )
plt.yticks(y, y)
plt.grid('on')
plt.margins(0.05)
plt.show()

The signs of yticks are the values ​​in y, but when some values ​​are very similar, the labels overlap.

Example:

example image

I tried the linespacing property, but it just works with every shortcut that it does not affect the set.

How do I set the spacing between labels or avoid duplication?

+4
source share
1 answer

@jme: " , , , y . y y-. , : enter image description here

0

Source: https://habr.com/ru/post/1616094/


All Articles