4
私はmatplotlibのを使用してロジットスケールの軸のラベルを設定するときに、ラベルの位置決め誤差どのように見えるかを取得しています、ここに私の例です:のPython matplotlibのとValueError
import matplotlib.pyplot as plt;
from matplotlib.ticker import FormatStrFormatter;
x = [1,2,3,4,5];
y = [0.1,0.2,0.3,0.4,0.5];
fig,ax = plt.subplots();
ax.set_ylim([0.005,0.99]);
ax.set_yscale('logit');
ax.yaxis.set_minor_formatter(FormatStrFormatter(""));
ax.set_xlabel("X axis");
ax.set_ylabel("Y axis"); #set y axis label (logit scale)
ax.plot(x,y);
plt.show();
plt.close();
は、ここでトレースです:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 136, in _draw
self.figure.draw(renderer)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/figure.py", line 1143, in draw
renderer, self, dsu, self.suppressComposite)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2409, in draw
mimage._draw_list_compositing_images(renderer, self, dsu)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/axis.py", line 1150, in draw
self.label.draw(renderer)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/artist.py", line 63, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/text.py", line 762, in draw
raise ValueError("posx and posy should be finite values")
ValueError: posx and posy should be finite values
私は
ax.set_ylabel("Y axis"); #set y axis label (logit scale)
を省略するときには、Lの問題とは思われない素晴らしい作品abelは軸のスケールの前後に設定されます。 誰でもこの問題を回避する方法を知っていますか?
これは動作します!とても有難い!参考のためにありがとう:) –