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





Showing 8 results of 8

From: Darren D. <dd...@co...> - 2005年02月13日 20:48:20
I noticed that when I do something like 
pylab.title(r'$\rm{MnO}_{2}$')
that the text is rendered with small variation in the alignment of the 
characters. In the example linked below, the lower-case letters in the title 
appear to be offset.
http://people.ccmr.cornell.edu/~dd55/matplotlib.html
I end up exporting .eps files, and there the rendering is normal. Has anyone 
else noticed this effect?
(By the way, nice work on the log-scale formatter, John. Now the tick-label 
fonts match in a semilog plot.) 
-- 
Darren
From: John H. <jdh...@ac...> - 2005年02月13日 20:31:48
>>>>> "Joe" == Joe Jones <jo...@th...> writes:
 Joe> As this problem looks font related I should mention that
 Joe> there are two versions of freetype2 on my system (Suse
 Joe> 9.0). one in /usr/lib that came with my system, and one in
 Joe> /usr/local that I installed myself. I unistalled the
 Joe> headerfiles and static libs of the one which came with the
 Joe> system. The run time linker is finding the new one, so
 Joe> matplot is compiling and linking against the same version.
Hey Joe, thanks for the detailed info. These kinds of bugs are very
hard to track down since I can't replicate them. A few suggestions.
rm -rf your "build" sub-directory *and* site-packages/matplotlib and
get a clean install to make sure there is no lingering old code
linking to the old freetype. Make sure you have a pretty recent
freetype (eg >= 2.1.7). What version *are* you using?
Once you get matplotlib reinstalled, see if you can replicate the bug.
If not, good. If so, send an ldd of
site-packages/matplotlib/ft2font.so, and see if you can reproduce the
problem with a minimal script, eg
 from matplotlib.ft2font import FT2Font
 font = FT2Font('/your/path/to/Vera.ttf')
 font.set_size(40, 150)
 font.set_text('finish it', 40)
 font.draw_glyphs_to_bitmap()
 fname = 'font.raw'
 font.write_bitmap(fname)
This will take out a lot of the unknowns. The FT2Font constructor
does call the FT_Get_Postscript_Name function, which appears to be
involved according to your gdb session.
Thanks,
JDH
From: John H. <jdh...@ac...> - 2005年02月13日 19:58:48
>>>>> "Mark" == Mark Hailes <mh...@cl...> writes:
 Mark> Hi In case anyone has the same problem getting GTKAgg (I
 Mark> think this is the best option for use with pythonwin & Idle
 Mark> & pycrust since the default TKAgg causes GPF) to work on win
 Mark> XP, note that the current version of pyGTK for windows -
 Mark> pygtk-2.4.1-2.win32-py2.4.exe doesn't work with the versions
 Mark> of GTK available from the page linked to in the matplotlib
 Mark> faq owing to an unresolved dll reference. However,
 Mark> gtk-win32-2.6.1-rc3.exe will work. I think that GTK has some
 Mark> parallel development strands, which is confusing ...
Hmm, good to know. So you're saying gtkagg works from pythonwin? That
would be *very nice* for windows users. I'll take a look at the
installers you are suggesting, because I've had a hard time finding an
environment to suggest to win32 matplotlib users, particularly
newbies. The pythonwin environment, in my opinion, is very nice for
windows users because it has the native win32 look and feel, but I
wasn't aware of any matplotlib backends that could be used within it
due to GUI conflict issues. Have you tried gtkagg with this gtk
release in win32, both in script mode (Eg "Run") and in interactive
mode (eg entering plot commands at the shell)?
JDH
From: John H. <jdh...@ac...> - 2005年02月13日 19:56:04
>>>>> "daniele" =3D=3D daniele <dga...@gm...> writes:
 daniele> Hi, I=B4m new to matplotlib. I=B4m writing a program using
 daniele> wxPython. The purpose of it is to insert some prices in a
 daniele> form and get a plot of them in a graph inside the main
 daniele> window. Is it possible to refresh the graph with the new
 daniele> values after a button is pushed? How? Thank you very
 daniele> much. DG
