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






Showing 9 results of 9

From: Rick K. <ke...@gm...> - 2005年07月22日 22:49:48
On 7/22/05, John Hunter <jdh...@ac...> wrote:
> >>>>> "Rick" =3D=3D Rick Kwan <ke...@gm...> writes:
>=20
> > ax.xaxis.set_major_locator(LinearLocator(top))
> > xlabs =3D ax.set_xticklabels(['evt%d'%i for i in range(top)])
>=20
> LinearLocator(12) doesn't mean place ticks on the integers from 1-12
> -- it says to make 12 linearly spaced ticks. If you know where you
> want the ticks and what you want the labels to be, use
>=20
> xticks(locs,labels)
>=20
> as in
>=20
...
I knew there had to be an elegant solution. Thanks very much.
--Rick Kwan
From: John H. <jdh...@ac...> - 2005年07月22日 20:02:12
>>>>> "Rick" == Rick Kwan <ke...@gm...> writes:
 > ax.xaxis.set_major_locator(LinearLocator(top)) 
 > xlabs = ax.set_xticklabels(['evt%d'%i for i in range(top)])
LinearLocator(12) doesn't mean place ticks on the integers from 1-12
-- it says to make 12 linearly spaced ticks. If you know where you
want the ticks and what you want the labels to be, use 
 xticks(locs,labels)
as in 
from pylab import *
top = 11. # 11 produces point on grid
#top = 12. # 12 produces skewed data points
ind = arange(top)
ax = subplot(111)
plot(ind, ind, 'gd-')
grid(True)
labels = ['evt%d'%i for i in ind]
xticks(ind, labels)
show()
From: Alan G I. <ai...@am...> - 2005年07月22日 19:15:05
On 2005年7月21日, Rick Kwan apparently wrote: 
> I'm trying to produce a 2D plot of data points where the 
> X-axis represents a sequence of named events. A grid and 
> xticklabels have been enabled for clarity. 
> For a sample size of 11, all the points fall on the grid. For 12, 
> they do not. Beyond that seems to be on a case-by-case basis. 
> I'm sure I must be abusing the relationship between ticks and data, 
> but the proper solution eludes me. 
> from pylab import * 
> # top = 11 # 11 produces point on grid 
> top = 12 # 12 produces skewed data points 
> iter = [i for i in range(top)] 
> ax = subplot(111) 
> plot(iter, iter, 'gd-') 
> grid(True) 
> ax.xaxis.set_major_locator(LinearLocator(top)) 
> xlabs = ax.set_xticklabels(['evt%d'%i for i in range(top)]) 
> show() 
Count the gridlines. ;-)
You are mislabeling the tics.
(You might set the axes ranges explicitly to address this.)
hth,
Alan Isaac
From: gf <gyr...@gm...> - 2005年07月22日 17:43:57
Hi,
I downloaded and tried to install matplotlib-0.83.1 under Redhat
Enterprise Linux 4.
Unfortunately, I am getting errors that are apparently related to
compilation of the C++ code (see below).
I don't know C++ and am at a loss as to what to do next.=20
I'd appreciate any help you can provide me in remedying these problems.
Thanks.
-g
=3D=3D=3D
$: uname -a
Linux localhost.localdomain 2.6.9-11.ELsmp #1 SMP Thu Jun 9 15:33:26
CDT 2005 i686 i686 i386 GNU/Linux
=3D=3D=3D
$: python
Python 2.3.4 (#1, Feb 18 2005, 12:15:38)=20
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
=3D=3D=3D
$: python setup.py build =20
running build
running build_py
running build_ext
building 'matplotlib.backends._gtkagg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32
-march=3Di386 -mtune=3Dpentium4 -D_GNU_SOURCE -fPIC -fPIC
-I/usr/local/include -I/usr/include -Isrc -Iswig -Iagg23/include -I.
-I/usr/local/include -I/usr/include -I/usr/local/include/freetype2
-I/usr/include/freetype2 -Isrc/freetype2 -Iswig/freetype2
-Iagg23/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include
-I/usr/include/pygtk-2.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0
-I/usr/include/pango-1.0 -I/usr/include/freetype2
-I/usr/include/freetype2/config -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/python2.3 -c
src/_gtkagg.cpp -o build/temp.linux-i686-2.3/src/_gtkagg.o
In file included from /usr/include/python2.3/Python.h:8,
 from /usr/include/pygtk-2.0/pygobject.h:5,
 from src/_gtkagg.cpp:10:
/usr/include/python2.3/pyconfig.h:850:1: warning: "_POSIX_C_SOURCE" redefin=
ed
In file included from /usr/include/string.h:26,
 from
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/cstring:=
51,
 from src/_gtkagg.cpp:1:
/usr/include/features.h:150:1: warning: this is the location of the
previous definition
In file included from src/_gtkagg.cpp:10:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...'
before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...'
before "typename"
error: command 'gcc' failed with exit status 1
=3D=3D=3D
From: R. K. <re...@gm...> - 2005年07月22日 15:53:42
Thanks for the reply. I work with lidar data, which like radar data
can span many decades. There is often negative values in the data so
taking the log of the data can be annoying (depending on the
programming environment). Also, the log of the data is less meaningful
(to me) so that means I'll end up changing the labels on the
colorabar. I guess you say it is also the principle of the matter.
I'll give your suggestion a try as soon as I have some time. Thanks!
Ralph
p.s. I'm just learning python and I just recently discovered
matplotlib (I've been using matlab for a long time) and I think it is
very well done. Great job.
On 7/21/05, John Hunter <jdh...@ac...> wrote:
> >>>>> <re...@gm...> writes:
>=20
> I have image data 2d array with values that spans several
> decades. It would be extremely useful for me to be able
> to plot this data with imshow using a colorbar/color
> scale that is logarithmic. In the past I have just taken
> the log of the data, but that solution is not really
> acceptable for me. Any suggestions would be
> welcome. Perhaps someone could give me a idea on how to
> modify matplotlib to have this functionality. Thanks.
>=20
> Jean-Luc also posted recently asking for logarithmic color scaling.
> I would have thought that taking the log of your image data *would*
> work for you. Can you explain why this doesn't -- I haven't worked
> with logarithmic image data before so assume you are talking to a
> newbie.
>=20
> Note you can provide your own custom normalization and colormap
> instances to imshow. These are generic functionals, so you should e
> able to do anything you want. There is an example of writing a custom
> normalization and colormap instance here
>=20
> http://sourceforge.net/mailarchive/message.php?msg_id=3D12339259
>=20
> If you write one that does what you need, please post it back here so
> it can be folded into the mainline. If you have trouble with this, if
> you just describe more thoroughly what you need one of us might be
> able to do it.
>=20
> JDH
>
From: Alan G I. <ai...@am...> - 2005年07月22日 13:49:09
On 2005年7月21日, John Hunter apparently wrote: 
> In principle, you can use the 
> backends.backend_tkagg.new_figure_manager to manage the 
> figures you create. This will handle window creation and 
> destruction. You could also use 
> backends.backend_tkagg.show instead of starting the 
> mainloop yourself. But the usual way is to manage the GUI 
> stuff yourself and just use the mpl canvas and optionally, 
> the toolbar, because when you do GUI programming you want 
> maximal control. 
Something came up where it pylab is a little awkward. So 
I put a toe in the water of Matplotlib's more object 
oriented side. This is just a user report/rumination on 
some puzzles that arose when approaching Matplotlib's OO 
API, for whatever it may be worth. 
If you just want to save a figure to file, moving to the OO 
API feels like a small but rewarding step. But if you want 
GUI aspects, it feels different. Specifically, it feels 
like one is immediately forced to thing substantially about 
GUI aspects that might (?) have been hidden for a while 
longer. I will give two examples. 
1. I'm using TkAgg. I expected to find something like 
def show_tkagg(figure,title=''):
	from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
	window = Tk.Tk()
	window.wm_title(title) 
	canvas = FigureCanvasTkAgg(figure, master=window) 
	canvas.draw() 
	canvas.get_tk_widget().pack() 
	Tk.mainloop()
but with more functionality. I did not find such a thing
(which does not mean it's not there of course), and even 
new_figure_manager seems less intuitive. The idea, in any 
case, is that with such functions I could move more "gently" 
into the GUI realm where my experience is limited (i.e., 
nil). Also the hope lingers that if I need to change 
backends I can just change a 'use' and a 'show_...' and be 
done. 
2. This example is more speculative, since I know even less 
what I'm talking about. But when I see something like 
 toolbar = NavigationToolbar2TkAgg( canvas, root ) 
 toolbar.update() 
 canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, 
 expand=1) I wonder why something like 
 canvas.add_toolbar(location,...)
is not available to abstract from the GUI specific 
considerations. Of course as a complete newbie in this 
arena I am not really entitled to wonder such things, but 
there it is. 
I am not "proposing" anything here. I'm just a user 
trying to be helpful by illustrating the kinds of questions that 
might arise for other users as they dig a little deeper into 
this amazing tool. 
Cheers, 
Alan Isaac 
From: Steve S. <el...@gm...> - 2005年07月22日 13:06:06
Attachments: overlay.eps overlay.py
Hi
Here the test. As you can see the points 1,2,3 are red, 4 and 5 are 
purple and 6 and 7 are red.
=======================================================================
elcorto@ramrod:~/Python/torsten/psa/test$ python overlay.py 
--verbose-helpful
matplotlib data path /usr/share/matplotlib
loaded rc file /usr/share/matplotlib/.matplotlibrc
matplotlib version 0.81
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.8
font search path ['/usr/share/matplotlib']
loaded ttfcache file /home/elcorto/.ttffont.cache
backend GTKAgg version 2.6.1
========================================================================
cheers,
steve
John Hunter wrote:
>>>>>>"Steve" == Steve Schmerler <el...@gm...> writes:
> 
> 
> Steve> Hi all When I plot the same data set with say red and blue
> Steve> markers, then mpl seems to mix the colors (red + blue ->
> Steve> purple). How can I turn this behavior off?
> 
> This doesn't sound right to me -- can you post an example which
> exposes this problem and provide the backend you are using -- eg, run
> your script with 
> 
> > python myscript.py --verbose-helpful
> 
> and post the output along with myscript.py
> 
> Thanks,
> JDH
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
From: Jean-Luc M. <jea...@fr...> - 2005年07月22日 08:51:07
> It already exists:
> 
> gca().set_yscale('log')
Thank you vrey much for the answer but I was probably not clear : What 
I want to do is to have a logarithmic color scaling (ie zcale).
However I tried your method (it may be useful) :
import MLab,Numeric,pylab
a=Numeric.resize(MLab.rand(900),[30,30])
b=a
pylab.imshow(b)
pylab.gca().set_yscale('log')
but I obtain an error message :
ValueError: Cannot set nonpositive limits with log transform
Jean-Luc Menut
From: Rick K. <ke...@gm...> - 2005年07月22日 00:02:03
Greetings, folks. I am a Matplotlib novice.
I'm trying to produce a 2D plot of data points where the X-axis
represents a sequence of named events. A grid and xticklabels have
been enabled for clarity.
For a sample size of 11, all the points fall on the grid. For 12,
they do not. Beyond that seems to be on a case-by-case basis.
I'm sure I must be abusing the relationship between ticks and data,
but the proper solution eludes me.
Below is a distilled version of the script. This was run on
Matplotlib 0.65 and Numarray 1.1.1. We have similar problems with
Matplotlib 0.80 and Numeric 23.8. What am I doing wrong? =20
--Rick Kwan
---- novice script starts here ----
from pylab import *
# top =3D 11 # 11 produces point on grid
top =3D 12 # 12 produces skewed data points
iter =3D [i for i in range(top)]
ax =3D subplot(111)
plot(iter, iter, 'gd-')
grid(True)
ax.xaxis.set_major_locator(LinearLocator(top))
xlabs =3D ax.set_xticklabels(['evt%d'%i for i in range(top)])
show()

Showing 9 results of 9

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