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}
(151) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 





1
(27) 
2
(15) 
3
(2) 
4
(4) 
5
(5) 
6
(9) 
7
(15) 
8
(24) 
9
(19) 
10
(7) 
11
(13) 
12
(26) 
13
(27) 
14
(17) 
15
(14) 
16
(12) 
17
(9) 
18
(12) 
19
(17) 
20
(19) 
21
(5) 
22
(5) 
23
(7) 
24
(4) 
25
(1) 
26
(9) 
27
(20) 
28
(5) 
29
(10) 
30
(12) 
31
(6) 
From: Joshua Lande <joshualande@gm...>  20120318 22:07:31

Hello. I have run into a strange error where matplotlib compresses images that are saved with the eps backend. Strangely, this compression seems to happen only for images saved with certain figure sizes. I created a very simple example which produces this behavior. import pylab as P import numpy as np np.random.seed(0) z=np.random.uniform(size=(22,22)) for figsize in [.5,.55]: F = P.figure(None,(figsize,figsize)) ax = F.add_subplot(111) im = ax.imshow(z, origin="lower", interpolation="nearest") ax.xaxis.set_ticks([]) ax.yaxis.set_ticks([]) P.savefig('test_%.2f.eps' % figsize) This code produces test_0.50.eps (attached) which shows ugly compression whereas test_0.55.eps (also attached) is uncompressed. Is there an easy way to disable this compression? For reference, I am using python version 2.7.2, matplotlib version 1.1.0, and for clarity I do not have a matplotlibrc file. Thanks for your help, Joshua 
From: klo uo <klonuo@gm...>  20120318 21:00:40

After parsing matplotlibrc, I browsed module where errorbars are defined (axes.py) and tried changing various variables without success. In bar() function (line 4628) there is "adjust_xlim = False" line which calls line 4768 if set True. So I set it True, to find it's buggy if x starts from 0 (most common start value). I didn't tried to copy this code block in errorbars because of that I browsed then axis.py and then  transforms.py  total mess. Retreat. Didn't even figured out why IPython inline mode pads left side x range in above example. Seems like IPython/core/pylabtools.py just calls "canvas.print_figure(picdata)" and passes image in qt terminal, but I can't reproduce same range if not in inline mode. Idea was to learn how IPython inline mode sets one part of this range correctly, then use it to make what I wanted So, I guess wrapping some function that would calculate smart view range, like Tony replied, is the way to go Thanks Tony 
From: Tony Yu <tsyu80@gm...>  20120318 17:04:21

On Sun, Mar 18, 2012 at 11:08 AM, Benjamin Root <ben.root@...> wrote: > > > On Sunday, March 18, 2012, Tony Yu <tsyu80@...> wrote: > > > > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <klonuo@...> wrote: > >> > >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <amcmorl@...> > wrote: > >>> > >>> For inline ipython, you want to switch to the objectoriented use of > >>> pylab. Something like this should work with xlim. > >>> > >>> a = [0.1, 0.2, 0.1] > >>> fig = plt.figure() > >>> ax = fig.add_subplot(111) > >>> ax.errorbar(arange(3), a, yerr=asum(a)/len(a), fmt='ro') > >>> ax.set_xlim(.5,2.5) > >>> ax.show() > >>> > >>> I'm not aware of automatic settings for padding, but with this > >>> set_xlim, it's easy enough to roll your own using the data limits. > >>> > >> > >> OK, thanks > >> > >> It's not very elegant (assuming pylab freedom) but I take it as only > way to correct clipping example (or differently put  to use custom range > for axis) > >> > > > > You can roll out a utility function that can automatically adjust the > limits with some specified padding (i.e. the function doesn't calculate the > marker size, but you can just give it sufficient padding). > > Here's an example where you specify a padding passed on the axes size > (0.05 is 5% of axes height/width): > > #~~~~ > > import numpy as np > > import matplotlib.pyplot as plt > > def pad_limits(pad_frac=0.05, ax=None): > > ax = ax if ax is not None else plt.gca() > > ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) > > ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) > > def _calc_limits(axis, frac): > > limits = axis.get_data_interval() > > mag = np.diff(limits)[0] > > pad = np.array([mag*frac, mag*frac]) > > return limits + pad > > a = np.array([0.1, 0.2, 0.1]) > > plt.errorbar(np.arange(3), a, yerr=asum(a)/len(a), fmt='ro') > > pad_limits() > > plt.show() > > #~~~~ > > I've put this is my personal mpl toolkit with the added ability of > handling log scales: > > https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 > > Best, > > Tony > > > > > Uhm, don't we already have padx and pady kwargs for various limits > functions? I know scatter and plot respects them. > > Ben Root Oh, I didn't know anything about them. ... and where exactly? I can't seem to find them (I looked in `ax.autoscale`, `ax.autoscale_view`, and `plt.xlim`). Tony (Sorry for the duplicate, Ben. I forgot to reply all) 
From: David Craig <dcdavemail@gm...>  20120318 15:12:04

