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
(19)
2
(28)
3
(8)
4
(15)
5
(20)
6
(23)
7
(12)
8
(11)
9
(13)
10
(4)
11
(9)
12
(34)
13
(33)
14
(24)
15
(15)
16
(12)
17
(8)
18
(5)
19
(5)
20
(6)
21
(10)
22
(9)
23
(18)
24
(10)
25
(7)
26
(13)
27
(18)
28
(29)
29
(4)
30
(5)
31
(2)

Showing results of 419

<< < 1 .. 3 4 5 6 7 .. 17 > >> (Page 5 of 17)
From: Stan W. <sta...@nr...> - 2009年10月23日 16:23:56
> From: Werner F. Bruhin [mailto:wer...@fr...] 
> Sent: Friday, October 23, 2009 07:31
> 
> I am just installing Windows 7 Pro and I am running into a 
> problem with matplotlib.
> 
> When running e.g. barchart_demo.py I get an error that it can 
> not find msvcp71.dll (the dll is in C:\Python25) and I see 
> the following exception.
> 
> Traceback (most recent call last):
 [...]
> File 
> "C:\Python25\Lib\site-packages\matplotlib\transforms.py", 
> line 34, in <module>
> from matplotlib._path import affine_transform
> ImportError: DLL load failed: Le module spcifi est introuvable.
 [...]
Hi, Werner. I've been running the release candidate of Windows 7 and haven't
encountered that issue. My Python installation is that of Python(x,y) 2.1.17,
which includes the same version of Python as yours, and I'm using a build of
matplotlib from SVN, although I previously used version 0.99.0 without DLL
trouble.
On my machine, I found msvcp71.dll in several directories under
C:\Python25\Lib\site-packages (including site-packages\wx-2.8-msw-unicode\wx),
in C:\Windows\System32, and in several locations under C:\Program Files, but
not in C:\Python25. There is a similarly-named msvcr71.dll in C:\Python25.
I'm wondering whether and how msvcp71.dll is related to the traceback to the
_path module, because the _path module comprises a .pyd (~= .dll) file. You
might start Python, enter "from matplotlib._path import affine_transform", and
see whether the import is successful.
Are you able to run other matplotlib examples? Can you open a figure window?
What backend are you using, and does the problem occur with other matplotlib
backends, both GUI and non-GUI?
From: Michael D. <md...@st...> - 2009年10月23日 14:57:26
It's a bug without an easy solution. Realistically, we probably need to 
make two passes with the mathtext parser to determine spacing.
A workaround is to use the \hspace command:
 r"[#/$cm^3\hspace{-0.3}$]"
Mike
On 10/23/2009 09:44 AM, Gökhan Sever wrote:
> Hello,
>
> Not that I like asking the same question again and again, but I just 
> couldn't find a way to fix one annoyance on my figures when I use 
> mathtex formatted labels. Here is one example figure: 
> http://img14.imageshack.us/img14/4443/mathtex.png
>
> # Set the label
> host.set_ylabel(r"DMT CCN Concentration [#/$cm^3$]")
>
> On the y-label, I always get an extra space after the formatted text 
> even if I don't explicitly put myself. What is the known cure for this 
> issue? This figure and similars will go onto my poster, and thesis and 
> further on a paper. I would really like to know if there a way to fix 
> this by making some changes on my code or matplotlibrc file.
>
> Thanks.
>
> Here is the relevant sections of my rc file:
>
> ### FONT
> #
> # font properties used by text.Text. See
> # http://matplotlib.sourceforge.net/matplotlib.font_manager.html for more
> # information on font properties. The 6 font properties used for font
> # matching are given below with their default values.
> #
> # The font.family property has five values: 'serif' (e.g. Times),
> # 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery),
> # 'fantasy' (e.g. Western), and 'monospace' (e.g. Courier). Each of
> # these font families has a default list of font names in decreasing
> # order of priority associated with them.
> #
> # The font.style property has three values: normal (or roman), italic
> # or oblique. The oblique style will be used for italic, if it is not
> # present.
> #
> # The font.variant property has two values: normal or small-caps. For
> # TrueType fonts, which are scalable fonts, small-caps is equivalent
> # to using a font size of 'smaller', or about 83% of the current font
> # size.
> #
> # The font.weight property has effectively 13 values: normal, bold,
> # bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
> # 400, and bold is 700. bolder and lighter are relative values with
> # respect to the current weight.
> #
> # The font.stretch property has 11 values: ultra-condensed,
> # extra-condensed, condensed, semi-condensed, normal, semi-expanded,
> # expanded, extra-expanded, ultra-expanded, wider, and narrower. This
> # property is not currently implemented.
> #
> # The font.size property is the default font size for text, given in pts.
> # 12pt is the standard value.
> #
> #font.family : sans-serif
> #font.style : normal
> #font.variant : normal
> #font.weight : medium
> #font.stretch : normal
> # note that font.size controls default text sizes. To configure
> # special text sizes tick labels, axes, labels, title, etc, see the rc
> # settings for axes and ticks. Special text sizes can be defined
> # relative to font.size, using the following values: xx-small, x-small,
> # small, medium, large, x-large, xx-large, larger, or smaller
> #font.size : 12.0
> #font.serif : Bitstream Vera Serif, New Century Schoolbook, 
> Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 
> L, Times New Roman, Times, Palatino, Charter, serif
> #font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, 
> Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
> #font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, 
> cursive
> #font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, 
> Western, fantasy
> #font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus 
> Mono L, Courier New, Courier, Fixed, Terminal, monospace
>
> ### TEXT
> # text properties used by text.Text. See
> # http://matplotlib.sourceforge.net/matplotlib.text.html for more
> # information on text properties
>
> #text.color : black
>
> ### LaTeX customizations. See 
> http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
> text.usetex : False # use latex for all text handling. The 
> following fonts
> # are supported through the usual rc 
> parameter settings:
> # new century schoolbook, bookman, 
> times, palatino,
> # zapf chancery, charter, serif, 
> sans-serif, helvetica,
> # avant garde, courier, monospace, 
> computer modern roman,
> # computer modern sans serif, computer 
> modern typewriter
> # If another font is desired which can 
> loaded using the
> # LaTeX \usepackage command, please 
> inquire at the
> # matplotlib mailing list
> #text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages 
> for handling
> # unicode strings.
> #text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO 
> LATEX FAILURES
> # AND IS THEREFORE UNSUPPORTED. PLEASE DO 
> NOT ASK FOR HELP
> # IF THIS FEATURE DOES NOT DO WHAT YOU 
> EXPECT IT TO.
> # preamble is a comma separated list of 
> LaTeX statements
> # that are included in the LaTeX document 
> preamble.
> # An example:
> # text.latex.preamble : 
> \usepackage{bm},\usepackage{euler}
> # The following packages are always loaded 
> with usetex, so
> # beware of package collisions: color, 
> geometry, graphicx,
> # type1cm, textcomp. Adobe Postscript 
> (PSSNFS) font packages
> # may also be loaded, depending on your 
> font settings
>
> #text.dvipnghack : None # some versions of dvipng don't handle alpha
> # channel properly. Use True to correct
> # and flush ~/.matplotlib/tex.cache
> # before testing and False to force
> # correction off. None will try and
> # guess based on your dvipng version
>
> #text.markup : 'plain' # Affects how text, such as titles and 
> labels, are
> # interpreted by default.
> # 'plain': As plain, unformatted text
> # 'tex': As TeX-like text. Text between $'s will be
> # formatted as a TeX math expression.
> # This setting has no effect when text.usetex is True.
> # In that case, all text will be sent to TeX for
> # processing.
>
> # The following settings allow you to select the fonts in math mode.
> # They map from a TeX font name to a fontconfig font pattern.
> # These settings are only used if mathtext.fontset is 'custom'.
> # Note that this "custom" mode is unsupported and may go away in the
> # future.
> mathtext.default : regular
> #mathtext.cal : cursive
> #mathtext.rm : serif
> #mathtext.tt <http://mathtext.tt> : monospace
> #mathtext.it <http://mathtext.it> : serif:italic
> #mathtext.bf <http://mathtext.bf> : serif:bold
> #mathtext.sf : sans
> #mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix',
> # 'stixsans' or 'custom'
> #mathtext.fallback_to_cm : True # When True, use symbols from the 
> Computer Modern
> # fonts when a symbol can not be found in one of
> # the custom math fonts.
>
>
>
> -- 
> Gökhan
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Gökhan S. <gok...@gm...> - 2009年10月23日 13:44:29
Hello,
Not that I like asking the same question again and again, but I just
couldn't find a way to fix one annoyance on my figures when I use mathtex
formatted labels. Here is one example figure:
http://img14.imageshack.us/img14/4443/mathtex.png
# Set the label
host.set_ylabel(r"DMT CCN Concentration [#/$cm^3$]")
On the y-label, I always get an extra space after the formatted text even if
I don't explicitly put myself. What is the known cure for this issue? This
figure and similars will go onto my poster, and thesis and further on a
paper. I would really like to know if there a way to fix this by making some
changes on my code or matplotlibrc file.
Thanks.
Here is the relevant sections of my rc file:
### FONT
#
# font properties used by text.Text. See
# http://matplotlib.sourceforge.net/matplotlib.font_manager.html for more
# information on font properties. The 6 font properties used for font
# matching are given below with their default values.
#
# The font.family property has five values: 'serif' (e.g. Times),
# 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery),
# 'fantasy' (e.g. Western), and 'monospace' (e.g. Courier). Each of
# these font families has a default list of font names in decreasing
# order of priority associated with them.
#
# The font.style property has three values: normal (or roman), italic
# or oblique. The oblique style will be used for italic, if it is not
# present.
#
# The font.variant property has two values: normal or small-caps. For
# TrueType fonts, which are scalable fonts, small-caps is equivalent
# to using a font size of 'smaller', or about 83% of the current font
# size.
#
# The font.weight property has effectively 13 values: normal, bold,
# bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
# 400, and bold is 700. bolder and lighter are relative values with
# respect to the current weight.
#
# The font.stretch property has 11 values: ultra-condensed,
# extra-condensed, condensed, semi-condensed, normal, semi-expanded,
# expanded, extra-expanded, ultra-expanded, wider, and narrower. This
# property is not currently implemented.
#
# The font.size property is the default font size for text, given in pts.
# 12pt is the standard value.
#
#font.family : sans-serif
#font.style : normal
#font.variant : normal
#font.weight : medium
#font.stretch : normal
# note that font.size controls default text sizes. To configure
# special text sizes tick labels, axes, labels, title, etc, see the rc
# settings for axes and ticks. Special text sizes can be defined
# relative to font.size, using the following values: xx-small, x-small,
# small, medium, large, x-large, xx-large, larger, or smaller
#font.size : 12.0
#font.serif : Bitstream Vera Serif, New Century Schoolbook, Century
Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New
Roman, Times, Palatino, Charter, serif
#font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva,
Lucid, Arial, Helvetica, Avant Garde, sans-serif
#font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
#font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western,
fantasy
#font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L,
Courier New, Courier, Fixed, Terminal, monospace
### TEXT
# text properties used by text.Text. See
# http://matplotlib.sourceforge.net/matplotlib.text.html for more
# information on text properties
#text.color : black
### LaTeX customizations. See
http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
text.usetex : False # use latex for all text handling. The
following fonts
 # are supported through the usual rc parameter
settings:
 # new century schoolbook, bookman, times,
palatino,
 # zapf chancery, charter, serif, sans-serif,
helvetica,
 # avant garde, courier, monospace, computer
modern roman,
 # computer modern sans serif, computer modern
typewriter
 # If another font is desired which can loaded
using the
 # LaTeX \usepackage command, please inquire at
the
 # matplotlib mailing list
#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for
handling
 # unicode strings.
#text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX
FAILURES
 # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT
ASK FOR HELP
 # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT
TO.
 # preamble is a comma separated list of LaTeX
statements
 # that are included in the LaTeX document
preamble.
 # An example:
 # text.latex.preamble :
\usepackage{bm},\usepackage{euler}
 # The following packages are always loaded with
usetex, so
 # beware of package collisions: color, geometry,
graphicx,
 # type1cm, textcomp. Adobe Postscript (PSSNFS)
font packages
 # may also be loaded, depending on your font
settings
#text.dvipnghack : None # some versions of dvipng don't handle alpha
 # channel properly. Use True to correct
 # and flush ~/.matplotlib/tex.cache
 # before testing and False to force
 # correction off. None will try and
 # guess based on your dvipng version
#text.markup : 'plain' # Affects how text, such as titles and
labels, are
 # interpreted by default.
 # 'plain': As plain, unformatted text
 # 'tex': As TeX-like text. Text between $'s will be
 # formatted as a TeX math expression.
 # This setting has no effect when text.usetex is True.
 # In that case, all text will be sent to TeX for
 # processing.
# The following settings allow you to select the fonts in math mode.
# They map from a TeX font name to a fontconfig font pattern.
# These settings are only used if mathtext.fontset is 'custom'.
# Note that this "custom" mode is unsupported and may go away in the
# future.
mathtext.default : regular
#mathtext.cal : cursive
#mathtext.rm : serif
#mathtext.tt : monospace
#mathtext.it : serif:italic
#mathtext.bf : serif:bold
#mathtext.sf : sans
#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix',
 # 'stixsans' or 'custom'
#mathtext.fallback_to_cm : True # When True, use symbols from the Computer
Modern
 # fonts when a symbol can not be found in one of
 # the custom math fonts.
-- 
Gökhan
From: Werner F. B. <wer...@fr...> - 2009年10月23日 11:31:29
I am just installing Windows 7 Pro and I am running into a problem with 
matplotlib.
When running e.g. barchart_demo.py I get an error that it can not find 
msvcp71.dll (the dll is in C:\Python25) and I see the following exception.
Traceback (most recent call last):
 File "barchart_demo.py", line 3, in <module>
 import matplotlib.pyplot as plt
 File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 6, in 
<module>
 from matplotlib.figure import Figure, figaspect
 File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 16, in 
<module>
 import artist
 File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 5, in 
<module>
 from transforms import Bbox, IdentityTransform, TransformedBbox, 
TransformedPath
 File "C:\Python25\Lib\site-packages\matplotlib\transforms.py", line 
34, in <module>
 from matplotlib._path import affine_transform
ImportError: DLL load failed: Le module spcifi est introuvable.
Anyone seen this problem before on Win7?
BTW, I can run e.g. Boa (a wxPython based IDE). I have no problem 
running my application which is wxPython based as long as I don't call 
anything which uses mpl.
Version info:
Win 7 Pro
# Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit 
(Intel)]
# wxPython 2.8.10.1 (unicode), Boa Constructor 0.6.1
matplotlib.__version__
'0.99.1'
Werner
P.S.
Installed Python for all users - will try installing for me only
From: Andre S. <fre...@gm...> - 2009年10月23日 03:51:03
Is is possible to xalign rec2gtk columns?
I see the following line in the rec2gtk source:
 -> renderer.set_property('xalign', formatter.xalign)
but can't figure out how to pass this info to the func.
thx
Andre
From: Mike A. <mba...@wi...> - 2009年10月22日 20:19:12
> If you want to have a legend for PolyCollection, you may use a proxy 
> artist.
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
Thanks for the link! Although, it seems that legend does not support 
PolyCollection at all:
 "Remember that some pyplot commands return artist not supported by 
legend, e.g., fill_between() returns PolyCollection that is not 
supported."
so that even trying to use a proxy artist results in an error (shown 
at bottom), with the code here:
------------------------------
listOfThingsPlotted = []
listOfLegendLabels = []
for column in sorted(yValues):
 temp = ax.fill_between(xValues, yValues[column], label=column)
 listOfThingsPlotted.append(temp)
 listOfLegendLabels.append(column)
 legend = plt.legend 
(listOfThingsPlotted,listOfLegendLabels,bbox_to_anchor=(1.25, 1), 
shadow=True, fancybox=True)
------------------------------
Error:
------------------------------
Traceback (most recent call last):
 File "/cms/cmsprod/bin/prodJobMonitorPlots_matplotlib.py", line 
