我正在运行一个循环来绘制一组不同的线,但将它们绘制在对数图上是最有意义的(处理大约9个数量级)。他们用对数图绘制了它们应该如何绘制,但只有当我尝试对它们进行对数绘制时,轴/轴标签才会消失。
#THIS IS FOR A NORMAL PLOT
import matplotlib.pyplot as plt
plt.figure()
for ii in list1:
plt.plot(xarray[:], yarray[ii,:])
plt.show()我已经尝试添加了以下内容:
plt.xscale('log')和
plt.yscale('log')或者我试着
plt.loglog(xarray[:], yarray[ii,:])
plt.semilogy(xarray[:], yarray[ii,:])任何帮助都是很好的,我没有太多的绘图经验,但我认为让轴出现应该是相当简单的。谢谢。
My plot without the axes
编辑:我还收到了来自回溯的以下错误调用。我刚刚重新安装了matplotlib,仍然有同样的问题(它可以绘图,但没有轴)
>Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 1034, in draw
func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py", line 2086, in draw
a.draw(renderer)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py", line 1093, in draw
renderer)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py", line 1042, in _get_tick_bboxes
extent = tick.label1.get_window_extent(renderer)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.py", line 754, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.py", line 329, in _get_layout
ismath=ismath)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 151, in get_text_width_height_descent
self.mathtext_parser.parse(s, self.dpi, prop)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mathtext.py", line 3009, in parse
self.__class__._parser = Parser()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mathtext.py", line 2193, in __init__
- ((lbrace + float_literal + rbrace)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'发布于 2014-03-08 06:46:02
事实证明,这个问题是由相同的问题引起的,如下所示:In this Problem
我完全卸载了python,重新安装了python (适用于Mac OSX 10.3和更高版本的32位版本)、matplotlib、scipy和numpy。现在轴可以正确绘制了。
https://stackoverflow.com/questions/22236000
复制相似问题