Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log plots (semilogx, semilogy and loglog) crash with type error #2785

Closed
felixzero opened this issue Feb 3, 2014 · 2 comments
Closed

Log plots (semilogx, semilogy and loglog) crash with type error #2785

felixzero opened this issue Feb 3, 2014 · 2 comments

Comments

@felixzero
Copy link

Hello, I am currently running matplotlib 1.3.1 with Python 2.7 on Windows XP, and since the upgrade I am unable to plot even a simple log plot.
Here is an example of minimal code that bugs:

from pylab import *
from numpy import *

x = linspace(1, 10, 100)
y = 2*sqrt(x)

semilogy(x, y)
show()

This code raises to following type error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 276, in resize
    self.show()
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 348, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 451, in draw
    self.figure.draw(self.renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 1034, in draw
    func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 2086, in draw
    a.draw(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1093, in draw
    renderer)
  File "C:\Python27\lib\site-packages\matplotlib\axis.py", line 1042, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File "C:\Python27\lib\site-packages\matplotlib\text.py", line 754, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File "C:\Python27\lib\site-packages\matplotlib\text.py", line 329, in _get_layout
    ismath=ismath)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_agg.py", line 210, in get_text_width_height_descent
    self.mathtext_parser.parse(s, self.dpi, prop)
  File "C:\Python27\lib\site-packages\matplotlib\mathtext.py", line 3009, in parse
    self.__class__._parser = Parser()
  File "C:\Python27\lib\site-packages\matplotlib\mathtext.py", line 2193, in __init__
    - ((lbrace + float_literal + rbrace)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Regards,
felixzero

@tacaswell
Copy link
Member

Remove the pyparsing files in the matplotlib install directory, and reinstall pyparsing as a stand alone if necessary.

@felixzero
Copy link
Author

Thank you, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants