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
(21) |
3
(21) |
4
(14) |
5
(8) |
6
(12) |
7
(16) |
8
(27) |
9
(39) |
10
(19) |
11
(12) |
12
(3) |
13
(3) |
14
(18) |
15
(14) |
16
(6) |
17
(7) |
18
(19) |
19
(5) |
20
(8) |
21
(24) |
22
(42) |
23
(12) |
24
(11) |
25
(16) |
26
(2) |
27
(4) |
28
(10) |
|
|
|
|
|
Hi Ben, On Wed, 9 Feb 2011 03:15:19 AM you wrote: > As formatted, the code would not run. I presume that everything after "for > j in range(0,M):" should be indented? When I did that and ran it in > ipython, I could not reproduce your problem. What version of matplotlib > are you running? Thanks for your continued close attention to this undoubted problem. Your email system mangled the indentation. The correct indentation is displayed at http://sourceforge.net/mailarchive/message.php?msg_id=27020771 I have also included a copy of the script matplotlib_bug_example.py with this message. [*Not* posted to the list.] Here is how I run it: ipython -pylab Python 2.6.2 (r262:71600, Oct 28 2010, 20:54:41) Type "copyright", "credits" or "license" for more information. IPython 0.10 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment. For more information, type 'help(pylab)'. In [1]: run matplotlib_bug_example.py My original post http://sourceforge.net/mailarchive/message.php?msg_id=27016368 listed what I thought were the relevant versions: Quote I am using openSUSE 11.2 with python-base-2.6.2-6.7.1.x86_64 python-matplotlib-1.0.1-20.1.x86_64 python-matplotlib-tk-1.0.1-20.1.x86_64 python-matplotlib-wx-1.0.1-20.1.x86_64 Unquote I have since run the script on a second machine which uses Ubuntu Karmic, with identical results. Versions in brief: Linux linfinit 2.6.31.12-0.1-default #1 SMP PREEMPT 2010年12月10日 11:18:32 +0100 x86_64 x86_64 x86_64 GNU/Linux IPython-0.10-3.2.noarch python-2.6.2-6.7.1.x86_64 python-matplotlib-1.0.1-20.1.x86_64 python-matplotlib-tk-1.0.1-20.1.x86_64 python-matplotlib-wx-1.0.1-20.1.x86_64 python-numpy-1.5.0-17.2.x86_64 python-tk-2.6.2-6.7.1.x86_64 Linux cheeze 2.6.31-22-generic #70-Ubuntu SMP Wed Dec 1 23:51:13 UTC 2010 i686 GNU/Linux ipython 0.10-1 python 2.6.4-0ubuntu1 python-matplotlib 0.99.0-1ubuntu1 python-numpy 1:1.3.0-3 python-tk 2.6.3-0ubuntu1 I have included a listing showing all versions of all packages with names containing the string "python", on both machines. [*Not* posted to the list.] Best, Paul
Curiouslearn, on 2011年02月08日 15:32, wrote: > Sorry if the subject line does not use correct terminology. But the > following explains the question I have: > Suppose I have the following code: > > import matplotlib.pyplot as plt > > fig1 = plt.figure() > ax1 = fig1.add_subplot(1,1,1) > > ax1.scatter(xvalues, yvalues) > ax1.axvline(1.3, color='DarkGreen') > rect = ax1.patch > rect.set_facecolor('SteelBlue') #This works > rect.set_edgecolor('red') # Is it supposed to set the color of the > border. If so, this DOES NOT work. > rect.set_linestyle('dashed') # This DOES NOT work. > rect.set_linewidth(4) # This DOES NOT work. > > For the things that do not work, I tried both > > plt.show() > > and, > > plt.savefig('this_figure.pdf') > > Why do the things that I have indicated do not work? > > My second question is, if I want to have only the x-axis and y-axis > line (i.e., get rid of the right edge and top edge of the axes frame) > how do I do it? The names of the things you want to change are called spines. You want: ax1.spines['right'].set_visible(False) ax1.spines['top'].set_visible(False) ax1.spines['left'].set_color('red') ax1.spines['bottom'].set_color('red') #and so on for .set_linestyle, .set_linewidth To hide the tickmarks that are right next to the spines, you can do: ax1.xaxis.tick_bottom() ax1.yaxis.tick_left() and finally, to color the ticks in red as well, do: ax1.tick_params(color='red') best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
Sorry if the subject line does not use correct terminology. But the following explains the question I have: Suppose I have the following code: import matplotlib.pyplot as plt fig1 = plt.figure() ax1 = fig1.add_subplot(1,1,1) ax1.scatter(xvalues, yvalues) ax1.axvline(1.3, color='DarkGreen') rect = ax1.patch rect.set_facecolor('SteelBlue') #This works rect.set_edgecolor('red') # Is it supposed to set the color of the border. If so, this DOES NOT work. rect.set_linestyle('dashed') # This DOES NOT work. rect.set_linewidth(4) # This DOES NOT work. For the things that do not work, I tried both plt.show() and, plt.savefig('this_figure.pdf') Why do the things that I have indicated do not work? My second question is, if I want to have only the x-axis and y-axis line (i.e., get rid of the right edge and top edge of the axes frame) how do I do it? I am using the Matplotlib version that comes with Enthought Python Distribution 6.3. Thanks for your help.
ok :-) i find a solution .. maybe correct : in the __init__ i added : self.a = None then in "on_draw" : if self.a is not None: self.axes.collections.remove(self.a) self.a = self.axes.plot_surface(x, y, z, rstride=res, cstride=res, facecolors=colors) now the plot is refreshed ok :-) Il giorno 08/feb/2011, alle ore 10.35, Massimo Di Stefano ha scritto: > hello All > > have you never tried to embed a matplotlib 3d graph inside pyqt ? > > i'm tring to do it .. but i've problenms to refresh my plot. > > The 3d data are displayed ok inside a pyqt simple widget, > but if i try to redraw the image (re-call the on_draw function) ... > i have it overlay the previouse one. > > If i add "clear()" at begin of my "on_draw" action, > the plot is update correctly ... and each "on_draw" action give me the correct results ... > but then i'm no more able to move the 3d plot view (but i can only zoom in/out the scene) > the code i'm using is : http://paste.debian.net/106890 > at line 22 there is a "def erase(self):" function > if i connect it to the plot i have the image is correctly redraw .. but then i lost the 3d actions > can you give it a try ? > > seems thast the "clear()" action broke something ... thanks a lot for any help > to try it .. i've upload the .mat file (just few kbytes) > it is available at : > > http://www.geofemengineering.it/data/complexity_depth_grid1.mat > > > Thank you! > > Massimo. > > _______________________________________________ > PyQt mailing list Py...@ri... > http://www.riverbankcomputing.com/mailman/listinfo/pyqt
On 02/08/2011 06:42 AM, Benjamin Root wrote: > > > On Thu, Feb 3, 2011 at 9:19 AM, Gf B <gbs...@gm... > <mailto:gbs...@gm...>> wrote: > > In many places in the mpl docs there are tables of supported "kwarg > properties" containing at least one (usually many) entries where the > description given for the property is simply "unknown". What's up > with that??? How can the description of a property be unknown??? > > Any clarification for what this "unknown" notation means would be > appreciated. > > Thanks, > > G > > > > Most likely, it means that the person who wrote that portion of the > documentation was not familiar enough with the code to know for sure > exactly what that particular property does. We should aim to find and > fix all of these for the next release. > > Ben Root Ben, I think that it is coming from the document autogeneration mechanism related to the automatic handling of "set_*()" methods. If they lack an "ACCEPTS:" block, then "unknown" is substituted. An example is the obscure "agg_filter" property that everything inherits from artist. Possibly the solution is to change the autogeneration to ignore such methods when gathering "properties". Eric
On Thu, Feb 3, 2011 at 9:19 AM, Gf B <gbs...@gm...> wrote: > In many places in the mpl docs there are tables of supported "kwarg > properties" containing at least one (usually many) entries where the > description given for the property is simply "unknown". What's up with > that??? How can the description of a property be unknown??? > > Any clarification for what this "unknown" notation means would be > appreciated. > > Thanks, > > G > > > Most likely, it means that the person who wrote that portion of the documentation was not familiar enough with the code to know for sure exactly what that particular property does. We should aim to find and fix all of these for the next release. Ben Root
On Mon, Feb 7, 2011 at 5:02 AM, Paul Leopardi <pau...@ii...>wrote: > Hi all, > On Sun, 6 Feb 2011 03:54:48 PM Paul Leopardi wrote: > > I'm having trouble using multiple figures with mplot3d. > > I have appended an entire example script, below. > > The script incrementally plots 3 curves, one in each of 3 figure windows. > The > trouble is, once Figure 2 has finished plotting, the curve for Figure 1 > disappears and is replaced by the curve for Figure 2, with the axes for > Figure > 1; once Figure 3 has finished plotting, the curves for Figures 1 and 2 > disappear and are replaced by the curve for Figure 3, with the axes for > Figure > 1 and Figure 2, respectively. > > The original code was written with incremental plotting because the points > took a long time to calculate. Without incremental plotting, the figures > stayed blank for a long time. The script below is very similar to my > original > script, but does not depend on my GluCat library. > > Best, Paul > --- > > # -*- coding: utf-8 -*- > > # Imports needed for array calculation and plotting. > from numpy import array, floor, random, empty, cos, pi > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > > # Constants to control the plotting. > C=3 # Number of curves to plot. > P=1000 # Number of points overall. > R=2 # Scaling constant to use. > N=25 # Number of points in a curve segment. > M=P/N > > # Array of points. > x=empty((3,P)) > rgb=empty((3)) > > # Plot C curves. > for i in xrange(0,C): > # Initial point. > x0=random.randn(3) > > # Plot a curve using a random bivector in R_{5,0} > # with appropriate scaling. > w=random.randn(3) * 2*pi*R/P > > # Use a new figure for each curve. > fig=plt.figure(figsize=(15,12)) > # ax=Axes3D(fig) > ax = fig.gca(projection='3d') > plt.show() > > # Coordinate limits to determine the colour of the first curve segment. > minx=array([-x0[0],x0[1],-x0[2]]) > maxx=minx.copy() > > # Split the curve into M segments, each with an appropriate colour. > for j in range(0,M): > > # Find N points forming a curve segment by > # exponentiating w*k for k from j*N to (j+1)*N-1. > abot=j*N > atop=abot+N > for k in xrange(abot,atop): > for h in range(0,3): > x[h,k]=x0[h]+cos(w[h]*k) > > # Determine the colour of the curve segment. > amid=floor((abot+atop)/2) > for h in range(0,3): > sign=(-1)**(h+1) > minx[h]=min(minx[h],min(sign*x[h,abot:atop])) > maxx[h]=max(maxx[h],max(sign*x[h,abot:atop])) > rgb[h]=max(0.0,min((sign*x[h,amid]-minx[h])/(maxx[h]-minx[h]),1.0)) > > # Plot the curve segment using the chosen colour. > alow=(abot-1 if j>0 else abot) > ax.plot(x[0,alow:atop],x[1,alow:atop],x[2,alow:atop],c=rgb.tolist()) > plt.draw() > plt.show() > > Paul, As formatted, the code would not run. I presume that everything after "for j in range(0,M):" should be indented? When I did that and ran it in ipython, I could not reproduce your problem. What version of matplotlib are you running? Ben Root
On Tue, Feb 8, 2011 at 8:27 AM, Massimo Di Stefano <mas...@gm... > wrote: > Hi Benjamin, > > have you reied the mat file ? > > i treid using a simple python array in a 2d plot and i'm having the same > behavioure > the x,y coordinates are displayed ok when the mouse roll over the graph > but they are wrong in the axis labels. > > > Massimo, Perhaps you missed my previous email, so I will explain what I have found so far. First, in the 3d plots, the axes labels appear "wrong" because the offset label is missing. Offset labeling for 3d plots is a new feature that hasn't been released yet. However, if you do a pcolor() of the data on a 2D plot, you will see similar axes labels, but with the addition of the offset labels (the -7.025e1 and +4.259e1 in the attached plot). This means that all the labels should have that offset added to it to get the actual axis value. This is a way to save space. The reason for the offset labels to occur in the first place is that the range of axis values is so small, that it would take too much space to label each tick to the appropriate precision. Therefore, in order to display your plot sufficiently, you will need to take control of the tickers and the tick formatters. The API documentation can be found here: http://matplotlib.sourceforge.net/api/ticker_api.html There are a couple of examples of how to use tickers here: http://matplotlib.sourceforge.net/examples/pylab_examples/custom_ticker1.html http://matplotlib.sourceforge.net/examples/pylab_examples/centered_ticklabels.html There are others, but that's what I noticed from a quick look at http://matplotlib.sourceforge.net/examples/index.html I hope this helps! Ben Root
Le 2011年2月08日 09:14:22 -0500, Michael Droettboom <md...@st...> a écrit : > I have seen this problem when matplotlib wasn't fully rebuilt after > upgrading Numpy. I would assume, since you're installing from Gentoo > packages, that the package manager is smart enough to blitz the > matplotlib build products before rebuilding, but maybe not. (Python > distutils doesn't do proper dependency resolution.) Have you tried > removing the "build" directory from the matplotlib tree before > rebuilding? > > Mike > > On 02/08/2011 07:56 AM, Philippe Baucour wrote: > > hello, > > I get a segmentation fault with the pylab mode and I made several > > test to track down a bug but it's beyond my level and I still don't > > now if it's an ipython bug or matplotlib bug ... > > > > let's reproduce the bug !!!! > > ________________ > > ____/ try 1 Qt4Agg \_____ > > > > phil@Numokh ~ % ipython -pylab > > In [1]: plt.plot([4]) > > segmentation fault ipython -pylab > > > > By default I have Qt4Agg as backend but it doesn't work with all > > backends > > > > _______________ > > ____/ try 2 TkAgg \_____ > > > > phil@Numokh ~ % ipython -pylab > > > > In [1]: plt.rcParams['backend']='TkAgg' > > > > In [2]: plt.get_backend() > > Out[2]: 'TkAgg' > > > > In [3]: plt.plot([4]) > > segmentation fault ipython -pylab > > > > > > ____________________________ > > ____/ try 3 Qt4Agg + backtrace \_____ > > > > > > I made a backtrace with gdb > > phil@Numokh ~ % gdb python > > GNU gdb (Gentoo 7.2 p1) 7.2 > > Copyright (C) 2010 Free Software Foundation, Inc. > > License GPLv3+: GNU GPL version 3 or later > > <http://gnu.org/licenses/gpl.html> This is free software: you are > > free to change and redistribute it. There is NO WARRANTY, to the > > extent permitted by law. Type "show copying" and "show warranty" > > for details. This GDB was configured as "x86_64-pc-linux-gnu". > > For bug reporting instructions, please see: > > <http://bugs.gentoo.org/>... > > Reading symbols from /usr/bin/python...(no debugging symbols > > found)...done. (gdb) r /usr/bin/ipython -pylab > > Starting program: /usr/bin/python /usr/bin/ipython -pylab > > process 4149 is executing new program: /usr/bin/python2.7 > > [Thread debugging using libthread_db enabled] > > process 4149 is executing new program: /usr/bin/python2.7 > > [Thread debugging using libthread_db enabled] > > > > In [1]: plt.plot([4]) > > > > Program received signal SIGSEGV, Segmentation fault. > > 0x00007fffe82d5ce7 in __cxa_allocate_exception () > > from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 > > (gdb) bt > > #0 0x00007fffe82d5ce7 in __cxa_allocate_exception () > > from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 > > #1 0x00007fffe4d1f8a4 in py_to_agg_transformation_matrix(_object*, > > bool) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so > > #2 0x00007fffe4d2a42b in > > _path_module::update_path_extents(Py::Tuple const&) () > > from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #3 > > 0x00007fffe4d31108 in > > Py::ExtensionModule<_path_module>::invoke_method_varargs(void*, > > Py::Tuple const&) () > > from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #4 > > 0x00007fffe4d1acbd in method_varargs_call_handler () > > from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #5 > > 0x00007ffff7b09263 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 #6 0x00007ffff7b0ab50 in > > PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #7 > > 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 #8 0x00007ffff7b0ab50 in > > PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #9 > > 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 #10 0x00007ffff7b0ab50 in > > PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 > > ---Type<return> to continue, or q<return> to quit--- > > #11 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #12 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #13 0x00007ffff7a95f26 in ?? () from /usr/lib/libpython2.7.so.1.0 > > #14 0x00007ffff7a6d542 in PyObject_Call () > > from /usr/lib/libpython2.7.so.1.0 #15 0x00007ffff7b07a27 in > > PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 > > #16 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #17 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #18 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #19 0x00007ffff7b0ac62 in PyEval_EvalCode () > > from /usr/lib/libpython2.7.so.1.0 #20 0x00007ffff7b0a155 in > > PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 > > #21 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #22 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #23 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > ---Type<return> to continue, or q<return> to quit--- > > #24 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #25 0x00007ffff7b09464 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #26 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #27 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #28 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #29 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #30 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #31 0x00007ffff7b09337 in PyEval_EvalFrameEx () > > from /usr/lib/libpython2.7.so.1.0 > > #32 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > > from /usr/lib/libpython2.7.so.1.0 > > #33 0x00007ffff7b0ac62 in PyEval_EvalCode () > > from /usr/lib/libpython2.7.so.1.0 #34 0x00007ffff7b24e8c in ?? () > > from /usr/lib/libpython2.7.so.1.0 #35 0x00007ffff7b24f62 in > > PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0 > > #36 0x00007ffff7b2649c in PyRun_SimpleFileExFlags () > > ---Type<return> to continue, or q<return> to quit--- > > from /usr/lib/libpython2.7.so.1.0 > > #37 0x00007ffff7b37619 in Py_Main () > > from /usr/lib/libpython2.7.so.1.0 #38 0x00007ffff74cebbd in > > __libc_start_main () from /lib/libc.so.6 #39 0x00000000004008c9 in > > _start () > > > > ___________________________ > > ____/ try 4 Qt4Agg + q4thread \_____ > > > > With a ipython -pylab -q4thread > > everything seems to work except the autoindent feature > > > > > > ___________________ > > ____/ try 5 python -i \_____ > > > > with python -i no pb at all > > > > phil@Numokh ~ % python -i > > Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) > > [GCC 4.4.4] on linux2 > > Type "help", "copyright", "credits" or "license" for more > > information. > >>>> from pylab import * > >>>> plot([4]) > >>>> > > [<matplotlib.lines.Line2D object at 0x17c0ed0>] > > > >>>> show() > >>>> > >>>> > > _____________________ > > ____/ try 6 ipython git \_____ > > > > I tried with ipython from git > > phil@Numokh ipython % python ipython.py --pylab > > Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) > > Type "copyright", "credits" or "license" for more information. > > > > IPython 0.11.dev -- An enhanced Interactive Python. > > ? -> Introduction and overview of IPython's features. > > %quickref -> Quick reference. > > help -> Python's own help system. > > object? -> Details about 'object', use 'object??' for extra > > details. > > > > Welcome to pylab, a matplotlib-based Python environment [backend: > > Qt4Agg]. For more information, type 'help(pylab)'. > > > > In [1]: plot([4]) > > Out[1]: [<matplotlib.lines.Line2D object at 0x1f8e5d0>] > > > > but in this case I have issues with unicode pb ... > > In [2]: xlabel('température') > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > > position 12: ordinal not in range(128) > > > > > > _________ > > ____/ specs \_____ > > > > here is my python package : > > - dev-lang/python-2.7.1 > > - dev-python/numpy-1.5.1 > > - sci-libs/scipy-0.8.1 > > - dev-python/matplotlib-1.0.1 (with the USEFLAGS cairo examples > > excel gtk latex qt4 tk traits wxwidgets -doc -fltk) > > - dev-python/ipython-0.10.1 (with the USEFLAGS doc examples readline > > smp wxwidgets -emacs -gnuplot -test) > > > > > > At this point I'm lost !!! any idea > > > > Philippe Baucour > > > > > > ------------------------------------------------------------------------------ > > The ultimate all-in-one performance toolkit: Intel(R) Parallel > > Studio XE: Pinpoint memory and threading errors before they happen. > > Find and fix more than 250 security defects in the development > > cycle. Locate bottlenecks in serial and parallel code that limit > > performance. http://p.sf.net/sfu/intel-dev2devfeb > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > I removed the package emerge -C matplotlib and purge rm -rf /usr/lib64/python2.7/site-packages/matpl* rm -rf /etc/matplotlib/ rm -rf /usr/lib64/python2.7/site-packages/pylab* rm -rf /var/cache/tmp/portage reinstall matplotlib emerge -av matplotlib and still the same result !!!! -- Philippe Baucour
hello All have you never tried to embed a matplotlib 3d graph inside pyqt ? i'm tring to do it .. but i've problenms to refresh my plot. The 3d data are displayed ok inside a pyqt simple widget, but if i try to redraw the image (re-call the on_draw function) ... i have it overlay the previouse one. If i add "clear()" at begin of my "on_draw" action, the plot is update correctly ... and each "on_draw" action give me the correct results ... but then i'm no more able to move the 3d plot view (but i can only zoom in/out the scene) the code i'm using is : http://paste.debian.net/106890 at line 22 there is a "def erase(self):" function if i connect it to the plot i have the image is correctly redraw .. but then i lost the 3d actions can you give it a try ? seems thast the "clear()" action broke something ... thanks a lot for any help to try it .. i've upload the .mat file (just few kbytes) it is available at : http://www.geofemengineering.it/data/complexity_depth_grid1.mat Thank you! Massimo.
On Tue, Feb 8, 2011 at 7:50 AM, sanders <sa...@kn...> wrote: > I realize that I have not been clear enough. > > I have already created a legend instance in my_own_plot_function, for > example, a legend with one column by default: > > fig = plt.figure() > ax = fig.add_subplot(111) > my_own_plot_function(ax, data) # gives, for example, one column legend > by default > > So ax is an axes instance containing the legend. > > Incidentally, after inspecting the automatically created plots, I want a > particular figure to have a two column legend. I would like to do this > without adding an extra kwarg for the number of columns to > my_own_plot_function. It should be possible to do something like this: > > > legend = ax.get_legend() > *legend.set_ncol(2)* # something like this > > Once again, thanks for any help! > > Bram > > > > On 02/08/2011 12:35 PM, Thomas Lecocq wrote: > > Bram, > > > fig = plt.figure() > ax = fig.add_subplot(111) > plot1 = plot.plot(X,Y,label='1') > plot2 = plot.plot(X,Y,label='2') > ... > plotN = plot.plot(X,Y,label='N') > > legend = plt.legend(ncol=2) > > should work... > > so, for your "own_plot_function", you have to return the legend and set it > accordingly... > > Thomas > > > > ********************** > Thomas Lecocq > Geologist > Ph.D.Student (Seismology) > Royal Observatory of Belgium > ********************** > > > > ------------------------------ > Date: Tue, 8 Feb 2011 11:25:58 +0100 > From: sa...@kn... > To: mat...@li... > Subject: [Matplotlib-users] set ncol for legend > > Hi, > > I want to update the number of columns in my legend. How should I do that? > > I'm looking for something like: > > fig = plt.figure() > ax = fig.add_subplot(111) > my_own_plot_function(ax, data) # gives, for example, one column legend > by default > legend = ax.get_legend() > *legend.set_ncol(2)* # something like this > > > However, *ncol* is not in the legend.properties() list for properties to > be set through legend.set. > > > Thanks for any help, > Bram > > > Bram, As a point of style (and something I got myself caught in when I first started using matplotlib), it is not a good idea to create a single plotting function that does everything. In some of my original programs using matplotlib, I would create large functions that would plot not only a radar image, the county map, rivers and roads, but would also produce the colorbar and label the axes and put out a title for the plot. While this seemed like a good idea at the time because I was able to produce the one kind of image I wanted, this then became a problem when I needed plots that did not have a colorbar, or a title, or something else. So, while it is often nice to have a convenience function that can produce a particular style plot for you in a single call, it is still a good idea to break up that call into smaller methods that handle parts of the plot. So, when you need a plot that has a 2-column legend as opposed to one, you can still do the regular plot, but then call plt.legend(ncols=2), or anything else for that matter. I hope this helps! Ben Root
On Tue, Feb 8, 2011 at 6:53 AM, Curiouslearn <cur...@gm...> wrote: > Hello, > > Matplotlib is so cool. I wish I had spent time learning it earlier. > Better late than never. Thanks so much to all who have worked on > developing it. > > I had a question on histograms. Instead of the bars in case of > histograms, is there a way to get circle markers, where each marker > represents one observation in that bin. For example, if there are 5 > observations in a bin, then instead of a bar of height 5, I want 5 > circles stacked on top of each other. The same for other bins. Is > there a built-in command or property to do this? > > Thanks for your help. > > Not exactly, but you could use numpy's histogram() function to get the appropriate data and then plot the circles yourself using scatter(): hist, bins = np.histogram(data, bins=20) fig = plt.figure() ax = fig.gca() for left, right, cnt in zip(bins[:-1], bins[1:], hist) : x = [(left + right) / 2.0] * cnt y = np.arange(cnt) + 0.5 ax.scatter(x, y, s=np.pi) plt.show() You will have to adjust the value of s in the call to scatter to get the desired result. The units of s is points^2. Note that this wouldn't necessarially "stack" the circles, and zooming in/out of the figure will not change the size of the scatter points. To get more precise control of the circles, you could look into creating the circle patches yourself: http://matplotlib.sourceforge.net/api/artist_api.html?highlight=circle#matplotlib.patches.Circle I hope this gets you started! Ben Root
Hi Benjamin, have you reied the mat file ? i treid using a simple python array in a 2d plot and i'm having the same behavioure the x,y coordinates are displayed ok when the mouse roll over the graph but they are wrong in the axis labels. Il giorno 05/feb/2011, alle ore 09.23, Massimo Di Stefano ha scritto: > Hi Benjamin, > > The mat file is : > > <complexity_depth_grid1.mat> > > few kbyte :-) > > > thnaks! > > Massimo > > > > Il giorno 04/feb/2011, alle ore 19.41, Benjamin Root ha scritto: > >> On Friday, February 4, 2011, Massimo Di Stefano >> <mas...@gm...> wrote: >>> Hello All, >>> >>> >>> i'm plotting a 3d colored surface using a 4D array that comes from a .mat file >>> using this code : >>> >>> >>> import scipy.io as sio >>> import pylab as p >>> import mpl_toolkits.mplot3d.axes3d as p3 >>> >>> def loadmatfile(matfile): >>> matdata = sio.loadmat(matfile) >>> return matdata >>> >>> >>> def plot3dcolor(matfile): >>> data = loadmatfile(matfile) >>> x = data['X_depth'] >>> y = data['Y_depth'] >>> z = -data['Z_depth'] >>> c = data['Z_compl'] >>> fig=p.figure() >>> ax = p3.Axes3D(fig) >>> cmap = p.get_cmap('jet') >>> norm = p.Normalize(c.min(), c.max()) >>> colors = cmap(norm(c)) >>> ax.plot_surface(x, y, z, rstride=10, cstride=10, facecolors=colors) >>> ax.set_xlabel('X') >>> ax.set_ylabel('Y') >>> ax.set_zlabel('Z') >>> print x,y >>> p.show() >>> >>> >>> matfile = '/Users/epy/Desktop/complexity_depth_grid1.mat' >>> plot3dcolor(matfile) >>> >>> >>> >>> the results is nice : >>> >>> http://img831.imageshack.us/f/schermata20110204a14542.png/ >>> >>> >>> but as you can see, the mouse cursor shows me the x,y values (they are longitude and latitude) >>> but on the axis i have them starting from 0 ... >>> >>> how can i change the axis to display the lon-lat coordinates ? >>> >>> >>> thanks a lot for any help! >>> >>> Massimo. >>> >>> >> >> I suspect what is happening is that the axes label numbers are right, >> but is not showing the offset information. The display of offset data >> in a 3d plot is a new feature that exists only in the development >> branch. >> >> To confirm this, could you send me your may file (if it is small) so >> that I can try out your script? >> >> Ben Root >
I have seen this problem when matplotlib wasn't fully rebuilt after upgrading Numpy. I would assume, since you're installing from Gentoo packages, that the package manager is smart enough to blitz the matplotlib build products before rebuilding, but maybe not. (Python distutils doesn't do proper dependency resolution.) Have you tried removing the "build" directory from the matplotlib tree before rebuilding? Mike On 02/08/2011 07:56 AM, Philippe Baucour wrote: > hello, > I get a segmentation fault with the pylab mode and I made several > test to track down a bug but it's beyond my level and I still don't now > if it's an ipython bug or matplotlib bug ... > > let's reproduce the bug !!!! > ________________ > ____/ try 1 Qt4Agg \_____ > > phil@Numokh ~ % ipython -pylab > In [1]: plt.plot([4]) > segmentation fault ipython -pylab > > By default I have Qt4Agg as backend but it doesn't work with all > backends > > _______________ > ____/ try 2 TkAgg \_____ > > phil@Numokh ~ % ipython -pylab > > In [1]: plt.rcParams['backend']='TkAgg' > > In [2]: plt.get_backend() > Out[2]: 'TkAgg' > > In [3]: plt.plot([4]) > segmentation fault ipython -pylab > > > ____________________________ > ____/ try 3 Qt4Agg + backtrace \_____ > > > I made a backtrace with gdb > phil@Numokh ~ % gdb python > GNU gdb (Gentoo 7.2 p1) 7.2 > Copyright (C) 2010 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> This is free software: you are free > to change and redistribute it. There is NO WARRANTY, to the extent > permitted by law. Type "show copying" and "show warranty" for details. > This GDB was configured as "x86_64-pc-linux-gnu". > For bug reporting instructions, please see: > <http://bugs.gentoo.org/>... > Reading symbols from /usr/bin/python...(no debugging symbols > found)...done. (gdb) r /usr/bin/ipython -pylab > Starting program: /usr/bin/python /usr/bin/ipython -pylab > process 4149 is executing new program: /usr/bin/python2.7 > [Thread debugging using libthread_db enabled] > process 4149 is executing new program: /usr/bin/python2.7 > [Thread debugging using libthread_db enabled] > > In [1]: plt.plot([4]) > > Program received signal SIGSEGV, Segmentation fault. > 0x00007fffe82d5ce7 in __cxa_allocate_exception () > from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 > (gdb) bt > #0 0x00007fffe82d5ce7 in __cxa_allocate_exception () > from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 > #1 0x00007fffe4d1f8a4 in py_to_agg_transformation_matrix(_object*, > bool) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so > #2 0x00007fffe4d2a42b in _path_module::update_path_extents(Py::Tuple > const&) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so > #3 0x00007fffe4d31108 in > Py::ExtensionModule<_path_module>::invoke_method_varargs(void*, > Py::Tuple const&) () > from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #4 > 0x00007fffe4d1acbd in method_varargs_call_handler () > from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #5 > 0x00007ffff7b09263 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 #6 0x00007ffff7b0ab50 in > PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #7 > 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 #8 0x00007ffff7b0ab50 in > PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 > #9 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #10 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > ---Type<return> to continue, or q<return> to quit--- > #11 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #12 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #13 0x00007ffff7a95f26 in ?? () from /usr/lib/libpython2.7.so.1.0 > #14 0x00007ffff7a6d542 in PyObject_Call () > from /usr/lib/libpython2.7.so.1.0 #15 0x00007ffff7b07a27 in > PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 > #16 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #17 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #18 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #19 0x00007ffff7b0ac62 in PyEval_EvalCode () > from /usr/lib/libpython2.7.so.1.0 #20 0x00007ffff7b0a155 in > PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 > #21 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #22 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #23 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > ---Type<return> to continue, or q<return> to quit--- > #24 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #25 0x00007ffff7b09464 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #26 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #27 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #28 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #29 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #30 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #31 0x00007ffff7b09337 in PyEval_EvalFrameEx () > from /usr/lib/libpython2.7.so.1.0 > #32 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () > from /usr/lib/libpython2.7.so.1.0 > #33 0x00007ffff7b0ac62 in PyEval_EvalCode () > from /usr/lib/libpython2.7.so.1.0 #34 0x00007ffff7b24e8c in ?? () > from /usr/lib/libpython2.7.so.1.0 #35 0x00007ffff7b24f62 in > PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0 > #36 0x00007ffff7b2649c in PyRun_SimpleFileExFlags () > ---Type<return> to continue, or q<return> to quit--- > from /usr/lib/libpython2.7.so.1.0 > #37 0x00007ffff7b37619 in Py_Main () from /usr/lib/libpython2.7.so.1.0 > #38 0x00007ffff74cebbd in __libc_start_main () from /lib/libc.so.6 > #39 0x00000000004008c9 in _start () > > ___________________________ > ____/ try 4 Qt4Agg + q4thread \_____ > > With a ipython -pylab -q4thread > everything seems to work except the autoindent feature > > > ___________________ > ____/ try 5 python -i \_____ > > with python -i no pb at all > > phil@Numokh ~ % python -i > Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) > [GCC 4.4.4] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>> from pylab import * >>>> plot([4]) >>>> > [<matplotlib.lines.Line2D object at 0x17c0ed0>] > >>>> show() >>>> >>>> > _____________________ > ____/ try 6 ipython git \_____ > > I tried with ipython from git > phil@Numokh ipython % python ipython.py --pylab > Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) > Type "copyright", "credits" or "license" for more information. > > IPython 0.11.dev -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object', use 'object??' for extra details. > > Welcome to pylab, a matplotlib-based Python environment [backend: > Qt4Agg]. For more information, type 'help(pylab)'. > > In [1]: plot([4]) > Out[1]: [<matplotlib.lines.Line2D object at 0x1f8e5d0>] > > but in this case I have issues with unicode pb ... > In [2]: xlabel('température') > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 12: ordinal not in range(128) > > > _________ > ____/ specs \_____ > > here is my python package : > - dev-lang/python-2.7.1 > - dev-python/numpy-1.5.1 > - sci-libs/scipy-0.8.1 > - dev-python/matplotlib-1.0.1 (with the USEFLAGS cairo examples excel > gtk latex qt4 tk traits wxwidgets -doc -fltk) > - dev-python/ipython-0.10.1 (with the USEFLAGS doc examples readline > smp wxwidgets -emacs -gnuplot -test) > > > At this point I'm lost !!! any idea > > Philippe Baucour > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA
Bram, Although I don't quite see the point, I would simply suggest that you re-call ax.legend(ncol=2) , that would delete the previous and redraw a new one from matplotlib doc: When the legend command is called, a new legend instance is created and old ones are removed from the axes. Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Tue, 8 Feb 2011 14:50:00 +0100 From: sa...@kn... To: thl...@ms... CC: mat...@li... Subject: Re: [Matplotlib-users] set ncol for legend I realize that I have not been clear enough. I have already created a legend instance in my_own_plot_function, for example, a legend with one column by default: fig = plt.figure() ax = fig.add_subplot(111) my_own_plot_function(ax, data) # gives, for example, one column legend by default So ax is an axes instance containing the legend. Incidentally, after inspecting the automatically created plots, I want a particular figure to have a two column legend. I would like to do this without adding an extra kwarg for the number of columns to my_own_plot_function. It should be possible to do something like this: legend = ax.get_legend() legend.set_ncol(2) # something like this Once again, thanks for any help! Bram On 02/08/2011 12:35 PM, Thomas Lecocq wrote: Bram, fig = plt.figure() ax = fig.add_subplot(111) plot1 = plot.plot(X,Y,label='1') plot2 = plot.plot(X,Y,label='2') ... plotN = plot.plot(X,Y,label='N') legend = plt.legend(ncol=2) should work... so, for your "own_plot_function", you have to return the legend and set it accordingly... Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Tue, 8 Feb 2011 11:25:58 +0100 From: sa...@kn... To: mat...@li... Subject: [Matplotlib-users] set ncol for legend Hi, I want to update the number of columns in my legend. How should I do that? I'm looking for something like: fig = plt.figure() ax = fig.add_subplot(111) my_own_plot_function(ax, data) # gives, for example, one column legend by default legend = ax.get_legend() legend.set_ncol(2) # something like this However, ncol is not in the legend.properties() list for properties to be set through legend.set. Thanks for any help, Bram ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I realize that I have not been clear enough. I have already created a legend instance in my_own_plot_function, for example, a legend with one column by default: fig = plt.figure() ax = fig.add_subplot(111) my_own_plot_function(ax, data) # gives, for example, one column legend by default So ax is an axes instance containing the legend. Incidentally, after inspecting the automatically created plots, I want a particular figure to have a two column legend. I would like to do this without adding an extra kwarg for the number of columns to my_own_plot_function. It should be possible to do something like this: legend = ax.get_legend() /legend.set_ncol(2)/ # something like this Once again, thanks for any help! Bram On 02/08/2011 12:35 PM, Thomas Lecocq wrote: > Bram, > > > fig = plt.figure() > ax = fig.add_subplot(111) > plot1 = plot.plot(X,Y,label='1') > plot2 = plot.plot(X,Y,label='2') > ... > plotN = plot.plot(X,Y,label='N') > > legend = plt.legend(ncol=2) > > should work... > > so, for your "own_plot_function", you have to return the legend and > set it accordingly... > > Thomas > > > > ********************** > Thomas Lecocq > Geologist > Ph.D.Student (Seismology) > Royal Observatory of Belgium > ********************** > > > > ------------------------------------------------------------------------ > Date: Tue, 8 Feb 2011 11:25:58 +0100 > From: sa...@kn... > To: mat...@li... > Subject: [Matplotlib-users] set ncol for legend > > Hi, > > I want to update the number of columns in my legend. How should I do that? > > I'm looking for something like: > > fig = plt.figure() > ax = fig.add_subplot(111) > my_own_plot_function(ax, data) # gives, for example, one column > legend by default > legend = ax.get_legend() > /legend.set_ncol(2)/ # something like this > > > However, /ncol/ is not in the legend.properties() list for properties > to be set through legend.set. > > > Thanks for any help, > Bram > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio > XE: Pinpoint memory and threading errors before they happen. Find and > fix more than 250 security defects in the development cycle. Locate > bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ Matplotlib-users > mailing list Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
hello, I get a segmentation fault with the pylab mode and I made several test to track down a bug but it's beyond my level and I still don't now if it's an ipython bug or matplotlib bug ... let's reproduce the bug !!!! ________________ ____/ try 1 Qt4Agg \_____ phil@Numokh ~ % ipython -pylab In [1]: plt.plot([4]) segmentation fault ipython -pylab By default I have Qt4Agg as backend but it doesn't work with all backends _______________ ____/ try 2 TkAgg \_____ phil@Numokh ~ % ipython -pylab In [1]: plt.rcParams['backend']='TkAgg' In [2]: plt.get_backend() Out[2]: 'TkAgg' In [3]: plt.plot([4]) segmentation fault ipython -pylab ____________________________ ____/ try 3 Qt4Agg + backtrace \_____ I made a backtrace with gdb phil@Numokh ~ % gdb python GNU gdb (Gentoo 7.2 p1) 7.2 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /usr/bin/python...(no debugging symbols found)...done. (gdb) r /usr/bin/ipython -pylab Starting program: /usr/bin/python /usr/bin/ipython -pylab process 4149 is executing new program: /usr/bin/python2.7 [Thread debugging using libthread_db enabled] process 4149 is executing new program: /usr/bin/python2.7 [Thread debugging using libthread_db enabled] In [1]: plt.plot([4]) Program received signal SIGSEGV, Segmentation fault. 0x00007fffe82d5ce7 in __cxa_allocate_exception () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 (gdb) bt #0 0x00007fffe82d5ce7 in __cxa_allocate_exception () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6 #1 0x00007fffe4d1f8a4 in py_to_agg_transformation_matrix(_object*, bool) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #2 0x00007fffe4d2a42b in _path_module::update_path_extents(Py::Tuple const&) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #3 0x00007fffe4d31108 in Py::ExtensionModule<_path_module>::invoke_method_varargs(void*, Py::Tuple const&) () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #4 0x00007fffe4d1acbd in method_varargs_call_handler () from /usr/lib64/python2.7/site-packages/matplotlib/_path.so #5 0x00007ffff7b09263 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #6 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #7 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #8 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #9 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #10 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 ---Type <return> to continue, or q <return> to quit--- #11 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #12 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #13 0x00007ffff7a95f26 in ?? () from /usr/lib/libpython2.7.so.1.0 #14 0x00007ffff7a6d542 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0 #15 0x00007ffff7b07a27 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #16 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #17 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #18 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #19 0x00007ffff7b0ac62 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0 #20 0x00007ffff7b0a155 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #21 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #22 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #23 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 ---Type <return> to continue, or q <return> to quit--- #24 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #25 0x00007ffff7b09464 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #26 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #27 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #28 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #29 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #30 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #31 0x00007ffff7b09337 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0 #32 0x00007ffff7b0ab50 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0 #33 0x00007ffff7b0ac62 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0 #34 0x00007ffff7b24e8c in ?? () from /usr/lib/libpython2.7.so.1.0 #35 0x00007ffff7b24f62 in PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0 #36 0x00007ffff7b2649c in PyRun_SimpleFileExFlags () ---Type <return> to continue, or q <return> to quit--- from /usr/lib/libpython2.7.so.1.0 #37 0x00007ffff7b37619 in Py_Main () from /usr/lib/libpython2.7.so.1.0 #38 0x00007ffff74cebbd in __libc_start_main () from /lib/libc.so.6 #39 0x00000000004008c9 in _start () ___________________________ ____/ try 4 Qt4Agg + q4thread \_____ With a ipython -pylab -q4thread everything seems to work except the autoindent feature ___________________ ____/ try 5 python -i \_____ with python -i no pb at all phil@Numokh ~ % python -i Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pylab import * >>> plot([4]) [<matplotlib.lines.Line2D object at 0x17c0ed0>] >>> show() >>> _____________________ ____/ try 6 ipython git \_____ I tried with ipython from git phil@Numokh ipython % python ipython.py --pylab Python 2.7.1 (r271:86832, Feb 8 2011, 00:36:24) Type "copyright", "credits" or "license" for more information. IPython 0.11.dev -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg]. For more information, type 'help(pylab)'. In [1]: plot([4]) Out[1]: [<matplotlib.lines.Line2D object at 0x1f8e5d0>] but in this case I have issues with unicode pb ... In [2]: xlabel('température') UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 12: ordinal not in range(128) _________ ____/ specs \_____ here is my python package : - dev-lang/python-2.7.1 - dev-python/numpy-1.5.1 - sci-libs/scipy-0.8.1 - dev-python/matplotlib-1.0.1 (with the USEFLAGS cairo examples excel gtk latex qt4 tk traits wxwidgets -doc -fltk) - dev-python/ipython-0.10.1 (with the USEFLAGS doc examples readline smp wxwidgets -emacs -gnuplot -test) At this point I'm lost !!! any idea Philippe Baucour
Hello, Matplotlib is so cool. I wish I had spent time learning it earlier. Better late than never. Thanks so much to all who have worked on developing it. I had a question on histograms. Instead of the bars in case of histograms, is there a way to get circle markers, where each marker represents one observation in that bin. For example, if there are 5 observations in a bin, then instead of a bar of height 5, I want 5 circles stacked on top of each other. The same for other bins. Is there a built-in command or property to do this? Thanks for your help. On Tue, Feb 8, 2011 at 5:25 AM, sanders <sa...@kn...> wrote: > Hi, > > I want to update the number of columns in my legend. How should I do that? > > I'm looking for something like: > > fig = plt.figure() > ax = fig.add_subplot(111) > my_own_plot_function(ax, data) # gives, for example, one column legend by > default > legend = ax.get_legend() > legend.set_ncol(2) # something like this > > > However, ncol is not in the legend.properties() list for properties to be > set through legend.set. > > > Thanks for any help, > Bram > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
On 08.02.2011 13:01, Thomas Lecocq wrote: > > this could work ; > > img.set_extent([0,200,0,200]) Yes, this works. Thank you. So now I use ax.relim() ax.autoscale_view() img.set_extent([0, 200, 0, 200]) From my point of view it is strange, that one has to call img.set_extent explicitely which requires knowing the exact limits, although I want to :autoscale_. And I find the documentation of the 'extent' keyword for Axes.imshow() <http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.imshow> not clear in this respect: extent: [ None | scalars (left, right, bottom, top) ] Data limits for the axes. The default assigns zero-based row, column indices to the x, y centers of the pixels. ...whatever that exactly means :-) Christoph
Christoph, this could work ; img.set_extent([0,200,0,200]) HTH Thom ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** > Date: Tue, 8 Feb 2011 12:56:21 +0100 > From: us...@be... > To: thl...@ms... > CC: mat...@li... > Subject: Re: [Matplotlib-users] Autoscale AxesImage after using set_data() > > On 08.02.2011 10:23, Thomas Lecocq wrote: > > I would suggest calling requet_redraw() ... > > I could not find such a method, nor any similar one: request_redraw() or > *_redraw(). I grepped through the version 1.0.1 source code. > > Christoph
On 08.02.2011 10:23, Thomas Lecocq wrote: > I would suggest calling requet_redraw() ... I could not find such a method, nor any similar one: request_redraw() or *_redraw(). I grepped through the version 1.0.1 source code. Christoph
Bram, fig = plt.figure() ax = fig.add_subplot(111) plot1 = plot.plot(X,Y,label='1') plot2 = plot.plot(X,Y,label='2') ... plotN = plot.plot(X,Y,label='N') legend = plt.legend(ncol=2) should work... so, for your "own_plot_function", you have to return the legend and set it accordingly... Thomas ********************** Thomas Lecocq Geologist Ph.D.Student (Seismology) Royal Observatory of Belgium ********************** Date: Tue, 8 Feb 2011 11:25:58 +0100 From: sa...@kn... To: mat...@li... Subject: [Matplotlib-users] set ncol for legend Hi, I want to update the number of columns in my legend. How should I do that? I'm looking for something like: fig = plt.figure() ax = fig.add_subplot(111) my_own_plot_function(ax, data) # gives, for example, one column legend by default legend = ax.get_legend() legend.set_ncol(2) # something like this However, ncol is not in the legend.properties() list for properties to be set through legend.set. Thanks for any help, Bram ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi, I want to update the number of columns in my legend. How should I do that? I'm looking for something like: fig = plt.figure() ax = fig.add_subplot(111) my_own_plot_function(ax, data) # gives, for example, one column legend by default legend = ax.get_legend() /legend.set_ncol(2)/ # something like this However, /ncol/ is not in the legend.properties() list for properties to be set through legend.set. Thanks for any help, Bram
Hi, I'm trying to autoscale an AxesImage after having set new data with set_data(). I thought, the way to do it is to use Axes.relim() followed by Axes.autoscale_view(). Unfortunately, this does not work properly both with version 0.99.3 and 1.0.1. Consider the following example (adapted from the example <http://matplotlib.sourceforge.net/examples/animation/simple_anim_gtk.html>): import time import numpy as np import matplotlib matplotlib.use('GTKAgg') import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) x, y = np.mgrid[0:100, 0:100] img = ax.imshow(np.sin(0.05 * y)) def animate(): time.sleep(3) x, y = np.mgrid[0:200, 0:200] img.set_data(np.sin(0.05 * x)) # set_*lim works with v 0.99.3 ax.set_xlim(0, 200) ax.set_ylim(0, 200) # ax.relim() # ax.autoscale_view() fig.canvas.draw() return False import gobject gobject.idle_add(animate) plt.show() I want the plot to show the 200x200 image after the update, with the correct ticks showing. But what I get is the following: Using set_xlim() and set_ylim() works, but only for version 0.99.3. With version 1.0.1 the axes show a range of 200x200, and the new image data is used, but the new 200x200 image is shrunk to a 100x100 region. Using relim() and autoscale_view(), which is what I thought the correct way to do it, also does not work: With version 0.99.3 it does nothing, it does no autoscaling at all. With version 1.0.1 the new image is shown completely, but the axes ticks still show 0..100 instead of 0..200 Thanks for you help, Christoph
2011年2月8日 Benjamin Root <ben...@ou...> > > > Hmm, interesting observation. There is very little in mpl that limits your > ability to produce elements for plotting (which is probably why you were > getting shrugs from the mailing list...). However, ipython has various > "tricks" for caching mpl elements, and can sometimes be a bit excessive in > memory usage. This could lead to some issues. > > Now that you have identified ipython as the culprit, I would suggest taking > this to the ipython list and seeing if they can better identify the problem > for you. > > Ben Root > > Thanks, I was thinking of doing that myself. jorges