Hi, I'm using surface_plot to view the results of solving the 2d wave equation. It works fine (code is below) except I would like to add a color bar and fix the limits on the vertical axis. When I add the color bar a new one is added in every iteration instead of overwriting the previous one, anyone know how I can prevent this? Also is it possible to specify a view point when plotting? Thanks D import matplotlib.pyplot as plt import numpy as np import pylab as py from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm pi = np.pi #Set up grid. fig = py.figure() ax = Axes3D(fig) nx = 50 nz = 50 X = np.arange(0, nx, 1) Y = np.arange(0, nz, 1) X, Y = np.meshgrid(X, Y) nsteps = 100 # Constants for equation. c = 4000 dt = 1e4 h = 1 # Set up source. xs = 0 zs = 0 #fig2 = py.figure() ts = np.arange(dt,nsteps*dt,dt) s = 0.5*np.sin(2*pi*100*ts) #py.plot(ts,s) #py.show() # Homogeneous pressure field. p = np.zeros([nx, nz, nsteps]) # Solve equation. for t in range(0,nsteps1): for z in range(0,nz1): for x in range(0,nx1): p[xs,zs,t] = s[t] k = (c*dt/h)**2 p[x,z,t] = 2*p[x,z,t1]  p[x,z,t2] + k*(p[x+1,z,t1]4*p[x,z,t1]+p[x1,z,t1]+p[x,z+1,t1]+p[x,z1,t1]) snap = p[:,:,t] surf = ax.plot_surface(X,Y,snap, rstride=1, cstride=1, cmap=cm.jet, linewidth=0) #fig.colorbar(surf, shrink=0.5, aspect=5) #py.draw() py.savefig('/home/davcra/Desktop/plots/2Dwave/'+str(t)) 
From: Benjamin Root <ben.root@ou...>  20120318 15:08:29

On Sunday, March 18, 2012, Tony Yu <tsyu80@...> wrote: > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <klonuo@...> wrote: >> >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <amcmorl@...> wrote: >>> >>> For inline ipython, you want to switch to the objectoriented use of >>> pylab. Something like this should work with xlim. >>> >>> a = [0.1, 0.2, 0.1] >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.errorbar(arange(3), a, yerr=asum(a)/len(a), fmt='ro') >>> ax.set_xlim(.5,2.5) >>> ax.show() >>> >>> I'm not aware of automatic settings for padding, but with this >>> set_xlim, it's easy enough to roll your own using the data limits. >>> >> >> OK, thanks >> >> It's not very elegant (assuming pylab freedom) but I take it as only way to correct clipping example (or differently put  to use custom range for axis) >> > > You can roll out a utility function that can automatically adjust the limits with some specified padding (i.e. the function doesn't calculate the marker size, but you can just give it sufficient padding). > Here's an example where you specify a padding passed on the axes size (0.05 is 5% of axes height/width): > #~~~~ > import numpy as np > import matplotlib.pyplot as plt > def pad_limits(pad_frac=0.05, ax=None): > ax = ax if ax is not None else plt.gca() > ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) > ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) > def _calc_limits(axis, frac): > limits = axis.get_data_interval() > mag = np.diff(limits)[0] > pad = np.array([mag*frac, mag*frac]) > return limits + pad > a = np.array([0.1, 0.2, 0.1]) > plt.errorbar(np.arange(3), a, yerr=asum(a)/len(a), fmt='ro') > pad_limits() > plt.show() > #~~~~ > I've put this is my personal mpl toolkit with the added ability of handling log scales: > https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 > Best, > Tony > Uhm, don't we already have padx and pady kwargs for various limits functions? I know scatter and plot respects them. Ben Root 
From: Tony Yu <tsyu80@gm...>  20120318 13:36:26

On Sun, Mar 18, 2012 at 9:14 AM, klo uo <klonuo@...> wrote: > On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <amcmorl@...>wrote: > >> >> For inline ipython, you want to switch to the objectoriented use of >> pylab. Something like this should work with xlim. >> >> a = [0.1, 0.2, 0.1] >> fig = plt.figure() >> ax = fig.add_subplot(111) >> ax.errorbar(arange(3), a, yerr=asum(a)/len(a), fmt='ro') >> ax.set_xlim(.5,2.5) >> ax.show() >> >> I'm not aware of automatic settings for padding, but with this >> set_xlim, it's easy enough to roll your own using the data limits. >> >> > OK, thanks > > It's not very elegant (assuming pylab freedom) but I take it as only way > to correct clipping example (or differently put  to use custom range for > axis) > > You can roll out a utility function that can automatically adjust the limits with some specified padding (i.e. the function doesn't calculate the marker size, but you can just give it sufficient padding). Here's an example where you specify a padding passed on the axes size (0.05 is 5% of axes height/width): #~~~~ import numpy as np import matplotlib.pyplot as plt def pad_limits(pad_frac=0.05, ax=None): ax = ax if ax is not None else plt.gca() ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) def _calc_limits(axis, frac): limits = axis.get_data_interval() mag = np.diff(limits)[0] pad = np.array([mag*frac, mag*frac]) return limits + pad a = np.array([0.1, 0.2, 0.1]) plt.errorbar(np.arange(3), a, yerr=asum(a)/len(a), fmt='ro') pad_limits() plt.show() #~~~~ I've put this is my personal mpl toolkit with the added ability of handling log scales: https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 Best, Tony 
From: klo uo <klonuo@gm...>  20120318 13:14:31

