0

I am running a loop to plot a bunch of different lines but it makes the most sense to plot them on a loglog plot (dealing with about 9 orders of magnitude). They plot how they should with a loglog plot but the axes/axes labels are disappearing only when I try to log plot them.

#THIS IS FOR A NORMAL PLOT
import matplotlib.pyplot as plt

plt.figure()
for ii in list1:
    plt.plot(xarray[:], yarray[ii,:])
plt.show()

I have tried adding the following:

plt.xscale('log')

and

plt.yscale('log')

Alternatively I tried

plt.loglog(xarray[:], yarray[ii,:])
plt.semilogy(xarray[:], yarray[ii,:])

Any help would be great, I don't have much experience with plotting, but making axes appear should be pretty simple I would think. Thanks.

My plot without the axes

EDIT: I am also getting the following error call from the traceback. I just did a clean reinstall of matplotlib and still having the same problems (it plots but no axes)

>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'

1 Answers1

0

Turns out that this problem was the result of the same problem as seen: In this Problem

I did a complete uninstall of python, reinstalled python (the 32 bit version for Mac OSX 10.3 and higher), matplotlib, scipy, and numpy. And now the axes are plotting correctly.

Community
  • 1
  • 1