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 6 results of 6

From: <sk...@po...> - 2005年09月13日 21:08:28
 skip> parse error before `typename' error: command 'gcc' failed
 skip> with exit status 1
 John> Hey Skip, this looks like a known pygtk bug -- fortunately th=
ere's
 John> a simple fix
 John> http://matplotlib.sourceforge.net/faq.html#PYGTK24
Thanks John. The fact that it was a PyGTK bug pointed me in the direct=
ion
of switching from gtk 2.4 to gtk 2.6. Problem solved.
On to my next problem ... :-)
After only a small further amount of wailing and gnashing of teeth I go=
t
matplotlib to build and install (just some -I, -L & -R flags for the
build_ext command). Then I decided to tackle the tutorial. Example 1:=
 % python
 Python 2.3.4 (#12, Jul 2 2004, 09:48:10)
 [GCC 3.3.2] on sunos5
 Type "help", "copyright", "credits" or "license" for more informati=
on.
 >>> import pygtk
 >>> pygtk.require('2.6')
 >>> from pylab import *
 >>> plot([1,2,3,4])
 [<matplotlib.lines.Line2D instance at 0x8790d6c>]
 >>> show()
 (process:3261): GLib-GObject-CRITICAL **: gtype.c:2253: initializat=
ion assertion failed, use g_type_init() prior to this function
 Segmentation Fault (core dumped)
Unfortunately, I'm not sure what further information to give you to hel=
p
tracking down the location. I have to run for the train, but will at l=
east
try running under gdb ma=F1ana. In the meantime, any suggestions about=
potential causes would be gracefully appreciated.
Skip
From: Sascha <sas...@gm...> - 2005年09月13日 20:31:30
Hello Yves,
> However, integrating matplotlib functionnalities
> through an External Method is a pain to maintain : any change to your 
> function
> means delete/recreate an External Method object in Zope. Not very 
> sustainable.
Just a quick comment: I also use External Methods for creating Matplotlib 
charts but deleting/recreating is not necessary upon changes. Maybe you had 
to do this because you were not running Zope in debug mode? Haven't tried 
this with debug off though.
Best regards,
Sascha 
From: Yves M. <ym...@gr...> - 2005年09月13日 19:42:13
David Dougall writes:
> I am a new Zope user and am trying to use matplotlib in a Zope application and 
> need some guidance on how to do so. 
> From a previous post in February 2005 (2-17-05), someone had a similar
problem. > From the archives, I'm not quite sure it was solved.
> This is the only related answer I found.
>From: Yves Moisan <ymoisan@gr...>
I'm sorry I took so long to chime in, but I have to use gmane's web interface
and for some reason I couldn't get to see your message. I still can't, but at
least I can see one of Sascha's replies that I can do a follow up on.
My first go at integrating matplotlib into Zope was via an external method and I
sent you some code about that. However, integrating matplotlib functionnalities
through an External Method is a pain to maintain : any change to your function
means delete/recreate an External Method object in Zope. Not very sustainable.
A better way is to use Archetypes (is you are a Plone or at least a CMF user). 
See thread at : http://plone.org/documentation/how-to/add-charts
Saving a PNG to a file and then updating an Archetypes ImageField (as described
in the above link) works well. I've worked out a way to use a tempFile and I
guess it probably works without tempFile also. So long as you save it to an
Archetypes field. 
If you try to pump the resulting image out e.g. in a tal statement, that is
without using an intermediate save step into an Archetypes field, then it won't
work (see thread above). If you happen to find a way of doing this, please let
me know. Using matplotlib in CMF/Plone for me currently implies having to add
an ImageField just to hold what usually amounts to be a temporary image. There
shouldn't be a need to store it in a content object.
Keep us posted on your trials!
Yves Moisan
From: Jeff P. <jef...@se...> - 2005年09月13日 16:44:48
Hello, I'm using python 2.4 and matplotlib 0.83 with WXAgg. I'm having
trouble with plot dates and the datelocator. I want to show only 5 dates
tick labels because anymore than this then the labels get crunched
together. I can get this to work with the multiplelocator but not the
datelocator. I copied the function I call to manage all my plot
attributes below. I input the canvas figure, two axes instances (axesA,
and axesD) and a class called myAxes which holds attributes like label
size and font and colors and such. I am trying to do something like this
(this is part of the code copied below):
 elif myAxes.majorFormatName == 'Dates':
 min, max = Numeric.array(axesA.get_xlim())
 xFormat = DateFormatter('%m/%d/%y')
 xmajorLocator = DateLocator((max-min)/8.0)
 # set major x tick format
 axesD.xaxis.set_major_formatter(xFormat)
 # set major x tick format
 axesA.xaxis.set_major_formatter(xFormat)
 
 if myAxes.autoScale == False:
 # set major locator
 axesD.xaxis.set_major_locator(xmajorLocator)
 # set major locator
 axesA.xaxis.set_major_locator(xmajorLocator)
Notice I have to be aware of whether or not autoScale is being used. I
am not sure about this either. Can I set the locator and use auoscale? I
was having some errors occur when I tried to do this. The way it shows
above seems to solve that problem.
Does anyone know what might be the problem with the datelocator() as
I've done it? 
Thanks!
Jeff
# redraw figure attributes
def Plot_Figure_Attributes(figure, myAxes, axesD, axesA):
 
 # set where to tick
 axesA.yaxis.tick_left()
 axesD.yaxis.tick_left()
 axesA.xaxis.tick_bottom()
 axesD.xaxis.tick_bottom()
 
 # turn axes on or off
 if myAxes.ShowAxesFrame == True:
 axesD.set_frame_on(True)
 axesA.set_frame_on(True)
 else:
 axesD.set_frame_on(False)
 axesA.set_frame_on(False)
 
 # set range limits
 if myAxes.autoScale == False:
 axesA.set_xlim((myAxes.xRangeMin, myAxes.xRangeMax))
 axesD.set_xlim((myAxes.xRangeMin, myAxes.xRangeMax))
 axesA.set_ylim((myAxes.yRangeMinA, myAxes.yRangeMaxA))
 axesD.set_ylim((myAxes.yRangeMinD, myAxes.yRangeMaxD))
 else:
 axesA.autoscale_view()
 axesD.set_xlim(axesA.get_xlim())
 
 # set figure background color
 axesA.set_axis_bgcolor(myAxes.edgeColor)
 axesD.set_axis_bgcolor(myAxes.edgeColor)
 # set figure face color
 figure.set_facecolor(myAxes.figureColor)
 
 # set legend
 if myAxes.legendShow == True:
 #get all instances of lines created by Plot()
 lines = axesA.get_lines()
 
	 #create the legend
 figure.legend(lines,
 myAxes.labels,
 'upper right')
 # set grid
 if myAxes.gridShow == True:
 axesD.grid(True)
 axesA.grid(True)
 
 if myAxes.yLabelShow == True:
 # set figure y label 
 axesD.set_ylabel(myAxes.yLabelD, color=myAxes.yLabelColor,
size=myAxes.yLabelSize, rotation=myAxes.yLabelRot)
 # set figure y label 
 axesA.set_ylabel(myAxes.yLabelA, color=myAxes.yLabelColor,
size=myAxes.yLabelSize, rotation=myAxes.yLabelRot)
 
 if myAxes.xLabelShow == True:
 # set figure x label
 axesD.set_xlabel(myAxes.xLabelD, color=myAxes.xLabelColor,
size=myAxes.xLabelSize, rotation=myAxes.xLabelRot)
 
 if myAxes.titleShow == True:
 # set figure title
 axesA.set_title(myAxes.title, color = myAxes.titleColor, size =
myAxes.titleSize)
 (min, max) = axesA.get_ylim()
 # define major y tick locator
 ymajorLocator = MultipleLocator((max-min)/myAxes.yMajorTickLoc)
 # define minor y tick locator
 yminorLocator = MultipleLocator((max-min)/myAxes.yMinorTickLoc)
 # define major y tick format
 yFormat = FormatStrFormatter(myAxes.yLabelPrecision)
 
 # define minor x formats and locators
 if myAxes.majorFormatName == 'Multiples':
 (min, max) = axesA.get_xlim()
 if (max-min)/myAxes.xMinorTickLoc < 1:
 xmajorLocator = 1
 else:
 xmajorLocator = (max-min)/5.0
 xmajorLocator = MultipleLocator(xmajorLocator) 
 xFormat = FormatStrFormatter('%d')
 elif myAxes.majorFormatName == 'Seconds': 
 xmajorLocator = SecondLocator()
 xFormat = DateFormatter('%S')
 elif myAxes.majorFormatName == 'Dates':
 min, max = Numeric.array(axesA.get_xlim())
 xFormat = DateFormatter('%m/%d/%y')
 xmajorLocator = DateLocator((max-min)/8.0)
 elif myAxes.majorFormatName == 'Minutes':
 xmajorLocator = MinuteLocator()
 xFormat = DateFormatter('%M')
 elif myAxes.majorFormatName == 'Hours':
 xmajorLocator = HourLocator()
 xFormat = DateFormatter('%H')
 elif myAxes.majorFormatName == 'Days':
 xmajorLocator = DayLocator()
 xFormat = DateFormatter('%m/%d/%y')
 elif myAxes.majorFormatName == 'Months':
 xmajorLocator = MonthLocator()
 xFormat = DateFormatter('%m/%d/%y')
 elif myAxes.majorFormatName == 'Years':
 xmajorLocator = YearLocator()
 xFormat = DateFormatter('%m/%d/%y')
 # set major x tick format
 axesD.xaxis.set_major_formatter(xFormat)
 # set major x tick format
 axesA.xaxis.set_major_formatter(xFormat)
 
 if myAxes.autoScale == False:
 # set major locator
 axesD.xaxis.set_major_locator(xmajorLocator)
 # set major locator
 axesA.xaxis.set_major_locator(xmajorLocator)
 # set x and y tick labels attributes 
 setAttr(axesA.get_yticklabels(),
fontsize=myAxes.yTickLabelSize,visible=True)
 setAttr(axesD.get_yticklabels(),
fontsize=myAxes.yTickLabelSize,visible=True)
 setAttr(axesA.get_xticklabels(),
fontsize=myAxes.xTickLabelSize,visible=True)
 setAttr(axesD.get_xticklabels(),
fontsize=myAxes.xTickLabelSize,visible=True)
 
From: Martin R. <law...@gm...> - 2005年09月13日 14:24:16
Hello everyone,
Hello John,
thank you very much for your example - it is really fantastic. This was
exactly what I meant.
When I was trying to rewrite your code to a 'fastplot()'-command (which
would just be able to plot one point at a time) it worked quite well with
the Circle()-command you used. But is there a possibility to write the
'fastplot' in a way so that it can be used like
 fastplot(x,y, marker='s', color='g',markersize = 3)?
In the example given below the color is not recognized correctly. Do I use
Line2D in a wrong way?
A second question aims on the running-behavior: It - well - stumbles a
little bit. If you add a
 print i
to the for-loop you can see that the counting is done very smoothly. But the
plot isn't (at least at my computer - maybe this is already the answer).
Once again: Thanks!
Bye,
Martin
#-----------------------------------------------------------------------
"""A try to enable a fastplot() command"""
def fastplot_points(*args, **kwargs):
 """This program tries to enable a routine 'fastplot' 
 based on JDH's code doing blit only in a small region 
 around the new object.
 Notice: args have to be (x, y) and not ([x], [y]) like for plot().
 x,y are floats - not vectors!
 """
 from matplotlib.lines import Line2D
 from matplotlib.transforms import identity_transform, lbwh_to_bbox
 ax = gca()
 trans = identity_transform()
 trans.set_offset( args, ax.transData)
 line = Line2D([0],[0], transform=trans, **kwargs)
 line.set_clip_box(ax.bbox)
 ax.add_line(line)
 l,b,w,h = line.get_window_extent(ax.get_renderer_cache()).get_bounds()
 pad = 3
 bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)
 ax.draw_artist(line)
 ax.figure.canvas.blit(bbox)
#-----------------------------------------------------------------------
from pylab import *
import time
n=1000
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')
print " fastplot every point seperately ... "
axis([-1,1,-1,1])
axis('scaled')
draw() # necessary to get renderer
for i in xrange(n): # plot all data step by step
 fastplot_points( x[i], y[i],marker='s',color='r')
tend = time.time()
print 'It took %4.2f s.'%(tend - tstart)
close(1)
ioff()
-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
From: John H. <jdh...@ac...> - 2005年09月13日 11:52:35
>>>>> "skip" == skip <sk...@po...> writes:
 skip> file included from src/_gtkagg.cpp:10:
 skip> /opt/app/gnome-2.4/include/pygtk-2.0/pygobject.h:140: error:
 skip> parse error before `typename'
 skip> /opt/app/gnome-2.4/include/pygtk-2.0/pygobject.h:147: error:
 skip> parse error before `typename' error: command 'gcc' failed
 skip> with exit status 1
 ....
 skip> Has anyone else encountered this problem? If so, do you
 skip> have a workaround?
Hey Skip, this looks like a known pygtk bug -- fortunately there's a
simple fix
 http://matplotlib.sourceforge.net/faq.html#PYGTK24
If you encounter any solaris specific compile issues that require
workarounds, it might be a good idea to make a few notes
and post them here or on the wiki because a number of people have
reported problems in the past, though I also know a number have
succeeded.
Good luck,
JDH

Showing 6 results of 6

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