117, in <module>
 plotStackedJobsVsTime(inputFile, outputFile, outputTitle)
 File "/cms/cmsprod/bin/prodJobMonitorPlots_matplotlib.py", line 93, 
in plotStackedJobsVsTime
 legend = plt.legend 
(listOfThingsPlotted,listOfLegendLabels,bbox_to_anchor=(1.25, 1), 
shadow=True, fancybox=True) # Make legend
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
pyplot.py", line 2437, in legend
 ret = gca().legend(*args, **kwargs)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
axes.py", line 4044, in legend
 self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
legend.py", line 304, in __init__
 self._init_legend_box(handles, labels)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
legend.py", line 582, in _init_legend_box
 handlebox.add_artist(handle)
 File "/afs/hep.wisc.edu/cms/sw/python/x86/2.5.4/lib/python2.5/site- 
packages/matplotlib-0.99.1.1_r0-py2.5-linux-i686.egg/matplotlib/ 
offsetbox.py", line 475, in add_artist
 a.set_transform(self.get_transform())
AttributeError: 'NoneType' object has no attribute 'set_transform'
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 18:17:09
I guess you need to update the canvas itself, but there could be more
things to do.
My recommendation is not to switch figure, but to switch axes (or just
contours).
You may create several axes in a same figure and make them invisible
(or temporarily remove them from the figure) except the one you want.
Regards,
-JJ
On Tue, Oct 20, 2009 at 9:15 PM, Jason Kenney <jas...@gm...> wrote:
>
> I'm new to matplotlib and python GUIs in general, so I apologize if I'm
> missing something fundamental in my understanding of the matplotlib canvas -
> figure - etc model. That said...
>
> I'm working on a small matplotlib app using PyQT4. It involves selecting an
> arbitrary number of data files and breaking each down into a group of 6
> contour subplots. I want to be able to switch between contour plots from
> each data set quickly to compare and contrast, so my thought was to
> front-load the data analysis and figure creation and store them, then update
> the displayed figure with a stored figure. I am not able to get the stored
> figures to display though.
>
> In attempt to debug/understand what's going on, I have the following:
>
> class InputWindow (QtGui.QWidget):
> def __init__ (self, parent=None):
> ...
>  self.dpi = 100
>  self.fig = Figure((9.0, 6.0), dpi=self.dpi)
>  self.canvas = FigureCanvas(self.fig)
>
>  self.vbox = QtGui.QVBoxLayout()
>  self.vbox.addLayout (grid)
>  self.vbox.addLayout (self.hbox_pbs)
>  self.vbox.addWidget (self.canvas)
>  self.vbox.addStretch (1)
>  self.setLayout (self.vbox)
>  self.resize (900, 600)
>  self.fig.add_subplot(111, aspect='equal')
> ...
>
> This works fine and creates an empty plot. I can clear this figure with
> self.fig.clear() and add subplots to it with self.fig.add_subplot upon
> pushing a button in the UI. What I can't do is something like this:
>
> def Process (self):
>  self.fig.clear()
>  fig2 = Figure((9.0, 6.0), dpi=self.dpi)
>  fig2.add_subplot(211, aspect='equal')
>  self.fig = fig2
>  self.canvas.draw()
>
> This will clear the figure, but it doesn't update with the contents of fig2.
> If I look at the properties of self.fig, they match those of fig2 though.
> Any help on what I need to do to get something like self.fig = fig2 working?
>
> Thanks,
>
> J
> --
> View this message in context: http://www.nabble.com/Setting-Figure-%3D-Figure-possible--tp25985129p25985129.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 18:10:11
> Why is that?
"fill" creates Patches
(http://matplotlib.sourceforge.net/api/artist_api.html?highlight=patch#matplotlib.patches.Patch)
but fill_between creates PolyCollection
(http://matplotlib.sourceforge.net/api/collections_api.html?highlight=polycollection#matplotlib.collections.PolyCollection).
And, unfortunately, PolyCollection is currently not supported with
legend (it would be better if the error message is more meaningful
though).
If you want to have a legend for PolyCollection, you may use a proxy artist.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 17:57:59
On Thu, Oct 22, 2009 at 8:59 AM, Johan Carlin
<joh...@go...> wrote:
> 1. Is there a way to change error bar line width directly with the bar function?
Maybe not. It seems that the "bar" function currently does not return
errorbar-related artists. You can find them by looking through
axes.lines and axes.collections, but I don't recommend it.
> 2. If it is necessary to do this with errorbar(), how can I change the
> cap width or thickness?
I think it is best to use a separate errorbar function.
The error bar caps are drawn as markers. So, you need to change
marker-related attributes.
errorbar((0+w/2,1+w/2),V,e,elinewidth=3,ecolor='k',fmt=None,capsize=10, mew=5)
"mew" => "makeredgewidth"
errorbar function returns artists it creates. So, you may change
attributes of these individual artists, say, if you want different
widths for upper caps and lower caps.
See the documentation for more details.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2009年10月22日 17:38:01
I recommend you to open a feature request ticket on the sourceforge site.
http://sourceforge.net/tracker/?atid=560723&group_id=80706&func=browse
This is more like an sphinx issue than matplotlib one, and it seems
that sphinx have some support for chm format. So I guess this could be
done quite easily. However, my observation is that most of the mpl
developers are not windows developers. So, it may not happen soon.
On the other hand, I'm personally quite satisfied with current search
functionality of the matplotlib documentation on the web. I think the
best approach would be that you describe how chm is better, and then
we (well, other developers as I know little about web development) try
to improve the web documentation.
Regards,
-JJ
On Wed, Oct 21, 2009 at 5:14 AM, NIE Cheng <nie...@gm...> wrote:
> I mean, it's quite time-consuming to find the function I want on the net
> and the pdf version is not so convenient as the chm version. Anybody any
> idea?
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Gökhan S. <gok...@gm...> - 2009年10月22日 17:23:11
On Thu, Oct 22, 2009 at 8:55 AM, clarknie <cla...@gm...> wrote:
> I mean, it's quite time-consuming to find the function I want on the net
>
> and the pdf version is not so convenient as the chm version. Anybody any
> idea?
>
>
>
Alternatively, you can check-out the source copy and build your own
documentation via Sphinx. Although the first build takes a little while
(probably no more than 10 mins, and additional builds gets very faster since
Sphinx is smart in this process) it is faster to search your local copies
than on the web.
Also, you can very easily access docstrings from within IPython. If you use
Eclipse it provides a convince of jumping function/class definitions without
locally browsing the source code as well as intelligent helpers. You may
also take a look at Spyder for ease of coding.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Gökhan
From: Dudel <Dav...@gm...> - 2009年10月22日 16:44:29
Hi,
I'm using 0.99.1.1 of matplotlib as provided by the latest Enthought Python
Distribution. When I try to plot a matrix with pyplot.imshow() I get all
kinds of error messages, unless vmin and vmax are specified. Plotting an
array instead works. I.e.:
y=matrix('1 2 3')
imshow(y) #fails
imshow(y, vmin=1, vmax=3) #works
imshow(array(y)) #works
Is that a bug?
Cheers
-- 
View this message in context: http://www.nabble.com/bug-with-imshow%28%29-for-matrix--tp26013317p26013317.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: clarknie <cla...@gm...> - 2009年10月22日 13:55:20
I mean, it's quite time-consuming to find the function I want on the net
and the pdf version is not so convenient as the chm version. Anybody any
idea?
From: Johan C. <joh...@go...> - 2009年10月22日 12:59:31
Hi all,
Changing the linewidth parameter in the bar chart function doesn't
seem to change the error bar width. E.g.
V = (.5,1.)
e = (.2,.3)
bar((0,1), V, yerr=e, linewidth=3,ecolor='k',edgecolor='k')
Produces thick lines around the bars, but thin error bars.
It's possible to get around this by defining error bars in a separate
call to errorbar with the elinewidth parameter (the error bar will
also take the linewidth parameter if undefined - this doesn't happen
with bar()). So you can add error bars to the bar chart with e.g.
w = 1.
bar((0,1), V, width=w, linewidth=3,edgecolor='k')
hold(True)
errorbar((0+w/2,1+w/2),V,e,elinewidth=3,ecolor='k',fmt=None,capsize=10)
However, this doesn't solve the problem completely, because the
resulting chart still has thin cap lines! The best workaround I've
found so far is to simply set capsize=0.
So I have two questions:
1. Is there a way to change error bar line width directly with the bar function?
2. If it is necessary to do this with errorbar(), how can I change the
cap width or thickness?
For my simple plots, life would be easier if bar() would default to
letting linewidth define thickness also for error bars and caps.
Any help would be greatly appreciated.
Best,
Johan
From: Mike A. <mba...@wi...> - 2009年10月21日 21:50:20
Hi,
I have a piece of code that creates a plot without warning when using 
just fill(), but gives a warning when using fill_between() because 
that function doesn't seem to actually do register values passed to it 
by the "label" parameter.
The warning happens when I try to make a legend after using 
fill_between():
 /cms/sw/python/2.5/lib/python2.5/site-packages/ 
matplotlib-0.99.1.1_r0-py2.5-linux-x86_64.egg/matplotlib/axes.py:4014: 
UserWarning: No labeled objects found. Use label='...' kwarg on 
individual plots.
 warnings.warn("No labeled objects found. "
In essence this code works fine when I use fill() rather than 
fill_between():
--------------------
for column in sorted(yValues):
	ax.fill_between(xValues, yValues[column], label=column)
legend = plt.legend(bbox_to_anchor=(1.3, 1), shadow=True, fancybox=True)
--------------------
That is, the legend finds the labels when I use fill(), but not when I 
use fill_between().
Why is that?
Mike
From: Jae-Joon L. <lee...@gm...> - 2009年10月21日 17:07:49
The api related to ticks and ticklabels is a bit confusing, at least
for me. So, often, it seems best to directly change the tick
properties.
for t in axcbar.xaxis.get_major_ticks():
 t.tick1On = True
 t.tick2On = True
 t.label1On = False
 t.label2On = True
-JJ
On Wed, Oct 21, 2009 at 11:24 AM, Thomas Robitaille
<tho...@gm...> wrote:
> Hi,
>
> I'm trying to plot a horizontal colorbar with labels on top. I can use
>
> axcbar = fig.add_axes([0.2, 0.85, 0.6, 0.03])
> axcbar.xaxis.set_ticks_position('top')
> cbar = fig.colorbar(s, cax=axcbar, orientation='horizontal')
>
> but then I lose the ticks on the bottom of the colorbar. However,
> setting
>
> axcbar.xaxis.set_ticks_position('both')
>
> causes the labels to be on the bottom. Is there a way to have labels
> on the top while keeping ticks on both the top and bottom?
>
> Thanks,
>
> Thomas
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thomas R. <tho...@gm...> - 2009年10月21日 15:25:00
Hi,
I'm trying to plot a horizontal colorbar with labels on top. I can use
axcbar = fig.add_axes([0.2, 0.85, 0.6, 0.03])
axcbar.xaxis.set_ticks_position('top')
cbar = fig.colorbar(s, cax=axcbar, orientation='horizontal')
but then I lose the ticks on the bottom of the colorbar. However, 
setting
axcbar.xaxis.set_ticks_position('both')
causes the labels to be on the bottom. Is there a way to have labels 
on the top while keeping ticks on both the top and bottom?
Thanks,
Thomas
From: Michael D. <md...@st...> - 2009年10月21日 13:29:39
I have fixed this bug that was causing peaks to be truncated in SVN 
r7895 and r7896. It should make it into the next bugfix release.
Mike
Michael Droettboom wrote:
> It looks like the path simplification code is failing on this. As a 
> workaround, you can turn it off:
>
> rcParams['path.simplify'] = False
>
> or reduce the threshold below which vertices are removed:
>
> rcParams['path.simplify_threshold'] = 0.0001
>
> In the meantime, I'll look further into why this is failing. Perhaps we 
> need a lower default threshold.
>
> Mike
>
> Henrik Wallin wrote:
> 
>> Hello all,
>>
>> I'm sorry if this has been treated before, but I haven't found
>> anything when searching the archives or the net.
>>
>> Basically, the problem surfaces when plotting FFT spectras using many
>> data points. The amplitudes of the peaks in the spectra then seem to
>> depend on the size of the plot window.
>>
>> Example code:
>>
>>
>> 
>> 
>>>>> from pylab import *
>>>>> t=arange(65536)
>>>>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
>>>>> 
>>>>> 
>> [<matplotlib.lines.Line2D object at 0x03871990>]
>> 
>> 
>>>>> show()
>>>>> 
>>>>> 
>> With the original window size (WXAgg backend), I get maximum peaks at
>> about 390. Zooming in on the peak will increase the amplitude.
>> Resizing the window can also make the amplitude increase.
>>
>> The expected amplitude is:
>>
>> 
>> 
>>>>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
>>>>> 
>>>>> 
>> 12891.96683092583
>>
>> Is this a known problem, or should I file a bug report? Is there any
>> workaround (except decreasing the length of t, and thus the level of
>> detail)?
>>
>> I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary,
>> numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the
>> TkAgg backend, which gives similar results.
>>
>> Thanks,
>> Henrik
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay 
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2009年10月21日 12:45:14
It looks like the path simplification code is failing on this. As a 
workaround, you can turn it off:
 rcParams['path.simplify'] = False
or reduce the threshold below which vertices are removed:
 rcParams['path.simplify_threshold'] = 0.0001
In the meantime, I'll look further into why this is failing. Perhaps we 
need a lower default threshold.
Mike
Henrik Wallin wrote:
> Hello all,
>
> I'm sorry if this has been treated before, but I haven't found
> anything when searching the archives or the net.
>
> Basically, the problem surfaces when plotting FFT spectras using many
> data points. The amplitudes of the peaks in the spectra then seem to
> depend on the size of the plot window.
>
> Example code:
>
>
> 
>>>> from pylab import *
>>>> t=arange(65536)
>>>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
>>>> 
> [<matplotlib.lines.Line2D object at 0x03871990>]
> 
>>>> show()
>>>> 
>
> With the original window size (WXAgg backend), I get maximum peaks at
> about 390. Zooming in on the peak will increase the amplitude.
> Resizing the window can also make the amplitude increase.
>
> The expected amplitude is:
>
> 
>>>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
>>>> 
> 12891.96683092583
>
> Is this a known problem, or should I file a bug report? Is there any
> workaround (except decreasing the length of t, and thus the level of
> detail)?
>
> I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary,
> numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the
> TkAgg backend, which gives similar results.
>
> Thanks,
> Henrik
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Henrik W. <e9h...@gm...> - 2009年10月21日 12:04:19
Hello all,
I'm sorry if this has been treated before, but I haven't found
anything when searching the archives or the net.
Basically, the problem surfaces when plotting FFT spectras using many
data points. The amplitudes of the peaks in the spectra then seem to
depend on the size of the plot window.
Example code:
>>> from pylab import *
>>> t=arange(65536)
>>> plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
[<matplotlib.lines.Line2D object at 0x03871990>]
>>> show()
With the original window size (WXAgg backend), I get maximum peaks at
about 390. Zooming in on the peak will increase the amplitude.
Resizing the window can also make the amplitude increase.
The expected amplitude is:
>>> max(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
12891.96683092583
Is this a known problem, or should I file a bug report? Is there any
workaround (except decreasing the length of t, and thus the level of
detail)?
I'm using ActivePython 2.6.3.7 for windows, matplotlib 0.99.1 binary,
numpy 1.3.0 and wxPython-unicode-2.8.10.1. I've also tried with the
TkAgg backend, which gives similar results.
Thanks,
Henrik
From: Auré G. <aur...@ya...> - 2009年10月21日 11:55:21
Hi Laurent,
I think I might have found a way to solve your problem: instead of creating your axes using pylab.suplot, you should create the axes using the class way. I modified your code below and it works fine without loosing speed in the frame rate. Only thing is, I have no clue as to what is really the underlying problem... my best guess is that there is a conflict between pylab and the general class. I very rearely use pylab directly unless the problem is really simple, because I saw several posts mentioning possible conflicts.
Hope this helps you.
Cheers,
Aurélien
-----
import sys
import pylab as p
import matplotlib as mpl
import numpy as npy
import time
 
fig = p.figure(figsize=(8.,4.))
#ax = p.subplot(212)
ax = fig.add_axes((.05,.55,.9,.4))
#ax2 = p.subplot(211)
ax2 = fig.add_axes((.05,.05,.9,.4))
canvas = ax.figure.canvas
# create the initial line
x = npy.arange(0,2*npy.pi,0.01)
#line, = p.plot(x, npy.sin(x), animated=True, lw=2)
line, = ax.plot(x, npy.sin(x), animated=True, lw=2)
line2, = ax2.plot(x, npy.cos(x), animated=True, lw=2)
def run(*args):
 background = canvas.copy_from_bbox(ax.bbox)
 background2 = canvas.copy_from_bbox(ax2.bbox)
 # for profiling
 tstart = time.time()
 while 1:
 # restore the clean slate background
 canvas.restore_region(background)
 canvas.restore_region(background2)
 # update the data
 line.set_ydata(npy.sin(x+run.cnt/10.0))
 line2.set_ydata(npy.cos(x+run.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 ax2.draw_artist(line2)
 # just redraw the axes rectangle
 canvas.blit(ax.bbox)
 canvas.blit(ax2.bbox)
 #canvas.blit(ax.get_figure().bbox) 
 if run.cnt==100:
 # print the timing info and quit
 print 'FPS:' , 100/(time.time()-tstart)
 #return
 sys.exit() 
 run.cnt += 1
run.cnt = 0
#no need for the following since it is done directly when creating the axes
#p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
#p.grid() # to ensure proper background restore
ax.grid() # to ensure proper background restore
ax2.grid() # to ensure proper background restore
manager = p.get_current_fig_manager()
manager.window.after(100, run)
p.show()
------------------------------
Message: 2
Date: 2009年10月15日 18:40:22 +0200
From: Laurent Dufr?chou <lau...@gm...>
Subject: Re: [Matplotlib-users] [Solved] Little issue with blitting
 technique
To: 'Aur? Gourrier' <aur...@ya...>,
 <mat...@li...>
Message-ID: <4ad...@mx...>
Content-Type: text/plain; charset="iso-8859-1"
Hi Aur?,
Taking this example (FPS is computed at the end of the loop each 100
frames):
(this is the same example as you but not using FileUtils10)
################################################
import sys
import pylab as p
import numpy as npy
import time
ax2 = p.subplot(212)
ax = p.subplot(211)
canvas = ax.figure.canvas
# create the initial line
x = npy.arange(0,2*npy.pi,0.01)
line, = p.plot(x, npy.sin(x), animated=True, lw=2)
def run(*args):
 background = canvas.copy_from_bbox(ax.bbox)
 # for profiling
 tstart = time.time()
 while 1:
 # restore the clean slate background
 canvas.restore_region(background)
 # update the data
 line.set_ydata(npy.sin(x+run.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
 canvas.blit(ax.bbox)
 if run.cnt==100:
 # print the timing info and quit
 print 'FPS:' , 100/(time.time()-tstart)
 return
 run.cnt += 1
run.cnt = 0
p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
p.grid() # to ensure proper background restore
manager = p.get_current_fig_manager()
manager.window.after(100, run)
p.show()
################################################
This example will work on my machine @99FPS.
Now replace:
ax2 = p.subplot(212)
ax = p.subplot(211)
with:
ax = p.subplot(212)
ax2 = p.subplot(211)
The image is buggy because the blitting is no more working, still I get
86FPS. So let say no change.
Now replace ?ax.bbox? with ?ax.get_figure().bbox?:
The bug disappear and I get a small 20 FPS?
Tested under windows vista , matplotlib 0.99.1, python 2.5.4.
Laurent
Ps: I think ax.getFigure().bbox is getting the whole picture so this is why
it is slower.
De : Aur? Gourrier [mailto:aur...@ya...] 
Envoy? : jeudi 15 octobre 2009 10:32
? : mat...@li...
Objet : Re: [Matplotlib-users] [Solved] Little issue with blitting technique
>On Tue, Oct 13, 2009 at 5:06 PM, Laurent Dufr?chou
><lau...@gm...> wrote:
>> Hey, coparing on how GTK2 example is done I've seen a difference between
the two!
>>
>> In QT4Agg example and WX example the code use:
>>
>> canvas.copy_from_bbox(ax.bbox)
>> replacing all occurrence of ax.bbox with ax.get_figure().bbox solved all
the issue I add.
>>
>
>I'm not sure why using ax.bbox does not work, and it SHOULD work.
>Note that animation_blit_gtk.py DOES use ax.bbox.
>
>> Perhaps we should correct the examples.
>> I can send you the good working example if you want.
>
>If using ax.bbox does not work, than it is a bug (either mpl or the
example).
>Unfortunately, this seems to happen only on windows.
>So, please file a bug report (again).
>
>Regards,
>
>-JJ
>
Hy guys,
Just saw your posts. I don't understand the business with the
ax.get_figure().bbox.
I'm also using windows, and a modified version of the animation_blit_tk.py
using imshow work fine for me.
I just checked whether the get_figure() changes anything and I get exactly
the same result in terms of performance.
I attach the code below if it can be of any use.
Cheers,
Aur?
# For detailed comments on animation and the techniqes used here, see
# the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations
import matplotlib
matplotlib.use('TkAgg')
import sys
import pylab as p
import matplotlib.numerix as nx
import time
from FileUtils10 import fileHandling
# for profiling
tstart = time.time()
tprevious = time.time()
fnamelist = ['....']
ax = p.subplot(111)
canvas = ax.figure.canvas
print 't1 ',time.time()-tprevious
tprevious = time.time()
# create the initial line
dataarr = fileHandling(fnamelist[0]).read()
#print dataarr.dtype
#dataarr = dataarr.astype('uint8')
print 't2 ',time.time()-tprevious
tprevious = time.time()
image = p.imshow(dataarr, animated=True)
print 't3 ',time.time()-tprevious
tprevious = time.time()
def run(*args):
 tprevious = time.time()
 background = canvas.copy_from_bbox(ax.bbox)
 print 't4 ',time.time()-tprevious
 tprevious = time.time()
 while 1:
 #print fnamelist[run.cnt]
 # restore the clean slate background
 canvas.restore_region(background)
 print 't5 ',time.time()-tprevious
 tprevious = time.time()
 # update the data
 dataarr = fileHandling(fnamelist[run.cnt]).readMCCD()
 dataarr *= run.cnt
 print 't6 ',time.time()-tprevious
 tprevious = time.time()
 image.set_data(dataarr)
 print 't7 ',time.time()-tprevious
 tprevious = time.time()
 # just draw the animated artist
 ax.draw_artist(image)
 print 't8 ',time.time()-tprevious
 tprevious = time.time()
 # just redraw the axes rectangle
 canvas.blit(ax.bbox)
 print 't9 ',time.time()-tprevious
 tprevious = time.time()
 if fnamelist[run.cnt] == fnamelist[-1]:
 # print the timing info and quit
 print 'total time:' , time.time()-tstart
 print 'FPS:' , 1000./(time.time()-tstart)
 p.close('all')
 sys.exit()
 run.cnt += 1
run.cnt = 0
p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
p.grid() # to ensure proper background restore
manager = p.get_current_fig_manager()
manager.window.after(100, run)
p.show()
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
------------------------------
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
End of Matplotlib-users Digest, Vol 41, Issue 51
************************************************
 
From: NIE C. <nie...@gm...> - 2009年10月21日 09:15:03
I mean, it's quite time-consuming to find the function I want on the net
and the pdf version is not so convenient as the chm version. Anybody any
idea?
From: Christian M. <mee...@im...> - 2009年10月21日 09:01:20
Hi,
Does anyone provide a script / patch to create zap symbols (e.g. like
http://home.gna.org/pychart/doc/module-coord.html#module-coord ) to
break an axis?
TIA
Christian
From: Jason K. <jas...@gm...> - 2009年10月21日 01:16:05
I'm new to matplotlib and python GUIs in general, so I apologize if I'm
missing something fundamental in my understanding of the matplotlib canvas -
figure - etc model. That said...
I'm working on a small matplotlib app using PyQT4. It involves selecting an
arbitrary number of data files and breaking each down into a group of 6
contour subplots. I want to be able to switch between contour plots from
each data set quickly to compare and contrast, so my thought was to
front-load the data analysis and figure creation and store them, then update
the displayed figure with a stored figure. I am not able to get the stored
figures to display though.
In attempt to debug/understand what's going on, I have the following:
class InputWindow (QtGui.QWidget):
 def __init__ (self, parent=None):
...
 self.dpi = 100
 self.fig = Figure((9.0, 6.0), dpi=self.dpi)
 self.canvas = FigureCanvas(self.fig)
 self.vbox = QtGui.QVBoxLayout()
 self.vbox.addLayout (grid)
 self.vbox.addLayout (self.hbox_pbs)
 self.vbox.addWidget (self.canvas)
 self.vbox.addStretch (1)
 self.setLayout (self.vbox)
 self.resize (900, 600)
 self.fig.add_subplot(111, aspect='equal')
...
This works fine and creates an empty plot. I can clear this figure with
self.fig.clear() and add subplots to it with self.fig.add_subplot upon
pushing a button in the UI. What I can't do is something like this:
 def Process (self):
 self.fig.clear() 
 fig2 = Figure((9.0, 6.0), dpi=self.dpi)
 fig2.add_subplot(211, aspect='equal')
 self.fig = fig2
 self.canvas.draw()
This will clear the figure, but it doesn't update with the contents of fig2. 
If I look at the properties of self.fig, they match those of fig2 though. 
Any help on what I need to do to get something like self.fig = fig2 working?
Thanks,
J
-- 
View this message in context: http://www.nabble.com/Setting-Figure-%3D-Figure-possible--tp25985129p25985129.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年10月20日 21:32:04
On Tue, Oct 20, 2009 at 4:43 PM, Thomas Robitaille
<tho...@gm...> wrote:
> ax.xaxis.set_major_formatter(NullFormatter)
http://matplotlib.sourceforge.net/api/axis_api.html?highlight=set_major_formatter#matplotlib.axis.Axis.set_major_formatter
An instance of NullFormatter is needed, instead of the class itself.
ax.xaxis.set_major_formatter(NullFormatter())
-JJ
10 messages has been excluded from this view by a project administrator.

Showing results of 419

<< < 1 .. 3 4 5 6 7 .. 17 > >> (Page 5 of 17)
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 によって変換されたページ (->オリジナル) /