473,573 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

matplotlib, usetex

Hi, I'm having some trouble plotting with the following matplotlibrc:

text.usetex : True

I tried clearing the cache files under ~/.matplotlib, but this did not
help the problem. I'd post on the matplotlib mailing list, but I have a
hard enough time browsing sourceforge's achives (frequent internal
server errors). Here is some output:
---- example.py ----
import pylab
pylab.plot(rang e(10))
pylab.show()
--------------------

# python example.py --verbose-helpful
matplotlib data path /usr/share/matplotlib/mpl-data
$HOME=/home/me
loaded rc file /home/me/matplotlibrc
matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 24.2
font search path ['/usr/share/matplotlib/mpl-data']
CONFIGDIR=/home/me/.matplotlib
loaded ttfcache file /home/me/.matplotlib/ttffont.cache
backend GTK version 2.10.4
Traceback (most recent call last):
File "example.py ", line 2, in <module>
pylab.plot(rang e(10))
File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line
2027, in plot
ret = gca().plot(*arg s, **kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
2131, in plot
self.autoscale_ view(scalex=sca lex, scaley=scaley)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 985,
in autoscale_view
self.set_xlim(X L)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
1227, in set_xlim
self.viewLim.in tervalx().set_b ounds(xmin, xmax)
TypeError: only length-1 arrays can be converted to Python scalars.
The problem does not exist when text.usetex is False. Ideas?

May 25 '07 #1
4 3334
Bill Jackson <ja*****@hotmai l.comwrites:
>
The problem does not exist when text.usetex is False. Ideas?
I have no idea whether this will resolve your problem, but you could try
updating to 0.90 (BTW what happens if you do axis([0,128,0,128])).

cheers,

'as
May 25 '07 #2
Alexander Schmolck wrote the following on 05/25/2007 02:33 PM:
(BTW what happens if you do axis([0,128,0,128])).
In [1]: import pylab

In [2]: pylab.axis([0,128,0,128])

In [3]: pylab.show()
---------------------------------------------------------------------------
<type 'exceptions.Not ImplementedErro r' Traceback (most recent call last)

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py in
expose_event(se lf, widget, event)
282 x, y, w, h = self.allocation
283 self._pixmap_pr epare (w, h)
--284 self._render_fi gure(self._pixm ap, w, h)
285 self._need_redr aw = False
286

/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py in
_render_figure( self, pixmap, width, height)
270 """
271 self._renderer. set_width_heigh t (width, height)
--272 self.figure.dra w (self._renderer )
273
274

/usr/lib/python2.5/site-packages/matplotlib/figure.py in draw(self,
renderer)
542
543 # render the axes
--544 for a in self.axes: a.draw(renderer )
545
546 # render the figure text

/usr/lib/python2.5/site-packages/matplotlib/axes.py in draw(self,
renderer, inframe)
1061
1062 for zorder, i, a in dsu:
-1063 a.draw(renderer )
1064
1065 self.transData. thaw() # release the lazy objects

/usr/lib/python2.5/site-packages/matplotlib/axis.py in draw(self,
renderer, *args, **kwargs)
559 tick.set_label1 (label)
560 tick.set_label2 (label)
--561 tick.draw(rende rer)
562 if tick.label1On and tick.label1.get _visible():
563 extent = tick.label1.get _window_extent( renderer)

/usr/lib/python2.5/site-packages/matplotlib/axis.py in draw(self, renderer)
159 if self.tick2On: self.tick2line. draw(renderer)
160
--161 if self.label1On: self.label1.dra w(renderer)
162 if self.label2On: self.label2.dra w(renderer)
163

/usr/lib/python2.5/site-packages/matplotlib/text.py in draw(self, renderer)
836 def draw(self, renderer):
837 self.update_coo rds(renderer)
--838 Text.draw(self, renderer)
839 if self.get_dashle ngth() 0.0:
840 self.dashline.d raw(renderer)

/usr/lib/python2.5/site-packages/matplotlib/text.py in draw(self, renderer)
348
349 renderer.draw_t ex(gc, x, y, line,
--350 self._fontprope rties, angle)
351 return
352

/usr/lib/python2.5/site-packages/matplotlib/backend_bases.p y in
draw_tex(self, gc, x, y, s, prop, angle, ismath)
379
380 def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'):
--381 raise NotImplementedE rror
382
383 def draw_text(self, gc, x, y, s, prop, angle, ismath=False):

<type 'exceptions.Not ImplementedErro r'>:

In [4]:

May 25 '07 #3
Alexander Schmolck wrote the following on 05/25/2007 02:33 PM:
I have no idea whether this will resolve your problem, but you could try
updating to 0.90 (BTW what happens if you do axis([0,128,0,128])).
The problem appears to be with a matplotlibrc file. If I delete the
matplotlibrc file, then I am able to plot perfectly. Thus, it appears
that I am unable to specify usetex from my configuration file. Why is
this happening?

---- ~/.matplotlib/matplotlibrc ----
text.usetex : True

---- test.py ----
import matplotlib
import pylab
matplotlib.rc(' text', usetex=True)
pylab.plot(rang e(10))
pylab.show()
Running 'python test.py' with the above matplotlibrc causes the errors
in my original post. Deleting matplotlibrc resolves the problem.

May 26 '07 #4
Bill Jackson <ja*****@hotmai l.comwrites:
Alexander Schmolck wrote the following on 05/25/2007 02:33 PM:
>I have no idea whether this will resolve your problem, but you could try
updating to 0.90 (BTW what happens if you do axis([0,128,0,128])).

The problem appears to be with a matplotlibrc file. If I delete the
matplotlibrc file, then I am able to plot perfectly. Thus, it appears that I
am unable to specify usetex from my configuration file. Why is this
happening?

---- ~/.matplotlib/matplotlibrc ----
text.usetex : True

---- test.py ----
import matplotlib
import pylab
matplotlib.rc(' text', usetex=True)
I think it might be a good habit to develop to call ``rc`` before ``import
pylab`` -- some things won't take effect otherwise (this doesn't affect all
parameters and will likely be eventually fixed in general, but notably it does
currently affect some latex-related stuff, such as font choice).
pylab.plot(rang e(10))
pylab.show()
Running 'python test.py' with the above matplotlibrc causes the errors in my
original post. Deleting matplotlibrc resolves the problem.
I can't see any problem with you matplotlibrc; what happens if you swap around
the lines as I suggested above? Maybe it just appears to work, because the
usetex really does have no affect above, and you really are not using latex?

I have been using matplotlib with latex for fonts handling for some time now
(and I've even submitted a patch to ameliorate the rc problem mentioned
above), but the latex stuff has changed somewhat over time, and still has some
rough edges -- so for not immediately obvious problems with the latex handling
of an older version of matplotlib you're much more likely to find someone who
has the relevant details mentally available on the matplotlib-disc list are
much better than here; so I'd recommend you give it a try again (yeah sf is a
pain).

cheers,

'as

May 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1757
by: John Hunter | last post by:
matplotlib is a 2D plotting package for python with a matlab compatible syntax and output tested under linux and windows platforms. matplotlib-0.30 is available for download at http://matplotlib.sourceforge.net, and has many new features since the last major release. Multiple outputs matplotlib now supports postscript and GD output, as...
3
2606
by: John Hunter | last post by:
matplotlib is a 2D plotting library for python. You can use matplotlib interactively from a python shell or IDE, or embed it in GUI applications (WX, GTK, and Tkinter). matplotlib supports many plot types: line plots, bar charts, log plots, images, pseudocolor plots, legends, date plots, finance charts and more. What's new since...
2
11642
by: Grant Edwards | last post by:
I downloaded examples/contour_demo.py, and it doesn't run. I've searched both the user guide and the Wiki for "contour" and got zero hits. http://matplotlib.sourceforge.net/matplotlib.pylab.html#-contour appears to be a good reference if you already know how to use contour(), but I could glean zero clues from it on how to actually use...
0
2584
by: spross | last post by:
hi all i have to use matplotlib on mac os x. on the official site of matplotlib, i found a link to precompiled python packages for mac os x: http://pythonmac.org/packages/py24-fat/index.html so first, i installed python 2.4. that works great! if i type 'python' in the terminal, it loads python 2.4. after that, i loaded and installed...
0
3391
by: Soren | last post by:
Hi, I've been trying to embed matplotlib in wxpython. I want to be able to put a figure (axes) in a wx.Panel and place it somewhere in my GUI. The GUI should have other panels with buttons etc. that can control the output on the figure. I've been looking at the examples from the matplotlib website, but can't seem to get it to work.. Does...
3
4706
by: vajratkarviraj | last post by:
i hav python2.5, matplotlib0.90.1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.py) which uses the matplotlib package... and i want 2 make an exe of it for distribution on other comps... i used py2exe... i wrote a setup.py whose contents are : from distutils.core import setup import py2exe import matplotlib ...
2
3520
by: John | last post by:
I'm trying to install matplotlib and currently getting the below error. I searched the group and google and couldn't find anything similar... Any ideas? Thanks in advance! src/ft2font.cpp: In member function 'Py::Object Glyph::get_path(FT_FaceRec_* const&)': src/ft2font.cpp:441: error: 'FT_CURVE_TAG_CUBIC' was not declared in this scope
4
9665
by: John Henry | last post by:
Has anybody been able to create an exe of their python applications involving matplotlib using pyinstall (ver 1.3)? I am getting a: RuntimeError: Could not find the matplotlib data files when I attempt to run the exe created. In searching the web, it appears this is an issue when others tried to use py2exe as well. Unfortunately, the...
0
4322
by: PamMish1982 | last post by:
Hi all, I have recently started using Python and I am trying to make a GUI out of Tkinter. I am using matplotlib for the graphic purposes. I have to make a exe file from this code. I use py2exe for this purpose but every time I try to make this exe using a setup file I get these errors. Final.py is my python code. Traceback (most recent call...
0
7705
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7796
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5294
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3734
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3739
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1316
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1044
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.