473,738 Members | 3,854 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 3350
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
1770
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 well as the
3
2623
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 matplotlib 0.50 This is the first wide release in 5 months and there has been a tremendous amount of...
2
11649
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 contour(). For example, it doesn't explain what the actual formats/types of the parameters. It...
0
2597
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 the matplotlib package from this
0
3402
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 anyone here have experience in embedding matplotlib in wxpython?
3
4721
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 setup(console=, options={ 'py2exe': { 'packages' : ,
2
3529
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
9687
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 few hits I saw doesn't include enough details to inspire me as to what I should be doing in my
0
4330
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 last): File "Final.py", line 5, in <module> File "pylab.pyc", line 1, in <module> File...
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9334
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.