>>> import matplotlib
>>> matplotlib.__version__
'0.99.1.1'
Aşağıdaki kod çalışan iterable değildir:açıklama matplotlib xycoords => = ('Veri', 'kısmını eksenleri') TypeError: 'NoneType' nesne
import matplotlib.pyplot as plt
plt.figure()
ax=plt.axes([.1, .1, .8, .8])
ax.annotate('++++', xy=(.5,.2), xycoords='data')
ax.annotate('aaaa', xy=(.5,.4), xycoords='axes fraction')
#ax.annotate('bbbb', xy=(.5,.6), xycoords=('data', 'axes fraction'))
plt.show()
ancak çok yorum Çıkış balta.
From: http://matplotlib.sourceforge.net/users/annotations_guide.html
4. A tuple of two coordinate specification.
The first item is for x-coordinate and
the second is for y-coordinate.
For example,
annotate("Test", xy=(0.5, 1), xycoords=("data", "axes fraction"))
0.5 is in data coordinate, and 1 is in normalized axes coordinate.
: o anki docs göre güya doğru kodudur
TypeError: 'NoneType' object is not iterable
: Annotatesekmesindeki hata veriyor 210
Neler olduğu hakkında herhangi bir fikir var mı?
DÜZENLEME: ilk gönderiden beri, bir geçici çözüm arıyorum ve başka bir sorun keşfettim. Xycoords = 'data' olduğunda, clip_on = False ile bile, eksenlerin dışına düşerse annotataion hala kırpılır.
import matplotlib.pyplot as plt
plt.figure()
ax=plt.axes([.1, .1, .8, .8])
ax.annotate('cccc', xy=(.3, .5), xycoords='data', clip_on=False)
ax.annotate('dddd', xy=(.3,-.1), xycoords='data', clip_on=False)
ax.annotate('eeee', xy=(.6,-.1), xycoords='axes fraction', clip_on=False)
plt.show()
Matplotlib'in hangi sürümünü kullanıyorsunuz? Her iki örneğiniz benim için mükemmel çalışıyor ... –
teşekkürler Joe, matplotlib .__ version__ '0.99.1.1' .... hangi sürümü kullanıyorsunuz? –
@mike - '1.0.1' Bence" xcoords "kwarg parçasının" iki koordinat belirtiminin tuple "kısmı matplotlib 1.0'a eklenmiştir. Http://matplotlib.sourceforge.net/_static/CHANGELOG adresindeki 2010-02-25'deki eke bakın. İkinci problem, bir noktada düzeltilen bir hatadır. (Aslında, sadece 0.99.1'de var olan bir hata olduğunu iddia ediyorum. Uzun süre fark edilmeden gitmeyi düşünmüyorum.) –