I have a code that creates and saves a plot, using matplotlib and python. The code runs flawlessly at the laptop of my supervisor, who has matplotlib 1.1.1. However, despite the fact that I have a newer version of matplotlib(1.3.1) I get the following error when executing this command:
plt.savefig("outputs/" + run_uuid +".pdf", facecolor='white', bbox_inches='tight', pad_inches=0.0)
I get the following Traceback on that command:
Traceback (most recent call last):
File "vis.py", line 1116, in <module>
plt.savefig("outputs/" + run_uuid +".pdf", facecolor='white', bbox_inches='tight', pad_inches=0.0)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 561, in savefig
return fig.savefig(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1421, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 2167, in print_figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 1952, in print_pdf
return pdf.print_pdf(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_pdf.py", line 2352, in print_pdf
self.figure.draw(renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034, in draw
func(*args)
File "/usr/lib/pymodules/python2.7/mpl_toolkits/axisartist/axislines.py", line 774, in draw
super(Axes, self).draw(renderer, inframe)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in draw
a.draw(renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/lines.py", line 530, in draw
gc.set_foreground(ln_color_rgba)
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 921, in set_foreground
self._rgb = colors.colorConverter.to_rgba(fg)
File "/usr/lib/pymodules/python2.7/matplotlib/colors.py", line 365, in to_rgba
'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
ValueError: to_rgba: Invalid rgba arg "None"
to_rgb: Invalid rgb arg "None"
cannot convert argument to rgb sequence
I couldn't find anything useful in the net for this error. Do you know what am I doing wrong?
I also tried to rewrite this
plt.savefig("outputs/" + run_uuid +".pdf", facecolor='white', bbox_inches='tight', pad_inches=0.0)
to this:
plt.savefig("outputs/" + run_uuid +".pdf")
but without any progress
I think reason is facecolor doesn't have value of 'white'.
From the following link, no 'white' exists in facecolor setting.
what if simply use plt.savefig("your path")? I think default background color should be white.
Related
I have created a python program that uses matplotlib to plot data and it had been working fine until today, an error occured. The program uses AutoDateLocator and ConciseDateFormatter. As you can see in the last line of the error log below, the received error is:
> IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Since it would be really difficult to post more details about my program functionality as well as the data used, I was wondering if there is an obvious solution to the above-mentioned problem, or if you could guide me to where I should look for the problem.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\tkinter_init_.py", line 1883,
in call
return self.func(*args)
File "C:\Users\Nick\Desktop\Uni\TUC
studies\thesis\Code\python\test\myGUI_V3.py", line 841, in plotMeas
fig.tight_layout()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py",
line 411, in
wrapper
return func(*inner_args, **inner_kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py",
line 2613, in tight_layout
kwargs = get_tight_layout_figure(
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py",
line 303, in get_tight_layout_figure
kwargs = auto_adjust_subplotpars(fig, renderer,
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py",
line 84, in
auto_adjust_subplotpars
bb += [ax.get_tightbbox(renderer, for_layout_only=True)]
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py",
line 4155, in
get_tightbbox
bb_xaxis = self.xaxis.get_tightbbox(
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1109, in get_tightbbox
ticks_to_draw = self._update_ticks()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line
797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2
were indexed
Traceback (most recent call last):
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py",
line 480, in
_draw_idle
self.draw()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py",
line 407, in draw
self.figure.draw(self.renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py",
line 1863, in draw
mimage._draw_list_compositing_images(
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line
131, in
_draw_list_compositing_images
a.draw(renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py",
line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py",
line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line
131, in
_draw_list_compositing_images
a.draw(renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1164, in draw
ticks_to_draw = self._update_ticks()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line
797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2
were indexed
Traceback (most recent call last):
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py",
line 480, in
_draw_idle
self.draw()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py",
line 407, in draw
self.figure.draw(self.renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py",
line 1863, in draw
mimage._draw_list_compositing_images(
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line
131, in
_draw_list_compositing_images
a.draw(renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py",
line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py",
line 2747, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line
131, in
_draw_list_compositing_images
a.draw(renderer)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py",
line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1164, in draw
ticks_to_draw = self._update_ticks()
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line
1030, in _update_ticks
minor_labels = self.minor.formatter.format_ticks(minor_locs)
File
"C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dates.py", line
797, in format_ticks
if len(np.unique(tickdate[:, level])) > 1:
IndexError: too many indices for array: array is 1-dimensional, but 2
were indexed
As it turns out, it was a problem of the setup of the AutoDateLocator. Because of the specific dataset, the minor ticks could not be set correctly, based on the values I had selected for minticks, maxticks, and for the intervald tuples chosen. As a result, when the ConciseDateFormatter tried to use the locator for the minor ticks, the above-mentioned error occured.
When used a simple DateFormatter, there was no error, but neither the minor ticks, nor their labels appeared on the plot.
I've been trying to use the Figure.figure.plot() function from matplotlib
figplot = fig.add_subplot(111)
print(lines[2].get_xdata()[0])
print(lines[2].get_ydata()[0])
figplot.plot(lines[2].get_xdata()[0], lines[2].get_ydata()[0], c='ro')
but upon trying to execute this, I'm getting the following error message:
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
return self.func(*args)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/backends/_backend_tk.py", line 259, in resize
self.draw()
File "/usr/local/lib/python3.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 9, in draw
super(FigureCanvasTkAgg, self).draw()
File "/usr/local/lib/python3.7/dist-packages/matplotlib/backends/backend_agg.py", line 388, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/figure.py", line 1709, in draw
renderer, self, artists, self.suppressComposite)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/axes/_base.py", line 2647, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/lines.py", line 783, in draw
lc_rgba = mcolors.to_rgba(self._color, self._alpha)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/colors.py", line 177, in to_rgba
rgba = _to_rgba_no_colorcycle(c, alpha)
File "/usr/local/lib/python3.7/dist-packages/matplotlib/colors.py", line 233, in _to_rgba_no_colorcycle
raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
ValueError: Invalid RGBA argument: 'ro'
I've noticed that for scatter plots, the colors have to be an array, but this isn't a scatter plot.
the values of lines[2].get_xdata()[0] and lines[2].get_ydata()[0] is as follows:
0.5766199490353112
1648.0609161647387
Is there any way to find out what's going wrong? I'm using tkinter along with matplotlib
ro is color-marker code. You should remove c=:
figplot.plot(lines[2].get_xdata()[0], lines[2].get_ydata()[0], 'ro')
Or maybe specify color without the marker o:
figplot.plot(lines[2].get_xdata()[0], lines[2].get_ydata()[0], c='r')
I try to run the following python code (Python 3.4.7 + scipy installed; MikTeX 2.9.4476 installed; Windows 7)
from matplotlib import pyplot as plt
from matplotlib.pyplot import rc
rc('text', usetex=True)
# plotting
data = range(100)
plt.plot(data, data, label='0.3 m')
plt.legend()
plt.savefig("test.png")
plt.savefig("test.svg")
# plt.show()
and get the following errors if I use plt.savefig("test.svg") or any other vector graphics format. Without this saving command everything works fine. Printed Errors:
Traceback (most recent call last):
File "U:\ICCAP\S_SVN\ETHAN\test.py", line 12, in <module>
plt.savefig("test.svg")
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\pyplot.py", line 688, in savefig
res = fig.savefig(*args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\figure.py", line 1539, in savefig
self.canvas.print_figure(*args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\backend_bases.py", line 2230, in print_figure
**kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\backends\backend_svg.py", line 1206, in print_svg
return self._print_svg(filename, svgwriter, fh_to_close, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\backends\backend_svg.py", line 1234, in _print_svg
self.figure.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\figure.py", line 1133, in draw
func(*args)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\axes\_base.py", line 2304, in draw
a.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\legend.py", line 482, in draw
self._legend_box.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\offsetbox.py", line 286, in draw
c.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\offsetbox.py", line 286, in draw
c.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\offsetbox.py", line 286, in draw
c.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\offsetbox.py", line 286, in draw
c.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\offsetbox.py", line 867, in draw
self._text.draw(renderer)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\text.py", line 792, in draw
mtext=mtext)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\backends\backend_svg.py", line 1152, in draw_tex
self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\backends\backend_svg.py", line 957, in _draw_text_as_path
return_new_glyphs_only=True)
File "C:\WinPython-32bit-3.4.3.7Qt5\python-3.4.3\lib\site-packages\matplotlib\textpath.py", line 346, in get_glyphs_tex
font.select_charmap(charmap_code)
RuntimeError: In select_charmap: Could not set the charmap
any ideas what's going wrong/ could be improved?
I also had the same issue, and I fixed it by upgrading matplotlib to 1.5.1. It seems to be related with Matplotlib trying to render some fonts and not catching an exception that should've been caught.
Related: https://github.com/matplotlib/matplotlib/pull/5770#issuecomment-168212746
I am trying to use matplotlib plotting library inside PyQt4 to plot loglog plot. I have added two lines of code in the class:
class MyStaticMplCanvas(MyMplCanvas):
"""Simple canvas with a sine plot."""
def compute_initial_figure(self):
t = arange(0.0, 3.0, 0.01)
s = abs((t * 1E+1) * sin(2 * pi * t) + 1E1)
self.axes.plot(t, s)
self.axes.set_yscale('log') #added code
self.axes.set_xscale('log') #added code
but then axes disappeared and got an error below. I would like to ask you how can I use matplotlib library inside PyQt4 to plot loglot plot. As seen in the figure below. Python 2.7.5, matplotlib 1.3.0, PyQt 4.10.4
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\matplotlib\backends\backend_qt4.py", line 299, in resizeEvent
self.draw()
File "C:\Python27\Lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 148, 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 54, 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 54, 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 54, 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'
This is probably because your x-range includes 0. True log scales can't reach 0. If you want to include 0, you'll need to use 'semilog' instead.
Judging from the error message you're getting, I'd bet you're using a fairly old release of matplotlib? For what it's worth, in newer versions, including 0 will cause the scale to be automatically changed to semilog instead of log.
Either way, try specifying a semilog scale, and see if that helps. E.g.
self.axes.set(xscale='semilog', yscale='semilog')
I am currently dealing with an inexplicable bug in python+matplotlib+numpy. I'm under Ubuntu 13.04 x64 in a VirtualBox hosted by Windows 7 pro x64 and I use python 2.7 (installed from the Ubuntu repositories).
Consider the following script that plots y as a function of x from a two column file named data.txt :
#!/usr/bin/env python
import numpy as np
import matplotlib as mpl
mpl.rcParams['text.usetex']=True
import matplotlib.pyplot as plt
x, y = np.loadtxt("data.txt", unpack=True)
plt.plot(x, y)
plt.show()
And consider the following data.txt :
-49.5938 2.0
-40.6585 0.156267
-39.7351 0.0616373
-39.1767 0.00565121
-38.7736 -0.0346863
-38.4573 -0.0664897
-38.1965 -0.0929013
-37.9744 -0.115588
-37.7809 -0.135542
-37.6093 -0.153403
-37.4551 -0.169605
-37.3151 -0.18446
-37.1868 -0.198198
-37.0684 -0.210994
-36.9584 -0.222983
-36.8722 -0.232458
-36.8228 -0.237918
-36.7749 -0.243232
-36.7284 -0.248409
-36.6833 -0.253457
-36.6395 -0.258382
-36.5968 -0.263192
-36.5553 -0.267892
-36.5149 -0.272489
-36.4754 -0.276987
-36.437 -0.281392
-36.3994 -0.285707
-36.3628 -0.289937
-36.3269 -0.294086
-36.2919 -0.298157
-36.2577 -0.302154
-36.2241 -0.30608
-36.1913 -0.309937
-36.1591 -0.313729
-36.1276 -0.317458
-36.0966 -0.321126
-36.0663 -0.324736
-36.0366 -0.32829
-36.0074 -0.33179
-35.9787 -0.335238
-35.9505 -0.338635
-35.9228 -0.341984
-35.8956 -0.345286
-35.8688 -0.348542
-35.8425 -0.351755
-35.8166 -0.354925
-35.7912 -0.358053
-35.7661 -0.361142
-35.7414 -0.364192
-35.7171 -0.367205
-35.6931 -0.37018
-35.6695 -0.373121
-35.6463 -0.376027
-35.6234 -0.378899
-35.6008 -0.381739
-35.5785 -0.384547
-35.5565 -0.387324
-35.5348 -0.390071
-35.5134 -0.392789
-35.4923 -0.395479
-35.4714 -0.39814
-35.4508 -0.400775
-35.4305 -0.403383
-35.4104 -0.405965
-35.3906 -0.408522
-35.371 -0.411054
-35.3517 -0.413563
-35.3326 -0.416047
-35.3137 -0.418509
-35.295 -0.420948
-35.2765 -0.423366
-35.2582 -0.425762
-35.2402 -0.428137
-35.2223 -0.430491
-35.2047 -0.432825
-35.1872 -0.43514
-35.1699 -0.437435
-35.1528 -0.439711
-35.1358 -0.44197
-35.119 -0.444212
-35.1024 -0.44644
-35.0859 -0.448658
-35.0694 -0.450878
-35.0529 -0.453105
-35.0363 -0.455341
-35.0195 -0.457613
-35.0024 -0.459933
-34.9849 -0.462312
-34.9669 -0.464766
-34.9483 -0.467309
-34.9292 -0.469936
-34.9092 -0.472681
-34.8886 -0.475519
-34.8672 -0.47848
-34.8449 -0.481569
-34.8219 -0.484767
-34.7982 -0.48807
-34.7739 -0.491477
-34.7491 -0.494958
-34.7241 -0.49848
-34.6992 -0.502011
-34.6742 -0.505551
-34.6495 -0.509079
-34.625 -0.512581
-34.6007 -0.516063
-34.5767 -0.519519
-34.553 -0.522941
-34.5296 -0.526332
-34.5065 -0.529692
-34.4837 -0.533017
-34.4612 -0.536311
-34.439 -0.539573
-34.4171 -0.542805
-34.3954 -0.546006
-34.374 -0.549176
-34.3529 -0.552316
-34.3321 -0.555427
-34.3115 -0.55851
-34.2912 -0.561564
-34.2711 -0.564591
-34.2512 -0.567592
-34.2316 -0.570566
-34.2121 -0.573515
-34.193 -0.576439
-34.174 -0.579339
-34.1552 -0.582214
-34.1367 -0.585066
-34.1183 -0.587895
-34.1002 -0.590701
-34.0822 -0.593485
-34.0644 -0.596248
-34.0468 -0.598989
-34.0294 -0.601709
-34.0122 -0.604409
-33.9951 -0.607089
-33.9783 -0.609748
-33.9615 -0.612389
-33.945 -0.615011
-33.9286 -0.617614
-33.9123 -0.620199
-33.8962 -0.622766
-33.8803 -0.625315
-33.8645 -0.627847
-33.8489 -0.630361
-33.8334 -0.632859
-33.818 -0.635341
-33.8028 -0.637806
-33.7877 -0.640256
-33.7727 -0.64269
-33.7579 -0.645108
-33.7432 -0.647511
-33.7286 -0.6499
-33.7141 -0.652274
-33.6998 -0.654634
-33.6856 -0.65698
-33.6714 -0.659315
-33.6574 -0.661635
-33.6435 -0.663947
-33.6297 -0.666249
-33.6159 -0.668547
-33.6022 -0.670835
-33.5885 -0.673127
-33.5749 -0.67542
-33.5612 -0.677726
-33.5475 -0.680025
-33.5338 -0.682341
-33.5201 -0.684666
-33.5062 -0.687017
-33.4923 -0.689387
-33.4782 -0.691796
-33.4639 -0.694247
-33.4494 -0.696723
-33.4347 -0.69924
-33.4199 -0.7018
-33.4047 -0.704414
-33.3893 -0.707087
-33.3737 -0.709791
-33.3578 -0.712549
-33.3418 -0.71534
-33.3255 -0.718181
-33.3091 -0.721056
-33.2924 -0.723999
-33.2755 -0.726975
-33.2585 -0.729988
-33.2412 -0.733045
-33.2237 -0.736152
-33.2061 -0.739295
-33.1884 -0.742461
-33.1706 -0.745656
-33.1525 -0.748904
-33.1344 -0.752172
-33.1162 -0.755459
-33.098 -0.758756
-33.0798 -0.762079
-33.0616 -0.765406
-33.0434 -0.768737
-33.0252 -0.772066
-33.0072 -0.775386
-32.9892 -0.778712
-32.9713 -0.78203
-32.9535 -0.785343
-32.9358 -0.788648
-32.9182 -0.791942
-32.9007 -0.795223
-32.8833 -0.798485
-32.8661 -0.801738
-32.8489 -0.804987
-32.8319 -0.808216
-32.8151 -0.811425
-32.7984 -0.814617
-32.7817 -0.817795
-32.7653 -0.82096
-32.7489 -0.824109
-32.7327 -0.82724
-32.7166 -0.830353
-32.7007 -0.833449
-32.6848 -0.83653
-32.6691 -0.839596
-32.6536 -0.842642
-32.6381 -0.845671
-32.6228 -0.848682
-32.6076 -0.85168
-32.5925 -0.854664
-32.5776 -0.857631
-32.5627 -0.860578
-32.548 -0.863512
-32.5334 -0.866433
-32.5189 -0.869332
-32.5046 -0.872219
-32.4903 -0.87509
-32.4761 -0.877949
-32.4621 -0.880793
-32.4481 -0.883619
-32.4343 -0.886435
-32.4205 -0.889237
-32.4069 -0.892021
-32.3934 -0.894796
-32.3799 -0.897551
-32.3666 -0.900292
-32.3534 -0.903023
-32.3402 -0.905737
-32.3272 -0.908445
-32.3142 -0.911134
-32.3013 -0.913813
-32.2885 -0.916482
-32.2759 -0.919132
-32.2633 -0.921769
-32.2507 -0.924401
-32.2383 -0.92702
-32.2259 -0.929628
-32.2136 -0.932223
-32.2015 -0.934805
-32.1893 -0.937376
-32.1773 -0.939932
-32.1654 -0.942481
-32.1535 -0.94502
-32.1417 -0.947543
-32.13 -0.950056
-32.1183 -0.95256
-32.1068 -0.955052
-32.0952 -0.957536
-32.0838 -0.960005
-32.0725 -0.962469
-32.0612 -0.964924
-32.0499 -0.967368
-32.0387 -0.969807
-32.0276 -0.972236
-32.0165 -0.974663
-32.0055 -0.977076
-31.9946 -0.979485
If I try to execute the script, I got the following error :
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1473, in __call__
return self.func(*args)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 276, in resize
self.show()
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 348, in draw
FigureCanvasAgg.draw(self)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 440, in draw
self.figure.draw(self.renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1006, in draw
func(*args)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in draw
a.draw(renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1052, in draw
renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1001, in _get_tick_bboxes
extent = tick.label1.get_window_extent(renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/text.py", line 752, in get_window_extent
bbox, info = self._get_layout(self._renderer)
File "/usr/lib/pymodules/python2.7/matplotlib/text.py", line 313, in _get_layout
ismath=ismath)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 200, in get_text_width_height_descent
renderer=self)
File "/usr/lib/pymodules/python2.7/matplotlib/texmanager.py", line 606, in get_text_width_height_descent
page = next(iter(dvi))
File "/usr/lib/pymodules/python2.7/matplotlib/dviread.py", line 71, in __iter__
have_page = self._read()
File "/usr/lib/pymodules/python2.7/matplotlib/dviread.py", line 126, in _read
byte = ord(self.file.read(1)[0])
IndexError: string index out of range
The interesting thing, is that :
If I replace the two last values of the file by -32.0 -1.0 it works
If I remove mpl.rcParams['text.usetex']=True it also works
I would be very happy if one have any explanation about that very bizarre problem.