On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <amcmorl@...> wrote: > > For inline ipython, you want to switch to the objectoriented use of > pylab. Something like this should work with xlim. > > a = [0.1, 0.2, 0.1] > fig = plt.figure() > ax = fig.add_subplot(111) > ax.errorbar(arange(3), a, yerr=asum(a)/len(a), fmt='ro') > ax.set_xlim(.5,2.5) > ax.show() > > I'm not aware of automatic settings for padding, but with this > set_xlim, it's easy enough to roll your own using the data limits. > > OK, thanks It's not very elegant (assuming pylab freedom) but I take it as only way to correct clipping example (or differently put  to use custom range for axis) 
From: Angus McMorland <amcmorl@gm...>  20120318 12:51:17

On 18 March 2012 08:43, klo uo <klonuo@...> wrote: > On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland <amcmorl@...> wrote: >> >> >> >> The xlim command can be used to set the x limits. For example: >> >> xlim(.5, 2.5) >> >> will prevent the points lying on the axis boundaries for your case. >> > > Thanks Angus, > > that worked with ease for separate MPL window, but not inline in IPython. That's because the first command draws the plot, and when inlined, further changes within the cell aren't propagated to the plot. > I guess there is no setting, that will allow setting MPL to automatically > adjust default plot window  add padding if bars (which can also be lines or > points as in example) are drawn on axes; trim window if if there is no data > to plot instead trimming based on grid range; and similar intuitive > expectation For inline ipython, you want to switch to the objectoriented use of pylab. Something like this should work with xlim. a = [0.1, 0.2, 0.1] fig = plt.figure() ax = fig.add_subplot(111) ax.errorbar(arange(3), a, yerr=asum(a)/len(a), fmt='ro') ax.set_xlim(.5,2.5) ax.show() I'm not aware of automatic settings for padding, but with this set_xlim, it's easy enough to roll your own using the data limits. Angus  AJC McMorland Postdoctoral research fellow Neurobiology, University of Pittsburgh 
From: klo uo <klonuo@gm...>  20120318 12:43:10

On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland <amcmorl@...> wrote: > > > The xlim command can be used to set the x limits. For example: > > xlim(.5, 2.5) > > will prevent the points lying on the axis boundaries for your case. > > Thanks Angus, that worked with ease for separate MPL window, but not inline in IPython. I guess there is no setting, that will allow setting MPL to automatically adjust default plot window  add padding if bars (which can also be lines or points as in example) are drawn on axes; trim window if if there is no data to plot instead trimming based on grid range; and similar intuitive expectation 
From: Angus McMorland <amcmorl@gm...>  20120318 12:07:29

From: klo uo <klonuo@gm...>  20120318 08:40:05

From: gsal <salgerman@gm...>  20120318 00:22:00

o.k., here is some minimal code...what am I doing wrong? Within the picker (def pkr)...I would like to be able to see the mouseevent.key value, but this is always None...is this the expected behaviour? Is mouseevent.key not set at this point? Anye hints would be greatly appreciated. [code] import sys import matplotlib.patches as mpathes import matplotlib.text as mtext import matplotlib.lines as mlines from matplotlib.path import Path from PyQt4.QtGui import * from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar class AAA(): pass class Qt4MplCanvas(FigureCanvas): """class to represent the FigureCanvas widget""" def __init__(self, parent, data): self.data = data self.fig = Figure() self.axes = self.fig.add_subplot(111) self.axes.set_aspect(1) self.compute_initial_figure() FigureCanvas.__init__(self, self.fig) self.setParent(parent) FigureCanvas.setSizePolicy(self,QSizePolicy.Expanding,QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) class MagnedMplCanvas(Qt4MplCanvas): """Simple canvas with a sine plot.""" def pkr(self, art, mouseevent): key = mouseevent.key button = mouseevent.button print key print button print art return False, dict() def compute_initial_figure(self): GR = [1.0, 2.0, 3.0, 4.0] self.axes.hlines(GR,0.0,4.0,picker=self.pkr) class ApplicationWindow(QMainWindow): """Example main window""" def __init__(self): QMainWindow.__init__(self) self.setWindowTitle("Matplotlib Figure in a Qt4 Window WithNavigationToolbar") self.main_widget = QWidget(self) vbl = QVBoxLayout(self.main_widget) self.data=AAA() self.data.nnn=0 qmc = MagnedMplCanvas(self.main_widget, self.data) ntb = NavigationToolbar(qmc, self.main_widget) vbl.addWidget(qmc) vbl.addWidget(ntb) self.main_widget.setFocus() self.setCentralWidget(self.main_widget) qApp = QApplication(sys.argv) aw = ApplicationWindow() aw.show() sys.exit(qApp.exec_()) [/code]  View this message in context: http://old.nabble.com/matplotlibpickingmouseevent.key%3DNonetp33494747p33524689.html Sent from the matplotlib  users mailing list archive at Nabble.com. 