SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(8)
2
(2)
3
(11)
4
(11)
5
(3)
6
(3)
7
(8)
8
(1)
9
(10)
10
(16)
11
(1)
12
(8)
13
(21)
14
(13)
15
(15)
16
(6)
17
(12)
18
(2)
19
(6)
20
(6)
21
(5)
22
(2)
23
(9)
24
25
26
(2)
27
(3)
28
(2)
29
(10)
30
(2)
31
(4)

Showing 20 results of 20

From: Uri L. <las...@mi...> - 2010年12月13日 23:57:43
>
>
> Well, on my Linux system, when I get that error, it happens when I do
> an update of numpy, but fail to rebuild mpl. Here is the order how I
> build things: numpy, scipy, matplotlib. I would imagine ipython goes
> last.
>
>
That has been my order as well. How can I track down why the import of
numpy.core.multiarray is causing the problem? And why would it cause a
problem only when MPL is being imported, but not if I import it manually?
Originally, I tried to build the GitHub trunk version of numpy, but then
abandoned that. Since MPL is saying that it was built against the 20000...
ABI rather than the 10000... ABI, is it possible the MPL is finding some
other version of numpy lying around? However, I'm pretty sure I deleted
everything from the git numpy build. How could I pinpoint which numpy
libraries are being linked against in the MPL build?
Uri
From: Benjamin R. <ben...@ou...> - 2010年12月13日 23:37:24
On Monday, December 13, 2010, Uri Laserson <las...@mi...> wrote:
>
> Can you try importing pyplot from a regular python prompt? If that
> works, then the issue is with ipython messing up the import process of
> mpl.
>
> I get exactly the same problem...
>
>
> laserson@hobbes:~$ pythonPython 2.7.1 (r271:86832, Dec 13 2010, 14:21:05) [GCC 4.2.1 (Apple Inc. build 5664)] on darwinType "help", "copyright", "credits" or "license" for more information.
>
>>>> import matplotlib>>> import matplotlib.pyplotRuntimeError: module compiled against ABI version 2000000 but this version of numpy is 1000009Traceback (most recent call last):
>
>  File "<stdin>", line 1, in <module> File "/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/pyplot.py", line 23, in <module>  from matplotlib.figure import Figure, figaspect
>
>  File "/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/figure.py", line 16, in <module>  import artist File "/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/artist.py", line 6, in <module>
>
>   from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath File "/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/transforms.py", line 34, in <module>
>
>   from matplotlib._path import affine_transformImportError: numpy.core.multiarray failed to import>>>
>
Well, on my Linux system, when I get that error, it happens when I do
an update of numpy, but fail to rebuild mpl. Here is the order how I
build things: numpy, scipy, matplotlib. I would imagine ipython goes
last.
Ben Root
From: Uri L. <las...@mi...> - 2010年12月13日 22:40:02
>
>
> Can you try importing pyplot from a regular python prompt? If that
> works, then the issue is with ipython messing up the import process of
> mpl.
>
>
I get exactly the same problem...
laserson@hobbes:~$ python
Python 2.7.1 (r271:86832, Dec 13 2010, 14:21:05)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import matplotlib.pyplot
RuntimeError: module compiled against ABI version 2000000 but this version
of numpy is 1000009
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File
"/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/pyplot.py",
line 23, in <module>
 from matplotlib.figure import Figure, figaspect
 File
"/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/figure.py",
line 16, in <module>
 import artist
 File
"/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/artist.py",
line 6, in <module>
 from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
 File
"/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/transforms.py",
line 34, in <module>
 from matplotlib._path import affine_transform
ImportError: numpy.core.multiarray failed to import
>>>
From: Benjamin R. <ben...@ou...> - 2010年12月13日 22:25:53
On Monday, December 13, 2010, Uri Laserson <las...@mi...> wrote:
> Hi all,
> I am trying to install matplotlib on a MacMini Intel Core 2 Duo with a clean install of Mac OS X 10.6. I am using python 2.7 that I built from source using the homebrew package installer. I also installed numpy 1.5.1 from source, using the following environment variables:
>
>
> export MACOSX_DEPLOYMENT_TARGET=10.6export CFLAGS="-arch i386 -arch x86_64"
>
> export FFLAGS="-m32 -m64"export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64 -framework Accelerate"
> I also used gfortran 4.2.3 precompiled that I downloaded from http://r.research.att.com/tools/
>
>
> NOTE: I previously performed this whole install process on a brand new MacBook Air, and it worked without a problem.
> I ran numpy.test() and got the following output:
>
>
> In [4]: numpy.test()Running unit tests for numpyNumPy version 1.5.1NumPy is installed in /usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/numpyPython version 2.7.1 (r271:86832, Dec 13 2010, 14:21:05) [GCC 4.2.1 (Apple Inc. build 5664)]
>
> nose version 0.11.4
> [...snip...]
> Ran 3006 tests in 18.696s
> OK (KNOWNFAIL=4, SKIP=1)Out[4]: <nose.result.TextTestResult run=3006 errors=0 failures=0>
>
>
> Also, when I try to import numpy.core.multiarray, I get no errors.
> Finally, I cloned the latest GitHub MPL and set make.osx to be the following (note: changed pyversion, pngfamily, pngversion, deployment target, and the FFLAGS variable):
>
>
> # build mpl into a local install dir with# PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_installMPLVERSION=1.0rc1PYVERSION=2.7PYTHON=python${PYVERSION}
>
> ZLIBVERSION=1.2.3PNGFAMILY=12PNGVERSION=1.2.44FREETYPEVERSION=2.3.11MACOSX_DEPLOYMENT_TARGET=10.6OSX_SDK_VER=10.6ARCH_FLAGS="-arch i386 -arch x86_64"
>
>
> ## You shouldn't need to configure past this point
> PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"CFLAGS="-arch i386 -arch x86_64 -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
>
> LDFLAGS="-arch i386 -arch x86_64 -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"FFLAGS="-arch i386 -arch x86_64"
> The install seems to go fine. I can import matplotlib. But when I import matplotlib.pyplot, I get the following:
>
>
> In [2]: import matplotlib.pyplot---------------------------------------------------------------------------RuntimeError               Traceback (most recent call last)
>
>
>
> RuntimeError: module compiled against ABI version 2000000 but this version of numpy is 1000009---------------------------------------------------------------------------
>
> ImportError                Traceback (most recent call last)
> /Users/laserson/<ipython console> in <module>()
> /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
>
>   21 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike   22 from matplotlib import docstring---> 23 from matplotlib.figure import Figure, figaspect
>   24 from matplotlib.backend_bases import FigureCanvasBase
>   25 from matplotlib.image import imread as _imread
> /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/figure.py in <module>()   14 import numpy as np
>
>   15 ---> 16 import artist   17 from artist import Artist, allow_rasterization   18 from axes import Axes, SubplotBase, subplot_class_factory
> /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/artist.py in <module>()
>
>    4 import matplotlib.cbook as cbook   5 from matplotlib import docstring, rcParams----> 6 from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath   7 from path import Path
>
>    8
> /Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/transforms.py in <module>()   32 import numpy as np   33 from numpy import ma
>
> ---> 34 from matplotlib._path import affine_transform   35 from numpy.linalg import inv   36
> ImportError: numpy.core.multiarray failed to import
>
>
> It is strange because when I import numpy.core.multiarray, I have no problems. It also raises a RuntimeError, yelling about an ABI incompatibility.
> Does anyone know how to solve this problem? I was able to get this to work on another computer..strange that it fails now.
>
>
> Thanks!Uri
> ...................................................................................Uri Laserson
> Graduate Student, Biomedical Engineering
> Harvard-MIT Division of Health Sciences and Technology
> M +1 917 742 8019
> las...@mi...
>
>
Can you try importing pyplot from a regular python prompt? If that
works, then the issue is with ipython messing up the import process of
mpl.
Ben Root
From: mdekauwe <mde...@gm...> - 2010年12月13日 22:03:33
Here is a solution which doesn't really use matplotlib, however it is a work
around by interfacing with the R library. Personally I didn't like some of
the colour choices which are hardwired in the R code so I adjusted the R
code and re-compiled, however this assumes the code is as it comes from
Cran. It should produce a plot with two "models" compared to the observed.
#!/usr/bin/env python
import sys
from rpy2.robjects.packages import importr
import rpy2.robjects as robjects
import numpy as np
import rpy2.robjects.numpy2ri
# Note depends on R package plotrix
r = robjects.r
p = importr('plotrix')
r.pdf('x.pdf')
# make up some data, compare (any number of) models with observed
obs = np.random.random_sample(10)
mod = np.random.random_sample(10)
mod2 = np.random.random_sample(10) # etc
model_list = [mod, mod2]
first_model_comp = True # just a hack so that after first comparsion we call
"add=True"
colour_list = ['blue','green','red'] 
i = 0
for model in model_list:
 
 # make taylor plot...
 if first_model_comp == True:
 p.taylor_diagram(obs, model, normalize=False, main='',
pos_cor=False, pcex=1.5, col=colour_list[i])
 first_model_comp = False
 else:
 p.taylor_diagram(obs, model, add=True, normalize=False, pcex=1.5,
col=colour_list[i])
 i += 1
# Observations are hardwired in the R code, so this is hack so that
everything is nicely
# declared in the legend. All need to be passed as numpy arrays as Rpy2 has
an issue with
# tuples...no doubt there is a better solution, however this works!
colour_list.append('darkgreen')
colour_list = np.array(colour_list)
shapes = np.array([19,19,15]) # circles and a square for the observation
model_list.append("Observation") # add observation to the list of vars
legendlist = np.array(['Model1', 'Model2'])
r.legend("topleft", legend=legendlist, pch=shapes, col=colour_list,
cex=0.75)
r['dev.off']()
Martin
-- 
View this message in context: http://old.nabble.com/Taylor-diagram-tp30421393p30449840.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Uri L. <las...@mi...> - 2010年12月13日 21:46:05
Hi all,
I am trying to install matplotlib on a MacMini Intel Core 2 Duo with a clean
install of Mac OS X 10.6. I am using python 2.7 that I built from source
using the homebrew package installer. I also installed numpy 1.5.1 from
source, using the following environment variables:
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch
x86_64 -framework Accelerate"
I also used gfortran 4.2.3 precompiled that I downloaded from
http://r.research.att.com/tools/
NOTE: I previously performed this whole install process on a brand new
MacBook Air, and it worked without a problem.
I ran numpy.test() and got the following output:
In [4]: numpy.test()
Running unit tests for numpy
NumPy version 1.5.1
NumPy is installed in
/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/numpy
Python version 2.7.1 (r271:86832, Dec 13 2010, 14:21:05) [GCC 4.2.1 (Apple
Inc. build 5664)]
nose version 0.11.4
[...snip...]
Ran 3006 tests in 18.696s
OK (KNOWNFAIL=4, SKIP=1)
Out[4]: <nose.result.TextTestResult run=3006 errors=0 failures=0>
Also, when I try to import numpy.core.multiarray, I get no errors.
Finally, I cloned the latest GitHub MPL and set make.osx to be the following
(note: changed pyversion, pngfamily, pngversion, deployment target, and the
FFLAGS variable):
# build mpl into a local install dir with
# PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install
MPLVERSION=1.0rc1
PYVERSION=2.7
PYTHON=python${PYVERSION}
ZLIBVERSION=1.2.3
PNGFAMILY=12
PNGVERSION=1.2.44
FREETYPEVERSION=2.3.11
MACOSX_DEPLOYMENT_TARGET=10.6
OSX_SDK_VER=10.6
ARCH_FLAGS="-arch i386 -arch x86_64"
## You shouldn't need to configure past this point
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="-arch i386 -arch x86_64 -I${PREFIX}/include
-I${PREFIX}/include/freetype2 -isysroot
/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
LDFLAGS="-arch i386 -arch x86_64 -L${PREFIX}/lib
-syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
FFLAGS="-arch i386 -arch x86_64"
The install seems to go fine. I can import matplotlib. But when I import
matplotlib.pyplot, I get the following:
In [2]: import matplotlib.pyplot
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against ABI version 2000000 but this version
of numpy is 1000009
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/laserson/<ipython console> in <module>()
/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/pyplot.py
in <module>()
 21 from matplotlib.cbook import dedent, silent_list, is_string_like,
is_numlike
 22 from matplotlib import docstring
---> 23 from matplotlib.figure import Figure, figaspect
 24 from matplotlib.backend_bases import FigureCanvasBase
 25 from matplotlib.image import imread as _imread
/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/figure.py
in <module>()
 14 import numpy as np
 15
---> 16 import artist
 17 from artist import Artist, allow_rasterization
 18 from axes import Axes, SubplotBase, subplot_class_factory
/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/artist.py
in <module>()
 4 import matplotlib.cbook as cbook
 5 from matplotlib import docstring, rcParams