You want to define some function that updates the data in your plot
and then calls canvas.draw(). You can then connect that callback to
the clicked event of your button.
See, for example, embedding_in_wx3.py in the matplotlib examples
directory, which does just this (thanks Andrew!)
JDH
From: Joe J. <jo...@th...> - 2005年02月13日 18:54:57
Hi
I've just compiled and installed matplotlib 0.71. When I tried some of the 
example scripts I found that they all segfault. It's "from pylab import *" 
that does it. I'm working on linux.
Here is the output. I have VERBOSE set to true in setup.py and there is more 
output than I'm showing here.
python -c 'from pylab import *'
...
...
SeparableTransformation::SeparableTransformation
Glyph::init_type
FT2Font::init_type
font search path ['/usr/share/matplotlib']
ft2font_module::new_ft2font
FT2Font::FT2Font
FT2Font::clear
Segmentation fault
If I use gdb to get a stack trace
(gdb) where
#0 0x408059e9 in FT_Get_Postscript_Name (face=0x8170e98) at ftobjs.c:2457
#1 0x407aa61f in FT2Font (this=0x80f7d60, facefile=
 {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No 
data fields>}, _M_p = 0x814ebb4 "/usr/share/matplotlib/VeraIt.ttf"}, static 
_S_empty_rep_storage = {0, 0, 0, 0}}) at src/ft2font.cpp:96
#2 0x407b5ded in ft2font_module::new_ft2font(Py::Tuple const&) 
(this=0x811b300, args=@0x20) at Objects.hxx:456
#3 0x407bf1ef in 
Py::ExtensionModule<ft2font_module>::invoke_method_varargs(std::string 
const&, Py::Tuple const&) (
 this=0x811b300, name=@0xbfff8e70, args=@0x60) at Extensions.hxx:283
#4 0x407c960e in method_varargs_call_handler 
(_self_and_name_tuple=0x40858e10, _args=0x4078de8c)
 at CXX/cxx_extensions.cxx:1238
As this problem looks font related I should mention that there are two 
versions of freetype2 on my system (Suse 9.0). one in /usr/lib that came with 
my system, and one in /usr/local that I installed myself. I unistalled the 
headerfiles and static libs of the one which came with the system. The run 
time linker is finding the new one, so matplot is compiling and linking 
against the same version.
If someone can give me a clue about this I would be very happy.
Joe
From: daniele <dga...@gm...> - 2005年02月13日 14:56:50
Hi,
I=B4m new to matplotlib. I=B4m writing a program using wxPython. The
purpose of it is to insert some prices in a form and get a plot of
them in a graph inside the main window. Is it possible to refresh the
graph with the new values after a button is pushed? How?
Thank you very much.
DG
From: John H. <jdh...@ac...> - 2005年02月13日 02:01:23
>>>>> "Humufr" == Humufr <hu...@ya...> writes:
 Humufr> Hi, I did some change (again) in the load
 Humufr> function to improve the speed when you're load some big
 Humufr> data file but you want use only some columns. I did all my
 Humufr> tests with a file with 9722 line and 16 columns. The
 Humufr> bench test file is after. I think that the result of the
 Humufr> bench are interesting:
 Humufr> I you want use 2 columns on the 16 the results are:
 Humufr> load matplotlib 0.58 load with columns choice 0.27 normal
 Humufr> load inside the new load version 0.58
 Humufr> We win a factor two. I know that depend totally from the
 Humufr> number of columns and that the change is not interesting
 Humufr> and more decrease the efficiency if you want use all the
 Humufr> data in your file but like the columns call is optionnal I
 Humufr> don't think that is point is crucial but I add a figure to
 Humufr> see the effect when you go to one to all the columns.
 Humufr> The load function is after.
Either there was an error i your cut and paste, or the reason your new
load function is faster is that it does nothing. Note the indentation
The second time you do "for line in fh" you clearly intend to be
handling the columns case, but it is inside the "if columns is None"
block.
It looks like the reason the columns version of load is faster is
because it's not doing anything...
JDH
 if columns is None:
 for line in fh:
 line = line[:line.find(comments)].strip()
 if not len(line): continue
 row = [float(val) for val in line.split()]
 thisLen = len(row)
 if numCols is not None and thisLen != numCols:
 raise ValueError('All rows must have the same number
of columns')
 X.append(row) else:
 for line in fh:
 line = line[:line.find(comments)].strip()
 if not len(line): continue
 row = [val for val in line.split()]
 row = [float(row[i]) for i in columns]
 thisLen = len(row)
 if numCols is not None and thisLen != numCols:
 raise ValueError('All rows must have the same number
 Humufr> Regards,
 Humufr> Nicolas
 Humufr> -----------------------------------------------
 Humufr> #!/usr/bin/env python # -*- coding: utf-8 -*-
 Humufr> from time import clock
 Humufr> t3 = clock() import load_2 Y=load_2.load('data') x=Y[:,0]
 Humufr> y=Y[:,1] t4 = clock() #print t4-t3 #print x,y
 Humufr> col = [0,6] t1 = clock() import load_matplotlib
 Humufr> X=load_matplotlib.load('data') #X = [X[:,i] for i in col]
 Humufr> x=X[:,0] y=X[:,1] t2 = clock() print 'load matplotlib',
 Humufr> t2-t1 #print X
 Humufr> t3 = clock() import load_2
 Humufr> X=load_2.load('data',columns=range(14)) x=Y[:,0] y=Y[:,1]
 Humufr> t4 = clock() print 'load with columns choice', t4-t3
 Humufr> t3 = clock() import load_2 Y=load_2.load('data') x=Y[:,0]
 Humufr> y=Y[:,1] t4 = clock() normal = t4-t3 print 'normal load ',
 Humufr> normal
 Humufr> time = [] for i in range(16): t3 = clock() import load_2
 Humufr> X=load_2.load('data',columns=range(i)) x=Y[:,0] y=Y[:,1]
 Humufr> t4 = clock() #print 'load with columns choice', t4-t3
 Humufr> time.append(t4-t3)
 Humufr> from pylab import * time = array(time)/normal
 Humufr> plot(range(16),time) xlabel('N columns (total = 16)')
 Humufr> ylabel('time columns /normal time') show()
 Humufr> ------------------------------------------------------------------
 Humufr> def load(fname,comments='%',columns=None): """ Load ASCII
 Humufr> data from fname into an array and return the array.
 Humufr> The data must be regular, same number of values in
 Humufr> every row
 Humufr> fname can be a filename or a file handle.
 Humufr> A character for to delimit the comments can be use
 Humufr> (optional),
 Humufr> the default is the matlab character '%'.
 Humufr> An second optional argument can be add, to tell
 Humufr> which columns you
 Humufr> want use in the file. This arguments is a list who
 Humufr> contains the
 Humufr> number of columns beggining by 0 (python style).
 Humufr> matfile data is not currently supported, but see
 Humufr> Nigel Wade's matfile
 Humufr> ftp://ion.le.ac.uk/matfile/matfile.tar.gz
 Humufr> Example usage:
 Humufr> X = load('test.dat') # data in two columns t =
 Humufr> X[:,0] y = X[:,1]
 Humufr> Alternatively, you can do
 Humufr> t,y = transpose(load('test.dat')) # for two column
 Humufr> data X = load('test.dat',[0,2]) # data in two columns
 Humufr> (columns 1 and 3 use in the file)
 Humufr> X = load('test.dat') # a matrix of data X =
 Humufr> load('test.dat',columns=[2,3]) # a matrix of data, only
 Humufr> columns 3 and 4 will be use x = load('test.dat') # a
 Humufr> single column of data
 Humufr> x = load('test.dat,'#') # the character use like a
 Humufr> comment delimiter is '#' """
 Humufr> # from numarray import array
 Humufr> fh = file(fname)
 Humufr> X = [] numCols = None if columns is None: for line in
 Humufr> fh: line = line[:line.find(comments)].strip() if not
 Humufr> len(line): continue row = [float(val) for val in
 Humufr> line.split()] thisLen = len(row) if numCols is not None
 Humufr> and thisLen != numCols: raise ValueError('All rows must
 Humufr> have the same number of columns') X.append(row) else: for
 Humufr> line in fh: line = line[:line.find(comments)].strip() if
 Humufr> not len(line): continue row = [val for val in
 Humufr> line.split()] row = [float(row[i]) for i in columns]
 Humufr> thisLen = len(row) if numCols is not None and thisLen !=
 Humufr> numCols: raise ValueError('All rows must have the same
 Humufr> number of columns') X.append(row)
 Humufr> X = array(X) r,c = X.shape if r==1 or c==1: X.shape =
 Humufr> max([r,c]), return X
 
From: John H. <jdh...@ac...> - 2005年02月13日 01:51:33
>>>>> "Fl=E1vio" =3D=3D Fl=E1vio Code=E7o Coelho <fcc...@fi...> wr=
ites:
 Fl=E1vio> hi, how can I remove a colorbar?
 Fl=E1vio> in the following code, i generate figures that are saved
 Fl=E1vio> not shown. and with every new figure I get an extra
 Fl=E1vio> colorbar instead of an updated one!
Hi Flavio,
Try clearing the figure between saves with clf. Or else manage the
different figures the "figure" and "close" commands.
The default mode of matplotlib is to continue adding stuff to the same
figure, so you need to clear axes with "cla", clear figures with
"clf", close figures with "close", create new figures with "figure",
and manage the hold state with "hold", "ion", "ioff" and "ishold".
See the documentation for all of these commands at
http://matplotlib.sf.net/matplotlib.pylab.html
Hope this helps,
JDH

Showing 8 results of 8

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 によって変換されたページ (->オリジナル) /