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

Showing results of 28

1 2 > >> (Page 1 of 2)
From: Malte M. <Mal...@cs...> - 2005年09月20日 23:41:27
Our first publication using matplotlib is with the referee.
A big thanks to John.
Malte
From: John H. <jdh...@ac...> - 2005年09月20日 22:48:22
>>>>> "Nadia" == Nadia Dencheva <den...@st...> writes:
 Nadia> Hi John, Martin, I was experimenting with drawing markers
 Nadia> one at a time for a ReadCursor class to provide the option
 Nadia> of marking the position of the cursor. I saw this email and
 Nadia> read the thread (the users mailing list is very helpful).
 Nadia> Since markers and lines go together and implementing
 Nadia> markers in the same way for ReadCursor would cause a lot of
 Nadia> code duplication, I tried pulling out the relevant
 Nadia> functions from lines.py and creating a Marker class -
 Nadia> attached. A test function is below. I am using TkAgg, so
 Nadia> _newstyle is True and renderer has draw_markers. x and y
 Nadia> in Marker.__init__ are sequences and are turned into 1d
 Nadia> arrays before passed to draw_markers. I get:
 Nadia> Traceback (most recent call last): File "test_marker.py",
 Nadia> line 9, in ? m.draw_marker(fcr) File
 Nadia> "/Users/dencheva/cvs-matplotlib/matplotlib/lib/matplotlib/markers.py",
 Nadia> line 556, in draw_marker markerFunc(renderer, gc, xt, yt)
 Nadia> File
 Nadia> "/Users/dencheva/cvs-matplotlib/matplotlib/lib/matplotlib/markers.py",
 Nadia> line 85, in _draw_pixel renderer.draw_markers(gc, path, xt,
 Nadia> yt) IndexError: Unexpected SeqBase<T> length.
With newstyle, the signature of draw_markers is
draw_markers(gc, path, rgbFace, x, y, trans)
where x and y are not transformed and trans is an mpl transform.
Here is the docstring from backend_bases.py
 def _draw_markers(self, gc, path, rgbFace, x, y, trans):
 """
 This method is currently underscore hidden because the
 draw_markers method is being used as a sentinel for newstyle
 backend drawing
 path - a matplotlib.agg.path_storage instance
 Draw the marker specified in path with graphics context gc at
 each of the locations in arrays x and y. trans is a
 matplotlib.transforms.Transformation instance used to
 transform x and y to display coords. It consists of an
 optional nonlinear component and an affine. You can access
 these two components as
 if transform.need_nonlinear():
 x,y = transform.nonlinear_only_numerix(x, y)
 # the a,b,c,d,tx,ty affine which transforms x and y
 vec6 = transform.as_vec6_val()
 ...backend dependent affine...
 """
 pass
You may also want to search the dev archives for more elaborate
discussions. I'm short on time now so gotta run!
JDH
From: Smith, F. <F....@te...> - 2005年09月20日 21:05:53
I would like to echo Darren sentiments. John and all others that have
contributed: You've really done a great job!
-----Original Message-----
From: Darren Dale [mailto:dd...@co...]=20
Sent: Monday, September 19, 2005 8:55 PM
To: mat...@li...
Subject: [Matplotlib-users] success story
Hi Folks,
I wanted to share a quick story. I'm in the process of wrapping up my=20
dissertation. Nearly every figure is generated with MPL, using the TeX=20
support that John spearheaded a while back. I paid a visit to the
dreaded=20
thesis secretary on Friday, who has a reputation of being extremely
tough.=20
She gave me an A+.
John, you don't hear this frequently enough. You're the man.
Darren
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your
very own Sony(tm)PSP. Click here to play:
http://sourceforge.net/geronimo.php
_______________________________________________
Matplotlib-users mailing list Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Steinar R. E. <sr...@bi...> - 2005年09月20日 18:38:50
Great. Thanks!
Helge Avlesen wrote:
> On 9/20/05, Steinar Rune Eriksen <sr...@bi...> wrote:
> 
>>One question for me (being a new matplotlib user). When using this
>>recipe to get it incorporated in Zope, I get a gray area around my
>>chart. Anyway to set this to a different color (white) ?
> 
> 
> you could try
> 
> figure.facecolor : white
> 
> in your matplotlibrc
> 
> Helge
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
From: <phi...@ho...> - 2005年09月20日 15:13:27
Hi list,
Hi John,
I'm using matplotlib in OO mode.
I created an instance of Figure then add some subplots to it.
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
 self.fig = Figure(figsize=(320,200), dpi=80)
 a = self.fig.add_subplot(1,1,1, axisbg='r')
Now i create another instance of Figure.
 self.new_fig = Figure(figsize=(320,200), dpi=80)
My aim is to add a Subplot instance to the new Figure instance and 
changind the number of rows and columns and the position of the Subplot.
I could have done:
 self.new_fig.add_subplot(a)