----> 6 from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
 7 from path import Path
 8
/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/transforms.py
in <module>()
 32 import numpy as np
 33 from numpy import ma
---> 34 from matplotlib._path import affine_transform
 35 from numpy.linalg import inv
 36
ImportError: numpy.core.multiarray failed to import
It is strange because when I import numpy.core.multiarray, I have no
problems. It also raises a RuntimeError, yelling about an ABI
incompatibility.
Does anyone know how to solve this problem? I was able to get this to work
on another computer..strange that it fails now.
Thanks!
Uri
...................................................................................
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
las...@mi...
From: Friedrich R. <fri...@gm...> - 2010年12月13日 21:35:46
2010年12月13日 Will Grover <wg...@mi...>:
> A belated thank you to Ben and Friedrich for your suggestions! I'm getting
> good results shifting subplots around using Axes.set_position() as Friedrich
> suggested, but I've noticed that whenever I shift a subplot into the region
> where another subplot would be, the subplot I'm shifting just disappears.
> This code demonstrates this; it creates a figure of six subplots and
> attempts to shift subplots 5 and 6 to the right:
> import pylab
> offset = 0.04   # works for 0.04, but subplot 5 disappears at >0.05
> pylab.subplot(2,3,1)
> pylab.subplot(2,3,2)
> pylab.subplot(2,3,3)
> pylab.subplot(2,3,4)
> pylab.subplot(2,3,5)
> bbox=pylab.gca().get_position()
> pylab.gca().set_position([bbox.x0 + offset, bbox.y0, bbox.x1-bbox.x0,
> bbox.y1-bbox.y0])
> pylab.subplot(2,3,6)
> bbox=pylab.gca().get_position()
> pylab.gca().set_position([bbox.x0 + offset, bbox.y0, bbox.x1-bbox.x0,
> bbox.y1-bbox.y0])
> pylab.savefig("out.png")
> Setting offset to 0.04 results in subplots 5 and 6 being shifted to the
> right a bit, as expected (see 0_04_offset.png), but if offset >= 0.05
> subplot 5 disappears (see 0_05_offset.png). The funny thing is that you can
> keep increasing offset and subplot 6 keeps moving (see 0_20_offset.png), so
> it seems that you can use Axes.set_position() to move subplots anywhere
> *except* into the space formerly occupied by another subplot. Is this
> correct? Is there any way around this or am I using the wrong tool for the
> job? Thanks again for your help,
This looks pretty much like a bug to me, since insets should place
Axes inside of other Axes. So things should not behave that way. But
my knowledge of this part of the API is pretty low, so someone else
with better knowledge should chime in? If at least Ben agrees on that
this is a bug, please file a bug report (it's somewhere in the sf
interface I believe).
Maybe, just to make a sanity check, make an even more simple script
with only two Axes. And afaik it's possible to attach files to bug
reports, so attach that script please. And: It really appears only if
shifting the bbox of an existent Axes? It works if a new Axes is
created with the offset from the beginning (I strongly believe it
does)? Your calls look ok to me.
I'm quite short of free time currently. Poke me in about a month if
you can efford this.
I'm not sure this helps (maybe in future it'll help :-)
Friedrich
From: Steve N. <ema...@ya...> - 2010年12月13日 20:55:23
Hello,
I recently upgraded matplotlib v0.98.5 to 1.0. Now when I try to plot data using latex for the figure labels my scripts fail. I have not changed my code so I'm not sure where the error is coming from. I have tried reinstalling and updating MikTex and Ghostscript but that has not helped (I'm running Windows 7 and Python 2.6). The actual error I get is below. Any thoughts?
Thanks,
Steve
Traceback (most recent call last):
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4.py", line 215, in resizeEvent
  self.draw()
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 130, in draw
  FigureCanvasAgg.draw(self)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 394, in draw
  self.figure.draw(self.renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in draw
  func(*args)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1934, in draw
  a.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 1017, in draw
  tick.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 236, in draw
  self.label2.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\text.py", line 524, in draw
  bbox, info = self._get_layout(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\text.py", line 307, in _get_layout
  ismath=ismath)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 171, in get_text_width_height_descent
  renderer=self)
 File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 608, in get_text_width_height_descent
  page = iter(dvi).next()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 65, in __iter__
  have_page = self._read()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
  self._dispatch(byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
  self._fnt_def(k, c, s, d, a, l, n)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 370, in _fnt_def
  vf = _vffile(n[-l:])
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 871, in _vffile
  return _fontfile(texname, Vf, '.vf', _vfcache)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 860, in _fontfile
  result = class_(filename)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 479, in __init__
  self._read()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
  self._dispatch(byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 508, in _dispatch
  Dvi._dispatch(self, byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
  self._fnt_def(k, c, s, d, a, l, n)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 546, in _fnt_def
  Dvi._fnt_def(self, k, *args)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 372, in _fnt_def
  self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 418, in __init__
  nchars = max(tfm.width.iterkeys()) + 1
AttributeError: 'NoneType' object has no attribute 'width'
Traceback (most recent call last):
 File "C:\Users\steve.nicholes\Documents\Beamformer\Design\SOA\SOA Design.py", line 333, in <module>
  show()
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4.py", line 71, in show
  figManager.canvas.draw()
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 130, in draw
  FigureCanvasAgg.draw(self)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 394, in draw
  self.figure.draw(self.renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in draw
  func(*args)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1934, in draw
  a.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 1017, in draw
  tick.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 236, in draw
  self.label2.draw(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
 File "C:\Python26\lib\site-packages\matplotlib\text.py", line 524, in draw
  bbox, info = self._get_layout(renderer)
 File "C:\Python26\lib\site-packages\matplotlib\text.py", line 307, in _get_layout
  ismath=ismath)
 File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 171, in get_text_width_height_descent
  renderer=self)
 File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 608, in get_text_width_height_descent
  page = iter(dvi).next()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 65, in __iter__
  have_page = self._read()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
  self._dispatch(byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
  self._fnt_def(k, c, s, d, a, l, n)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 370, in _fnt_def
  vf = _vffile(n[-l:])
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 871, in _vffile
  return _fontfile(texname, Vf, '.vf', _vfcache)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 860, in _fontfile
  result = class_(filename)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 479, in __init__
  self._read()
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
  self._dispatch(byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 508, in _dispatch
  Dvi._dispatch(self, byte)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
  self._fnt_def(k, c, s, d, a, l, n)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 546, in _fnt_def
  Dvi._fnt_def(self, k, *args)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 372, in _fnt_def
  self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
 File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 418, in __init__
  nchars = max(tfm.width.iterkeys()) + 1
AttributeError: 'NoneType' object has no attribute 'width'
 
From: Benjamin R. <ben...@ou...> - 2010年12月13日 20:50:30
On Mon, Dec 13, 2010 at 2:13 PM, Ryan May <rm...@gm...> wrote:
> On Mon, Dec 13, 2010 at 2:07 PM, vt603800 <vt6...@ba...> wrote:
> > I get this error:
> > AttributeError: 'module' object has no attribute 'subplot2grid'
> >
> > Are some modules not installed? or is there another problem, I'm a newby
> in
> > matplotlib, it might be something very obvious...
> >
> > Running Matplotlib version 0.99.3 (python 2.6.6) on Ubuntu 10.10
>
> I'm 90% certain that the subplot2grid feature was added in 1.0. You
> could build and install from source:
>
>
> https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/
>
> Ryan
>
>
Yes, it is new in mpl 1.0:
http://matplotlib.sourceforge.net/users/whats_new.html
Ben Root
From: Ryan M. <rm...@gm...> - 2010年12月13日 20:13:59
On Mon, Dec 13, 2010 at 2:07 PM, vt603800 <vt6...@ba...> wrote:
> I get this error:
> AttributeError: 'module' object has no attribute 'subplot2grid'
>
> Are some modules not installed? or is there another problem, I'm a newby in
> matplotlib, it might be something very obvious...
>
> Running Matplotlib version 0.99.3 (python 2.6.6) on Ubuntu 10.10
I'm 90% certain that the subplot2grid feature was added in 1.0. You
could build and install from source:
https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: vt603800 <vt6...@ba...> - 2010年12月13日 20:07:42
Hello, 
Everytime I try to run this script from the doc page of the
matplotlib site : 
import matplotlib.pyplot as plt 
def
make_ticklabels_invisible(fig): 
 for i, ax in enumerate(fig.axes): 
ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") 
 for tl in
ax.get_xticklabels() + ax.get_yticklabels(): 
 tl.set_visible(False)
plt.figure(0) 
ax1 = plt.subplot2grid((3,3), (0,0), colspan=3) 
ax2 =
plt.subplot2grid((3,3), (1,0), colspan=2) 
ax3 = plt.subplot2grid((3,3),
(1, 2), rowspan=2) 
ax4 = plt.subplot2grid((3,3), (2, 0)) 
ax5 =
plt.subplot2grid((3,3), (2, 1)) 
plt.suptitle("subplot2grid")
make_ticklabels_invisible(plt.gcf()) 
plt.show() 
I get this error:
AttributeError: 'module' object has no attribute 'subplot2grid' 
Are some
modules not installed? or is there another problem, I'm a newby in
matplotlib, it might be something very obvious... 
Running Matplotlib
version 0.99.3 (python 2.6.6) on Ubuntu 10.10 
thanks, 
Hans R
From: Benjamin R. <ben...@ou...> - 2010年12月13日 19:57:22
On Sun, Dec 12, 2010 at 11:51 AM, Jose Guzman <sjm...@go...>wrote:
> I was wondering if there is an easy way to combine two vectors (x and y)
> into a single object to be ploted with the plot() method in matplotlib.
>
> Untill now, I did something like:
>
> import matplotlib.pyplot as plt
> x = np.nplinspace(0,5,1000)
> y = np.ones_like(x)
> plt.plot(x,y) # need an object here
> plt.show()
>
> But I would like to use plt.plot(my_object, 'r').
>
> I tried to combine x and y in lists of lists, NumPy matrices, with zip,
> etc...but it only plots a collection of plots.
>
> Thanks a lot in advance.
>
>
You could take advantage of python's expansion of positional arguments like
so:
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> foo = [np.arange(30), np.random.random((30,))]
>>> plt.plot(*foo)
[<matplotlib.lines.Line2D object at 0x97aef6c>]
>>> plt.show()
The behavior that you describe (plotting many lines) is documented and
expected behavior with a list.
Ben Root
From: Russell E. O. <ro...@uw...> - 2010年12月13日 19:42:37
In article 
<AANLkTik=w70...@ma...>,
 Søren Nielsen 
 <sor...@gm...> wrote:
> Hi,
> 
> I have an animated plot and I'm having trouble updating the tick labels
> after I blit new data to the canvas. I've looked through the documentation
> and it's not clear to me how I can update the x and y axis ticks during an
> animation. Anyone here know how to do this?
I am not an expert but...
The only way I know to update the tick labels and such is to call the 
draw() method on your canvas.
if you have to update the tick labels nearly as often as you add data 
then you probably should not bother with the animation API. Just update 
the data and then call canvas.draw() to update both the data and the 
axis ticks.
Regards,
-- Russell
From: Russell O. <ro...@uw...> - 2010年12月13日 19:05:00
I just tried calling subplot.clear() just before calling 
canvas.draw(). Interestingly enough it increases the memory leak rate 
by roughly 50%!
By the way, the minimal script is available here if you want to try it:
<http://www.astro.washington.edu/users/rowen/python/matplotlibMemoryLeak.py 
 >
I would be interested to see your code if it is available. What back 
end are you using?
Regards,
-- Russell
On Dec 12, 2010, at 8:08 AM, Friedrich Romstedt wrote:
> 2010年12月12日 Russell Owen <ro...@uw...>:
>> Simply creating a blank Axes and calling canvas.draw() leaks memory 
>> -- even without displaying any data or shifting the x axes.
>
> Okay, as a workaround have you tried ax.clear()?
>
> So the example script provided by you can be boiled down further?
>
> I'm using ax.clear() in a layered approach very extensively and have
> never noticed memory leaks with this. I'm having a Layer object which
> can be fed by data, and when the data changes, it automatically will
> trigger an ax.clear() in the host stack, and then everything is
> redrawn. Not the fastest, but fast enough.
>
> Friedrich
From: Nicolas B. <nbi...@gm...> - 2010年12月13日 18:47:21
Hi all,
I'm using matplotlib.image.NonUniformImage() to plot a 2D rectilinear grid
(non uniform spacing between points):
> im = matplotlib.image.NonUniformImage(grid, extent=extent, origin='lower',
> cmap = matplotlib.cm.jet, interpolation = "nearest")
im.set_data(x, y, z)
ax.images.append(im)
ax.set_xlim(extent_x)
ax.set_ylim(extent_z)
I have tried using a different interpolation value as in imshow(), but only
"nearest" and "bilinear" gives expected results. All others ('bicubic',
'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser',
'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc' and 'lanczos')
show garbage instead of my data.
If the other interpolations are not implemented, there should be at least an
assert somewhere...
Thanx
From: usherbsallen <ste...@us...> - 2010年12月13日 15:52:47
Hi,
I am using imshow to illustrate the content of arrays. But I am having
problems when arrays are too large. There seem to be a limitation that is
not due to the computer memory size. My data are unsigned integer 1 byte and
I am limited to array of about 12000 x 5000.
When trying with a 16000 x 5000 array, my 4 GB computer got very slow and
never perform the creation of the image. After 10 minutes, I have to kill
the process. On a 16 GB computer, I've got a segmentation fault message. The
size limitation are approximately the same on both computers.
I found a solution by calling twice the imshow function with only part of
the array each time. But I think there might be a better solution.
My feeling is that the limitation is not due to matplotlib or python but
rather from gtk or other part of the imaging tools.
Steve
-- 
View this message in context: http://old.nabble.com/memory-problem-in-imshow-tp30446084p30446084.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年12月13日 10:55:39
It seems that there is no option to change join and cap style for
patches (only lines have them).
While there could be other ways, one workaround is to use patheffect.
Below is a modified version of your example.
Meanwhile, I think the situation needs to be fixed, i.e., Patches
should implement set_capstyle and set_joinstyle. Can you file a
feature request on the tracker?
Regards,
-JJ
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from matplotlib.patheffects import Stroke
def add_sizebar(ax, size):
 asb = AnchoredSizeBar(ax.transData,
 size,
 str(size),
 loc=8,
 pad=0.1, borderpad=0.5, sep=5,
 frameon=False)
 ax.add_artist(asb)
 mypatch = asb.size_bar.get_children()[0]
 mypatch.set_path_effects([Stroke(joinstyle='miter',
 capstyle='butt')]) # override
joinstyle and capstyle
add_sizebar(plt.gca(), 0.5)
plt.draw()
plt.show()
On Mon, Dec 13, 2010 at 9:16 AM, gary ruben <gr...@bi...> wrote:
> Is it possible to control the join and cap styles of lines and
> patches? Is there an example for this? I'm trying to add a scale
> marker to a plot, but lines have rounded ends by default, so I'm
> currently changing these manually in Inkscape to miter join and butt
> cap. Here is a minimal example, based on the code here:
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
>
> def add_sizebar(ax, size):
> asb = AnchoredSizeBar(ax.transData,
>   size,
>   str(size),
>   loc=8,
>   pad=0.1, borderpad=0.5, sep=5,
>   frameon=False)
> ax.add_artist(asb)
>
> add_sizebar(plt.gca(), 0.5)
>
> plt.draw()
> plt.show()
>
>
> What I'd like is a 2pt wide line with butt-style cap ends,
>
> thanks,
> Gary
>
> ------------------------------------------------------------------------------
> Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
> new data types, scalar functions, improved concurrency, built-in packages,
> OCI, SQL*Plus, data movement tools, best practices and more.
> http://p.sf.net/sfu/oracle-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
Hi,
First of all, thanks to the matplotlib developers for all the great job. I
have just successfully installed matplotlib from source (r8827) in my
macbook for python 2.7. However, I found a couple of bumps in the road that
I'd like to share:
1) Dependencies: I initially used make.osx to fetch and build png, freetype
and zlib. However, for libpng for some reason either urllib was not fetching
the right file or it was corrupted, and when running:
 sudo make -f make.osx fetch deps
make crashed because of an error in tar when trying to unpack the source (I
tried tar myself and it also crashed). I ended up downloading manually the
sources and then used make.osx to install each of them individually. Also,
at least in the case of libpng, the exact version does not seem to matter,
and I ended up upgrading to libpng 1.4.5.
2) make.osx configuration: in my case I had to change the python version and
mac osx targets to 2.7 and 10.5 respectively, and I selected /usr/local as
the prefix. Still, I found a problem with the architecture flags that made
the linker fail when running:
sudo make -f make.osx mpl_build
After struggling a little bit it turned out that the problem was in setup.py
itself, which called c++ using the -arch ppc flag. This is probably due to
the fact that the OSX package provided by Python.org for Mac OS X below 10.6
(Leopard and below) is a universal binary and therefore python compiles
against i386 and ppc architectures. Now, make.osx lets you change the
architecture flags in line 11, however the compiler and linker flags do not
use the variable defined there, and -arch ppc must be added in both lines 20
and 21.
3) After building matplotlib, contrary to what is mentioned in a couple of
sites, python setup.py install crashed and I had to use make.osx to install
matplotlib. One important thing when make.osx is used is that it installs
matplotlib in a site-package directory that hangs from the PREFIX directory
that has to be defined in make.osx, instead of sniffing the site-package
used by the current version of python. Therefore, I had to copy everything
into the site-package folder inside of .../Python.framework/Versions/2.7 in
order to be able to import it. Alternatively, you can add the alternative
site-package path to PYTHONPATH, but it is less tidy, in my opinion.
All in all, a bumpy experience and not too user-friendly, but at least it
worked. I include below a copy of the final make.osx that worked for me:
Cheers,
AY
# build mpl into a local install dir with
PREFIX=/usr/local
MPLVERSION=1.0rc1
PYVERSION=2.7
PYTHON=python${PYVERSION}
ZLIBVERSION=1.2.3
PNGVERSION=1.4.5
FREETYPEVERSION=2.3.11
MACOSX_DEPLOYMENT_TARGET=10.5
OSX_SDK_VER=10.5
#Next line is useless, see below:
ARCH_FLAGS="-arch i386 -arch ppc"
## You shouldn't need to configure past this point -- Actually I did
# Commenting 20 and 21 and uncommenting the CFLAGS and LDFLAGS below should
also work
#PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
#CFLAGS="${ARCH_FLAGS} -I${PREFIX}/include -I${PREFIX}/include/freetype2
-isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
#LDFLAGS="${ARCH_FLAGS} -L${PREFIX}/lib
-syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="-arch i386 -arch ppc -I${PREFIX}/include
-I${PREFIX}/include/freetype2 -isysroot
/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
LDFLAGS="-arch i386 -arch ppc -L${PREFIX}/lib
-syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
From: gary r. <gr...@bi...> - 2010年12月13日 00:16:11
Is it possible to control the join and cap styles of lines and
patches? Is there an example for this? I'm trying to add a scale
marker to a plot, but lines have rounded ends by default, so I'm
currently changing these manually in Inkscape to miter join and butt
cap. Here is a minimal example, based on the code here:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
def add_sizebar(ax, size):
 asb = AnchoredSizeBar(ax.transData,
 size,
 str(size),
 loc=8,
 pad=0.1, borderpad=0.5, sep=5,
 frameon=False)
 ax.add_artist(asb)
add_sizebar(plt.gca(), 0.5)
plt.draw()
plt.show()
What I'd like is a 2pt wide line with butt-style cap ends,
thanks,
Gary
From: mdekauwe <mde...@gm...> - 2010年12月13日 00:10:39
Hi,
thanks to Juan for the Rpy package suggestion
I came up with this, which at least produces the plot. I can't quite work
out R specific bits at the moment (e.g. legend), but perhaps it might help
someone else.
#!/usr/bin/env python
import sys
from rpy2.robjects.packages import importr
import rpy2.robjects as robjects
r = robjects.r
# Note depends on R package plotrix
r.png(filename="x.png" ,width=480, height=480)
# fake some reference data
s = importr('stats')
ref = s.rnorm(30, sd=2)
ref_sd = r.sd(ref)
# add a little noise
model1 = s.rnorm(30, sd=2)
# add more noise
model2 = s.rnorm(30, sd=6)
# display the diagram with the better model
p = importr('plotrix')
#print plot
p.taylor_diagram(ref,model1)
# now add the worse model
p.taylor_diagram(ref,model2, add=True, col="blue")
# get approximate legend position
lpos = 1.5 * ref_sd[0]
# add a legend
#r.legend(lpos,lpos,legend=("Better","Worse"),pch=19,col=("red","blue"))
# now restore par values
#p.par(oldpar)
# show the "all correlation" display
p.taylor_diagram(ref,model1,pos_cor=False)
p.taylor_diagram(ref,model2,add=True,col="blue")
Martin
-- 
View this message in context: http://old.nabble.com/Taylor-diagram-tp30421393p30441744.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
1 message has been excluded from this view by a project administrator.

Showing 20 results of 20

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /