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






Showing 5 results of 5

From: Steve C. <ste...@ya...> - 2003年11月12日 15:43:21
On Mon, 2003年11月10日 at 23:09, John Hunter wrote:
> >>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
> 
> Steve> I've been receiving the error message "matplotlib requires
> Steve> pygtk-1.99.16 or greater -- trying anyway. Please hold on"
> Steve> which is puzzling since I have pygtk 2.0 installed.
> 
> Is it possible you have both installed (eg, on a redhat 9 install the
> default pygtk is 1.99.14) and that you are importing the wrong one
> 
> Steve> error message that pygtk.require('2.0') generates. I think
> Steve> it would be improved by changing it to:
> 
> Good point. I changed it.
> 
> 
> Steve> "pygtk.require() must be called before importing gtk
> Steve> matplotlib requires pygtk-1.99.16 or greater -- trying
> Steve> anyway. Please hold on"
> 
> 
> This looks like you imported gtk in your app/script before either
> 
> 1) doing the pygtk.require thing
> 2) importing matplotlib first
> 
> If you do either of these, does everything work fine for you?
I don't use pygtk.require() myself, since I'm just writing small
programs to run on my own system which has python 2.3.2 and pygtk 2.0
installed together.
The problem was in the import order
I was doing:
import gtk
import mylibrary # which imports matplotlib
and was getting the warning message. Changing to
import mylibrary
import gtk
stops the warning appearing.
Steve
> 
> JDH
-- 
Steve Chaplin <ste...@ya...>
From: John H. <jdh...@ac...> - 2003年11月12日 14:42:07
What's new in matplotlib 0.32
 wx python backend -- development version 
 Jeremy O'Donoghue has done an amazing job implementing the backend
 for wxpython. The code is still alpha and several of the features
 that will be available are under active development. See the code
 matplotlib/backends/backend_wx.py for a report on existing features
 and known bugs. If you have wxpython installed, you can take it for
 a test drive with 'python yourscript.py -dWX' and please report any
 bugs not listed in the KNOWN BUGS section of the wx src to the
 matplotlib-devel mailing list.
Pseudo color plots
 The pcolor command generates pseudo color plots. See
 http://matplotlib.sourceforge.net/screenshots.html#pcolor_demo and
 http://matplotlib.sourceforge.net/screenshots.html#mri_with_eeg for
 screenshots and some example code
Numerous small bugfixes
 Fixed reversed zoom tools, bug in ticklabel setting, bug in AFM font
 path setting for PS backend, fixed a label position bug. Thanks for
 the bug reports!
John Hunter
From: Charles <ct...@cs...> - 2003年11月12日 06:58:49
Hi John,
The patch worked for me. :-)
JH: def is_last_row(self):
Nice, but maybe not enough. If the plots don't fill the bottom row, (say 7
plots on a 3x3 grid), it'll leave some columns with no xticklabels. We'd
need something like
	is_bottom()
But that would require knowing how many subplots there are, which subplot
doesn't do, and probably shouldn't.
-C
-- 
Charles R. Twardy www.csse.monash.edu.au/~ctwardy
Monash University sarbayes.org
Computer Sci. & Software Eng.
+61(3) 9905 5823 (w) 5146 (fax)
From: John H. <jdh...@ac...> - 2003年11月12日 04:51:12
>>>>> "Charles" == Charles <ct...@cs...> writes:
 Charles> Hi John, I added one line that shows the problem. If you
 Charles> do a set_xticks() first, then the usual ([]) doesn't
 Charles> blank them. Here's code that should suppress the xticks
 Charles> for all but the bottom-most graphs in each column. It
 Charles> works if you comment out the set_xticks line (HERE HERE
 Charles> HERE).
Hi Charles,
As an aside, you'll be interested in these super secret undocumented
methods of the Subplot class, which I implemented so I wouldn't have
to do the if i % COLS == 1 tricks that I came to know and love in
matlab. I too find myself making lots-o-subplots and blanking out the
labels
Subplot methods:
 def is_first_col(self):
 def is_first_row(self):
 def is_last_row(self):
 def is_last_col(self):
which enables you to write your loop
for i in range(1,NUMPLOTS+1):
 ax = subplot (ROWS, COLS, i)
 ax.set_xticks((0,1,2)) 
 title('Simple ' + str(i))
 
 if ax.is_first_col(): ax.set_ylabel('voltage (mV)')
 else: ax.set_yticklabels ([])
 if ax.is_last_row(): ax.set_xlabel('time (s)')
 else: ax.set_xticklabels ([])
Now onto your problem. Thanks for the example script. I am not sure
which version of matplotlib you are working with, but it appears there
is a clear bug in Axis.set_ticklabels in the part which reads
 for s, label in zip(self._ticklabelStrings, self._ticklabels):
 label.set_text(s)
 label.update_properties(override)
when len(self._ticklabelStrings) is less than len(self._ticklabels),
the label text doesn't get updated. Duh!
Something like this should work better. At least with
matplotlib-0.32a it handles your example
 def set_ticklabels(self, ticklabels, *args, **kwargs):
 """
 Set the text values of the tick labels. ticklabels is a
 sequence of strings. Return a list of AxisText instances
 """
 ticklabels = ['%s'%l for l in ticklabels]
 
 self._ticklabelStrings = ticklabels
 override = {}
 override = backends._process_text_args(override, *args, **kwargs)
 Nnew = len(self._ticklabelStrings)
 existingLabels = self.get_ticklabels()
 for i, label in enumerate(existingLabels):
 if i<Nnew: label.set_text(self._ticklabelStrings[i])
 else: label.set_text('')
 label.update_properties(override)
 return existingLabels
 Charles> Is this comment better for -users or -devel? Or bug
 Charles> tracking?
I think users, since my answer includes a *possible* fix which others
may find useful. Let me know how this works for you; I'll take a
closer look on Thurs when I have some breathing room again.
JDH
From: Charles <ct...@cs...> - 2003年11月12日 01:45:42
Hi John,
I added one line that shows the problem. If you do a set_xticks() first,
then the usual ([]) doesn't blank them. Here's code that should suppress
the xticks for all but the bottom-most graphs in each column. It works if
you comment out the set_xticks line (HERE HERE HERE).
Is this comment better for -users or -devel? Or bug tracking?
	-Charles
# -*- Mode: Python; py-indent-offset: 4 -*-
# Simple example to demonstrate ticklabel problem
# If you don't set_ticks first, the following works fine.
# If you do set_ticks, then ([]) doesn't blank the ticklabels.
# --crt
from matplotlib.matlab import *
NUMPLOTS = 8
COLS = 3
ROWS = NUMPLOTS / COLS
if NUMPLOTS % COLS: ROWS += 1
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
for i in range(1,NUMPLOTS+1):
 ax = subplot (ROWS, COLS, i)
 plot(t, s)
for i in range(1,NUMPLOTS+1):
 ax = subplot (ROWS, COLS, i)
 ax.set_xticks((0,1,2)) # HERE HERE HERE
 title('Simple ' + str(i))
 if i % COLS == 1: # left edge
 ax.set_ylabel('voltage (mV)')
 else:
 ax.set_yticklabels ([])
 if i > NUMPLOTS - COLS: # nothing below them
 ax.set_xlabel('time (s)')
 else:
 ax.set_xticklabels ([])
savefig('simple_plot')
show()
-- 
Charles R. Twardy www.csse.monash.edu.au/~ctwardy
Monash University sarbayes.org
Computer Sci. & Software Eng.
+61(3) 9905 5823 (w) 5146 (fax)

Showing 5 results of 5

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