Nevertheless, it doesn't work. self.new_fig is empty when displaying it 
in a FigureCanvas.
Furthermore, i need the property of subplot to change.
 a.set(2,2,1)
 self.new_fig.add_subplot(a)
Is there any solution except to make another instance of the subplot?
Thanks a lot,
Philippe Collet
From: Nadia D. <den...@st...> - 2005年09月20日 14:57:57
Attachments: test_marker.py markers.py
Hi John, Martin,
I was experimenting with drawing markers one at a time for a ReadCursor
class to provide the option of marking the position of the cursor. I 
saw this
email and read the thread (the users mailing list is very helpful).
Since markers and lines go together and implementing markers in the 
same way
for ReadCursor would cause a lot of code duplication, I tried pulling 
out the relevant
functions from lines.py and creating a Marker class - attached. A test 
function is below.
 I am using TkAgg, so _newstyle is True and renderer has draw_markers.
x and y in Marker.__init__ are sequences and are turned into 1d arrays 
before passed to
draw_markers. I get:
Traceback (most recent call last):
 File "test_marker.py", line 9, in ?
 m.draw_marker(fcr)
 File 
"/Users/dencheva/cvs-matplotlib/matplotlib/lib/matplotlib/markers.py", 
line 556, in draw_marker
 markerFunc(renderer, gc, xt, yt)
 File 
"/Users/dencheva/cvs-matplotlib/matplotlib/lib/matplotlib/markers.py", 
line 85, in _draw_pixel
 renderer.draw_markers(gc, path, xt, yt)
IndexError: Unexpected SeqBase<T> length.
What am I doing wrong?
If I set _newstyle explicitely to False, in order to test this part of 
the various draw_* functions,
I don't get any errors but a marker is not plotted.
So, again I must be doing something wrong.
If I understand this correctly I need the same functionality as Martin. 
If either of you have any ideas of
what is wrong, I'd appreciate any help. Also we don't have to reinvent 
the wheel independently, so if
this is not the right approach and Martin has a better way I am willing 
to help with this, by testing or any
other way.
Thanks,
Nadia Dencheva
From: John H. <jdh...@ac...> - 2005年09月20日 13:26:53
>>>>> "Nadezhda" == Nadezhda Dencheva <den...@st...> writes:
 Nadezhda> I can only add that for me the crash appears only in
 Nadezhda> ipython on OS X with this particular font. It is in the
 Nadezhda> set_text function and after I added print statements it
 Nadezhda> went away. From reading the mailing list and when other
 Nadezhda> people get crash, it seems that the only common thing is
 Nadezhda> the font - Vera.ttf.
 Nadezhda> Is there a way to tell matplotlib what font to use?
Paul did add support for this when writing the font manager.
You should be able to do, eg
 from matplotlib.font_manager import FontProperty
 prop = FontProperty(fname='/path/to/somefont.ttf')
 xlabel('some text', fontproperties=prop)
Since you said the crash went away when you added a print statement,
my guess is that there is a bad pointer haunting us in the font module
that is cropping up (or not) in different contexts. If you get
any more information, let us know.
JDH
From: Nadezhda D. <den...@st...> - 2005年09月20日 12:53:23
I can only add that for me the crash appears only in ipython on OS X
with this particular font. It is in the set_text function and after
I added print statements it went away. From reading the mailing list
and when other people get crash, it seems that the only common thing is
the font - Vera.ttf.
Is there a way to tell matplotlib what font to use?
(after I removed the print statements (nothing else changed) matplotlib
doesn't load this font any more, so I can't reproduce the crash.)
If I can tell it to use Vera.ttf and reproduce it, this will help
keep my sanity.
Nadia
John Hunter wrote:
>>>>>>"Christian" == Christian Kristukat <ck...@ho...> writes:
> 
> 
> Christian> Hi, the WXAgg backend of 0.84 produces segfaults on
> Christian> linux using wxPython2.6-gtk2-unicode-2.6.1.0-1_py2.3.
> 
> Have you verified that it is wxagg specific? Eg, what do happens with
> the following backends: WX, Agg, PS?
> 
> Christian> This is the debugging output:
> Christian> found Bitstream Vera Sans, normal, normal 500, normal,
> Christian> 12.0 findfont returning /usr/share/matplotlib/Vera.ttf
> Christian> Segmentation fault
> 
> Nadia recently reported a crash in the font module in OS X when
> loading Vera.ttf, but hers was only in ipython. Weird. What version
> of freetype are you using? She was using 2.1.9 think.
> 
> It would really help if we could nail this down, but I haven't been
> able to replicate it on my end yet. If you could edit src/ft2font.cpp
> and fint the Ft2Font::set_text function. Add a lot of lines thoughout
> that function like
> 
> _VERBOSE("FT2Font::set_text 1");
> //some code here
> _VERBOSE("FT2Font::set_text 2");
> //some code here
> _VERBOSE("FT2Font::set_text 3");
> 
> and then switch VERBOSE=True in setup.py and reinstall. I sometimes
> go through a couple of iterations ("poorman's binary search") to find
> the precise line that is crashing.
> 
> Note it is only a guess that the crash is in set_text, based on the
> information I got from Nadia when we left off on this issue, but the
> VERBOSE output will give more precise information in this regard.
> 
> JDH
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Alan G I. <ai...@am...> - 2005年09月20日 11:40:20
It sounds like you want step_pts from
http://www.american.edu/econ/pytrix/pytrix.py
Maybe.
Alan Isaac
def step_pts(x, y):
=09'''Given x and y, return points for step function plot.
=09:Parameters:
=09 - `x`: [x0,x1,...,xn] list of x values (first coordinate)
=09 - `y`: [y0,y1,...,yn] list of y values (second coordinate)
=09:rtype: tuple of lists
=09:return: (xnew,ynew)
=09=09where xnew=3D(x0,x1,x1,...,xn,xn) and ynew=3D(y0,y0,y1,y1,...,yn).
=09:author: Alan G. Isaac
=09:since: 2005年05月15日
=09'''=20
=09pts=3Dzip(x,y) #original points as tuples
=09inter =3D zip(x[1:],y[:-1]) #new points as tuples
=09#now splice pts and inter -> list of all points as tuples
=09pts_inter =3D [j for i in map(None,pts,inter) for j in i][:-1]
=09#split the points list into (x-coordinates),(y-coordinates)
=09z =3D zip(*pts_inter)=20
=09return z[0],z[1]
From: Christian K. <ck...@ho...> - 2005年09月20日 11:14:44
John Hunter wrote:
>>>>>>"Christian" == Christian Kristukat <ck...@ho...> writes:
> 
> 
> Christian> Hi, the WXAgg backend of 0.84 produces segfaults on
> Christian> linux using wxPython2.6-gtk2-unicode-2.6.1.0-1_py2.3.
> 
> Have you verified that it is wxagg specific? Eg, what do happens with
> the following backends: WX, Agg, PS?
> 
It happens only with WXAgg.
> 
> _VERBOSE("FT2Font::set_text 1");
> //some code here
> _VERBOSE("FT2Font::set_text 2");
> //some code here
> _VERBOSE("FT2Font::set_text 3");
> 
the error doesn't seem to be related to set_text:
FT2Font::set_text
FT2Font::set_text 1
FT2Font::set_text 2
FT2Font::set_text 3
FT2Font::set_text 4
FT2Font::set_text 5
FT2Font::set_text 5
FT2Font::set_text 5
FT2Font::set_text 6
FT2Font::set_text done
FT2Font::getattr
FT2Font::draw_glyphs_to_bitmap
FT2Font::compute_string_bbox
FT2Font::draw_bitmap
FT2Font::draw_bitmap
FT2Font::draw_bitmap
RendererAgg::draw_text
GCAgg::GCAgg
GCAgg::points_to_pixels
GCAgg::get_color
GCAgg::antialiased
GCAgg::_set_linecap
GCAgg::_set_joinstyle
GCAgg::_set_dashes
GCAgg::_set_clip_rectangle
RendererAgg::set_clipbox_rasterizer
RendererAgg::set_clipbox_rasterizer done
SeparableTransformation::eval_scalars
Affine::eval_scalars
Affine::eval_scalars DONE
Affine::operator
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
Value::get
Bbox::~Bbox
Point::~Point
Value::~Value
Value::~Value
Point::~Point
Value::~Value
Value::~Value
Value::get
Interval::~Interval
Bbox::get_bounds
Value::get
Christian
From: Steve S. <el...@gm...> - 2005年09月20日 10:57:36
Nils Wagner wrote:
> Steve Schmerler wrote:
> 
>>Nils Wagner wrote:
>>
>>>Hi all,
>>>
>>>Is it intended that a variety of messages like
>>>
>>>LazyValue::init_type
>>>Value::init_type
>>>BinOp::init_type
>>>Point::init_type
>>>Interval::init_type
>>>Bbox::init_type
>>>Func::init_type
>>>FuncXY::init_type
>>>Transformation::init_type
>>>SeparableTransformation::init_type
>>>NonseparableTransformation::init_type
>>>Affine::init_type
>>>init_nc_transforms
>>>Glyph::init_type
>>>FT2Font::init_type
>>>_transforms_module::new_value
>>>_transforms_module::new_value
>>>_transforms_module::new_point
>>>Point::Point
>>>_transforms_module::new_value
>>>_transforms_module::new_value
>>>_transforms_module::new_point
>>>Point::Point
>>>_transforms_module::new_bbox
>>>Bbox::Bbox
>>>_transforms_module::new_value
>>>_transforms_module::new_value
>>>_transforms_module::new_point
>>>Point::Point
>>>_transforms_module::new_value
>>>_transforms_module::new_value
>>>_transforms_module::new_point
>>>Point::Point
>>>_transforms_module::new_bbox
>>>Bbox::Bbox
>>>_transforms_module::new_func
>>>_transforms_module::new_func
>>>_transforms_module::new_separable_transformation
>>>BBoxTransformation::BBoxTransformation
>>>SeparableTransformation::SeparableTransformation
>>>init_nc_image
>>>Image::init_type
>>>_transforms_module::new_value
>>>Value::~Value
>>>init_nc_backend_agg
>>>
>>>appear on the screen ? I am using the latest cvs version.
>>>
>>>Nils
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>SF.Net email is sponsored by:
>>>Tame your development challenges with Apache's Geronimo App Server.
>>>Download
>>>it for free - -and be entered to win a 42" plasma tv or your very own
>>>Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>>>_______________________________________________
>>>Matplotlib-users mailing list
>>>Mat...@li...
>>>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>>Hi
>>
>>Did you compile with VERBOSE = True?
>>
>>cheers,
>>steve
>>
> 
> I have used
> 
> python setup.py build
> python setup.py install
> 
> to install matplotlib. Where can I find this flag ?
> 
> Nils
> 
> 
Hi
in setup.py
When you say
	plot(...)
you will see a lot of such messages.
cheers,
steve
From: John H. <jdh...@ac...> - 2005年09月20日 10:29:18
>>>>> "Martin" == Martin Richter <law...@gm...> writes:
 Martin> Hello everyone, Hello John,
 Martin> as you advised in a Mail some days ago concerning a
 Martin> fastplot-command I wrote a polygon_factory and it worked
 Martin> quite well (In large parts taken from Line2D). See the
 Martin> code attached. What I now want to ask you is: Would it be
 Martin> good to write this object-oriented (propably yes, so one
 Martin> gets rid of all those tiny funktions _make_...(size))? One
 Martin> drawback which comes into my mind is: How should this
 Martin> class be used within fastplot()? Initialize an instance
 Martin> each time you plot a single point? Wouldn't this slow down
 Martin> everything a bit (or am I overestimating the time-scales)?
 Martin> On the otherhand using a class would look very 'tidy'.
Yes, it would be tidy, but you might pay for that in performance as
you suggest. As far as tidiness, you can use the existing approach
and not add all the _make* functions the __all__ list the module
exports -- this would make the helper functions invisible. You could
also use nested scopes
 def my_factory(*args):
 def helper1(x): pass
 def helper2(x): pass
 do_something_and_return()
However, since the code you use to compute the vertices is lifted from
lines.py, it would be nice to define one set of functions that could
be reused by both the line marker code and polygon code. This would
be the cleanest design and would be easier to maintain, but it would
require refactoring both your code and the lines.py code a little. If
you want to take this on, that would be great.
JDH
From: John H. <jdh...@ac...> - 2005年09月20日 10:22:19
>>>>> "christophe" == christophe grimault <chr...@no...> writes:
 christophe> from matplotlib._nc_transforms import * ImportError:
 christophe> /usr/lib/python2.4/site-
 christophe> packages/matplotlib/_nc_transforms.so: undefined
 christophe> symbol:
 christophe> _ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj
 
 christophe> However, Numeric24 is installed (and was installed
 christophe> before matplotlib), and import Numeric is OK.
 christophe> BTW, I use gcc33... but i don't think it matters a
 christophe> lot, does it ?l
Wonder if this could be a compiler version / C++ name mangling issue?
Did you compile from src? If so please rm -rf the build dir and
site-packages/matplotlib and try a clean install. If not, you may
want to contact the maintainer of the binary build you are using.
JDH
From: John H. <jdh...@ac...> - 2005年09月20日 10:19:01
>>>>> "Stephen" == Stephen Boulet <st...@th...> writes:
 Stephen> Is there a way to set the size of a polar plot (similar
 Stephen> to the axis argument to the plot command for a
 Stephen> rectangular plot)? Thanks.
Hmmm. I do not believe the plot command takes an axis argument.
Do you mean the "axes" and "subplot" commands which are used to set
the size of the Axes that contains the plot? If so, just pass 
polar=True to them, as in
 subplot(111, polar=True)
 axes([0.2, 0.2, 0.7, 0.7], polar=True)
I am updating the axes doc string.
API users, note that the same applies to fig.add_axes and
fig.add_subplot.
JDH
From: John H. <jdh...@ac...> - 2005年09月20日 10:12:14
>>>>> "Zhang" == Zhang Le <zha...@gm...> writes:
 Zhang> Hello, In one of my figure I'd like to add one or more
 Zhang> rules below the xAxis specifying time alignment label info:
 Zhang> How can I do that? Many thanks, Zhang Le
There is no good support for having multiple axis lines right now, but
it is on the wish list. You can use major and minor ticks though.
See the section "Tick locators and formatters" in the User's Guide and
the examples/major_minor_demo*.py in the examples dir.
You could also manually draw the axis lines, the ticks, and add the
tick labels yourself, but this is a bit more work.
JDH
From: Martin R. <law...@gm...> - 2005年09月20日 10:11:06
Hello everyone,
Hello John,
as you advised in a Mail some days ago concerning a fastplot-command I wrote
a polygon_factory and it worked quite well (In large parts taken from
Line2D). See the code attached.
What I now want to ask you is:
Would it be good to write this object-oriented (propably yes, so one gets
rid of all those tiny funktions _make_...(size))? One drawback which comes
into my mind is: How should this class be used within fastplot()? Initialize
an instance each time you plot a single point? Wouldn't this slow down
everything a bit (or am I overestimating the time-scales)?
On the otherhand using a class would look very 'tidy'.
Thanks for your suggestion.
Bye,
Martin
#--------------------------------------------------------------------
""" A routine which uses blitting so that it is possible to plot 
 seperate markers faster than usual.
"""
from pylab import *
import time # for profiling
#--------------------------------------------------------------------
from matplotlib.lines import Line2D
from matplotlib.transforms import identity_transform, lbwh_to_bbox
from Numeric import pi
def _make_point(size):
 size *= .5
 if size <= 0.5:
 return _make_pixel()
 elif size <= 2:
 return _make_hexagon1(size, point=True)
 else:
 return _make_circle(size, point=True)
def _make_pixel():
 return ((-0.5, -0.5),
 (-0.5, 0.5),
 ( 0.5, 0.5),
 ( 0.5, -0.5))
def _make_circle(size, point=False):
 if point:
 size *= .5
 N = 50.0
 r = size/2.0
 rads = (2*pi/N)*arange(N)
 xs = r*cos(rads)
 ys = r*sin(rads)
 verts = [(xs[0], ys[0])]
 for x, y in zip(xs[1:], ys[1:]):
 verts.append((x, y))
 return tuple(verts)
def _make_triangle_up(size):
 return (( 0, size),
 (-size, -size),
 ( size, -size))
def _make_triangle_down(size):
 return ((-size, size),
 ( size, size),
 ( 0, -size))
def _make_triangle_left(size):
 return ((-size, 0),
 ( size, -size),
 ( size, size))
def _make_triangle_right(size):
 return (( size, 0),
 (-size, -size),
 (-size, size))
def _make_tri_down(size):
 size1 = size*0.8
 size2 = size*0.5
 return ((-size1, size2),
 ( 0, 0),
 ( size1, size2),
 ( 0, 0)
 ( 0, -size)
 ( 0, 0))
def _make_tri_up(size):
 size1 = size*0.8
 size2 = size*0.5
 return ((-size1, -size2),
 ( 0, 0),
 ( size1, -size2),
 ( 0, 0),
 ( 0, size),
 ( 0, 0))
def _make_tri_left(size):
 size1 = size*0.8
 size2 = size*0.5
 return ((size2, -size1),
 ( 0, 0),
 (size2, size1),
 ( 0, 0),
 (-size, 0),
 ( 0, 0))
def _make_tri_right(size):
 size1 = size*0.8
 size2 = size*0.5
 return ((-size2, -size1),
 ( 0, 0),
 (-size2, size1),
 ( 0, 0),
 ( size, 0),
 ( 0, 0))
def _make_square(size):
 return ((-size, -size),
 (-size, size),
 ( size, size),
 ( size, -size))
def _make_diamond(size):
 return (( size, 0),
 ( 0, -size),
 (-size, 0),
 ( 0, size))
def _make_thin_diamond(size):
 xsize = 0.6*size
 return (( xsize, 0),
 ( 0, -size),
 (-xsize, 0),
 ( 0, size))
def _make_pentagon(size):
 sizeX1 = size*0.95
 sizeY1 = size*0.31
 sizeX2 = size*0.59
 sizeY2 = size*0.81
 return (( 0, size),
 (-sizeX1, sizeY1),
 (-sizeX2, -sizeY2),
 ( sizeX2, -sizeY2),
 ( sizeX1, sizeY1))
def _make_hexagon1(size, point=False):
 if point:
 size *= .5
 sizeX1 = size*0.87
 sizeY1 = size*0.5
 return (( 0, size),
 (-sizeX1, sizeY1),
 (-sizeX1, -sizeY1),
 ( 0, -size),
 ( sizeX1, -sizeY1),
 ( sizeX1, sizeY1))
def _make_hexagon2(size):
 sizeX1 = size*0.5
 sizeY1 = size*0.87
 return (( size, 0),
 ( sizeX1, sizeY1),
 (-sizeX1, sizeY1),
 ( -size, 0),
 (-sizeX1, -sizeY1),
 ( sizeX1, -sizeY1))
def _make_plus(size):
 return ((-size, -size),
 ( size, size),
 ( 0, 0),
 ( size, -size),
 (-size, size),
 ( 0, 0))
def _make_x(size):
 return ((-size, 0),
 ( size, 0),
 ( 0, 0),
 ( 0, -size),
 ( 0, size),
 ( 0, 0))
def _make_vline(size):
 return ((0, -size),
 (0, size))
def _make_hline(size):
 return ((-size, 0),
 ( size, 0))
markerd = {
 '.' : _make_point,
 ',' : _make_pixel,
 'o' : _make_circle,
 'v' : _make_triangle_down,
 '^' : _make_triangle_up,
 '<' : _make_triangle_left,
 '>' : _make_triangle_right,
 '1' : _make_tri_down,
 '2' : _make_tri_up,
 '3' : _make_tri_left,
 '4' : _make_tri_right,
 's' : _make_square,
 'p' : _make_pentagon,
 'h' : _make_hexagon1,
 'H' : _make_hexagon2,
 '+' : _make_plus,
 'x' : _make_x,
 'D' : _make_diamond,
 'd' : _make_thin_diamond,
 '|' : _make_vline,
 '_' : _make_hline
 }
def polygon_factory(ax, marker, size, args, **kwargs):
 """ This function creates a Polygon-instance having a shape 
 according to the given marker. This instance is located at 
 the position specified by the args (containing two 
 floats x and y).
 """
 func = markerd[marker]
 renderer = ax.get_renderer_cache()
 verts = func(size = 1.0*renderer.points_to_pixels(int(size)))
 trans = identity_transform()
 trans.set_offset( (args[0], args[1]), ax.transData)
 poly = Polygon( verts, transform=trans, **kwargs )
 poly.set_clip_box(ax.bbox)
 return poly
def fastplot_points(*args, **kwargs):
 """This program tries to enable a routine 'fastplot' using 
 JDH's method of reblitting only a small region around 
 the new object.
 Notice: args have to be (x, y) and not ([x], [y]) 
 like for plot().
 You can select the markers with the keyword marker = 'h' 
 for example.
 To change their color use
 facecolor = 'g' or fc = 'g'
 and
 edgecolor = 'b' or ec = 'b' respectivly.
 To vary their size use either ms = 4.5 or markersize = 4.5.
 For a change of the markeredgewidth use
 markeredgewith, mew, linewidth or lw
 (If more of them are given they are respected in this order)
 Also all other kwargs can be used (antialiased, alpha, ...)
 """
 ax = gca()
 trans = identity_transform()
 trans.set_offset(args, ax.transData)
 marker = kwargs.pop('marker', 'o') # which marker is desired
 # (default:'o')?
 msize = kwargs.pop('markersize', kwargs.pop('ms', 6))
 # filter out the desired size
 # (If both kwargsare given
 # 'markersize' is prefered.)
 lw = kwargs.pop('markeredgewidth',
 kwargs.pop('mew',
 kwargs.pop('linewidth',
 kwargs.pop('lw', .5))))
 # filter out the desired
 kwargs.update({'lw':lw}) # edgewidth
 
 p = polygon_factory(ax, marker, msize, args, **kwargs)
 p.set_clip_box(ax.bbox)
 l,b,w,h = p.get_window_extent().get_bounds()
 pad = 3
 bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)
 ax.draw_artist(p)
 ax.figure.canvas.blit(bbox)
 
#-------------------------------------------------------------------
n=300
phi=2.0*pi*arange(n)/n
x=cos(phi)
y=sin(phi)
ion()
figure(1)
subplot(111, autoscale_on=False)
tstart = time.time()
title('point by point with blitting')
axis([-1,1,-1,1])
axis('scaled')
for i in xrange(n): # plot all data step by step
 fastplot_points( x[i], y[i],marker='o', fc = 'b')
tend = time.time()
t_fast = tend - tstart
close(1)
ioff()
print " It took %6.2f s."%(t_fast)
#-------------------------------------------------------------------
-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++
From: John H. <jdh...@ac...> - 2005年09月20日 10:09:52
>>>>> "Christian" == Christian Kristukat <ck...@ho...> writes:
 Christian> Hi, the WXAgg backend of 0.84 produces segfaults on
 Christian> linux using wxPython2.6-gtk2-unicode-2.6.1.0-1_py2.3.
Have you verified that it is wxagg specific? Eg, what do happens with
the following backends: WX, Agg, PS?
 Christian> This is the debugging output:
 Christian> found Bitstream Vera Sans, normal, normal 500, normal,
 Christian> 12.0 findfont returning /usr/share/matplotlib/Vera.ttf
 Christian> Segmentation fault
Nadia recently reported a crash in the font module in OS X when
loading Vera.ttf, but hers was only in ipython. Weird. What version
of freetype are you using? She was using 2.1.9 think.
It would really help if we could nail this down, but I haven't been
able to replicate it on my end yet. If you could edit src/ft2font.cpp
and fint the Ft2Font::set_text function. Add a lot of lines thoughout
that function like
 _VERBOSE("FT2Font::set_text 1");
 //some code here
 _VERBOSE("FT2Font::set_text 2");
 //some code here
 _VERBOSE("FT2Font::set_text 3");
and then switch VERBOSE=True in setup.py and reinstall. I sometimes
go through a couple of iterations ("poorman's binary search") to find
the precise line that is crashing.
Note it is only a guess that the crash is in set_text, based on the
information I got from Nadia when we left off on this issue, but the
VERBOSE output will give more precise information in this regard.
JDH
From: Peter G. <pgr...@ge...> - 2005年09月20日 10:08:45
> I want to plot a stepwise line using
>plot([1,2,3,4,5],[2,-2,2,-2,2]). But what I get is something like two
>triangular like shape. But I want a stepwise shape that has steep
>vertical jumps. How can I do that?
> 
>
this what you mean?
#!/usr/bin/env python
from pylab import *
plot([1,2,3,4,5],[2,-2,2,-2,2], linestyle='steps')
gca().set_ylim( (-3, 3))
show()
> Many thanks,
>Zhang Le
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by:
>Tame your development challenges with Apache's Geronimo App Server. Download
>it for free - -and be entered to win a 42" plasma tv or your very own
>Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>_______________________________________________
>Matplotlib-users mailing list
>Mat...@li...
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
>
-- 
Peter Groszkowski Gemini Observatory
Tel: +1 808 9742509 670 N. A'ohoku Place
Fax: +1 808 9359235 Hilo, Hawai'i 96720, USA 
From: Zhang Le <zha...@gm...> - 2005年09月20日 09:54:33
Hello,
 In one of my figure I'd like to add one or more rules below the
xAxis specifying time alignment label info:
 xAxis------------------------------------------------------------------
 1 2 3 ... =20
 99 100
ruler1--|------------|--------------------|----------------------|------
 label1 label2 label3 label n
ruler2--------|--------------------|----------------------|-------------
 label1 label2 label3
How can I do that?
Many thanks,
Zhang Le
From: Zhang Le <zha...@gm...> - 2005年09月20日 09:43:19
Hello,
 I want to plot a stepwise line using
plot([1,2,3,4,5],[2,-2,2,-2,2]). But what I get is something like two
triangular like shape. But I want a stepwise shape that has steep
vertical jumps. How can I do that?
 Many thanks,
Zhang Le
From: Helge A. <he...@gm...> - 2005年09月20日 09:19:58
On 9/20/05, Steinar Rune Eriksen <sr...@bi...> wrote:
> One question for me (being a new matplotlib user). When using this
> recipe to get it incorporated in Zope, I get a gray area around my
> chart. Anyway to set this to a different color (white) ?
you could try
figure.facecolor : white
in your matplotlibrc
Helge
From: Christian K. <ck...@ho...> - 2005年09月20日 09:14:05
Hi,
the WXAgg backend of 0.84 produces segfaults on linux using 
wxPython2.6-gtk2-unicode-2.6.1.0-1_py2.3.
This is the debugging output:
ck@bla:~/testarea/matplotlib-0.84/examples> python pcolor_demo2.py -dWXAgg
loaded rc file /home/ck/.matplotlib/matplotlibrc
matplotlib version 0.84
verbose.level debug
interactive is False
platform is linux2
loaded modules: ['pylab', '__future__', 'copy_reg', 'sre_compile', 'distutils', 
'itertools', '_sre', 'japanese.aliases', 'site', '__builtin__', 'datetime', 
'matplotlib.tempfile', 'encodings', 'encodings.encodings', 'sre_constants', 
'distutils.string', 'dateutil', 'matplotlib.datetime', 'posixpath', '_random', 
'tempfile', 'errno', 'matplotlib.warnings', 'encodings.codecs', 
'matplotlib.sys', 'pytz.datetime', 're', 'os.path', 'pytz.sys', '_codecs', 
'distutils.sysconfig', 'encodings.exceptions', 'pytz.sets', 'math', 'fcntl', 
'stat', 'zipimport', 'string', 'warnings', 'encodings.types', 'UserDict', 
'sets', 'encodings.utf_8', 'matplotlib', 'japanese', 'sys', 
'japanese.aliases.encodings', 'pytz.tzinfo', 'pytz', '__main__', 
'matplotlib.__future__', 'codecs', 'distutils.re', 'matplotlib.pytz', 'types', 
'strop', 'matplotlib.dateutil', 'matplotlib.os', 'thread', 'sre', 'bisect', 
'matplotlib.distutils', 'signal', 'distutils.errors', 'random', 'linecache', 
'distutils.os', 'posix', 'encodings.aliases', 'time', 'exceptions', 'sre_parse', 
'pytz.bisect', 'distutils.sys', 'os']
numerix Numeric 23.3
font search path ['/usr/share/matplotlib']
trying fontname /usr/share/matplotlib/VeraIt.ttf
trying fontname /usr/share/matplotlib/VeraMoIt.ttf
trying fontname /usr/share/matplotlib/cmsy10.ttf
trying fontname /usr/share/matplotlib/VeraSe.ttf
trying fontname /usr/share/matplotlib/cmmi10.ttf
trying fontname /usr/share/matplotlib/Vera.ttf
$HOME=/home/ck
CONFIGDIR=/home/ck/.matplotlib
loaded ttfcache file /home/ck/.matplotlib/ttffont.cache
matplotlib data path /usr/share/matplotlib
backend WXAgg version 2.6.1.0
 findfont failed Lucida Grande
 findfont failed Verdana
 findfont failed Geneva
 findfont failed Lucida
 findfont found Bitstream Vera Sans, normal, normal 500, normal, 12.0
findfont returning /usr/share/matplotlib/Vera.ttf
Segmentation fault
Christian
From: Steve S. <el...@gm...> - 2005年09月20日 08:27:22
Nils Wagner wrote:
> Hi all,
> 
> Is it intended that a variety of messages like
> 
> LazyValue::init_type
> Value::init_type
> BinOp::init_type
> Point::init_type
> Interval::init_type
> Bbox::init_type
> Func::init_type
> FuncXY::init_type
> Transformation::init_type
> SeparableTransformation::init_type
> NonseparableTransformation::init_type
> Affine::init_type
> init_nc_transforms
> Glyph::init_type
> FT2Font::init_type
> _transforms_module::new_value
> _transforms_module::new_value
> _transforms_module::new_point
> Point::Point
> _transforms_module::new_value
> _transforms_module::new_value
> _transforms_module::new_point
> Point::Point
> _transforms_module::new_bbox
> Bbox::Bbox
> _transforms_module::new_value
> _transforms_module::new_value
> _transforms_module::new_point
> Point::Point
> _transforms_module::new_value
> _transforms_module::new_value
> _transforms_module::new_point
> Point::Point
> _transforms_module::new_bbox
> Bbox::Bbox
> _transforms_module::new_func
> _transforms_module::new_func
> _transforms_module::new_separable_transformation
> BBoxTransformation::BBoxTransformation
> SeparableTransformation::SeparableTransformation
> init_nc_image
> Image::init_type
> _transforms_module::new_value
> Value::~Value
> init_nc_backend_agg
> 
> appear on the screen ? I am using the latest cvs version.
> 
> Nils
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
Hi
Did you compile with VERBOSE = True?
cheers,
steve
-- 
Women are like cell phones. They like to be held and talked to, but push 
the wrong button, and you'll be disconnected.
From: Nils W. <nw...@me...> - 2005年09月20日 07:58:23
Hi all,
Is it intended that a variety of messages like
LazyValue::init_type
Value::init_type
BinOp::init_type
Point::init_type
Interval::init_type
Bbox::init_type
Func::init_type
FuncXY::init_type
Transformation::init_type
SeparableTransformation::init_type
NonseparableTransformation::init_type
Affine::init_type
init_nc_transforms
Glyph::init_type
FT2Font::init_type
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
init_nc_image
Image::init_type
_transforms_module::new_value
Value::~Value
init_nc_backend_agg
appear on the screen ? I am using the latest cvs version.
Nils
From: Steinar R. E. <sr...@bi...> - 2005年09月20日 07:12:57
Thanks for the examples.
One question for me (being a new matplotlib user). When using this 
recipe to get it incorporated in Zope, I get a gray area around my 
chart. Anyway to set this to a different color (white) ?
Sascha wrote:
> John,
> 
>> Hey Sascha, thanks for this example. If you get some time, could you
>> add it to the matplotlib wiki at
>> http://www.scipy.org/wikis/topical_software/MatplotlibCookbook?
> 
> 
> It's been a pleasure. I have added my example (including your suggested 
> changes) to the wiki: 
> http://www.scipy.org/wikis/topical_software/MatplotlibAndZope
> 
> Sascha
> 
>> I have one suggestion: you need to be careful to do
>>
>> import matplotlib
>> matplotlib.use('Agg')
>>
>> *before* importing pylab, in case the default matplotlibrc setting has
>> a GUI backend (eg 'backend : GTKAgg')
>>
>> Thanks!
>> JDH 
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

Showing results of 28

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