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
(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 L. <jos...@gm...> - 2012-03-18 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 <kl...@gm...> - 2012-03-18 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(pic-data)" 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 <ts...@gm...> - 2012-03-18 17:04:21
|
On Sun, Mar 18, 2012 at 11:08 AM, Benjamin Root <ben...@ou...> wrote: > > > On Sunday, March 18, 2012, Tony Yu <ts...@gm...> wrote: > > > > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote: > >> > >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...> > wrote: > >>> > >>> For inline ipython, you want to switch to the object-oriented 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=a-sum(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=a-sum(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 C. <dcd...@gm...> - 2012-03-18 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 = 1e-4
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,nsteps-1):
for z in range(0,nz-1):
for x in range(0,nx-1):
p[xs,zs,t] = s[t]
k = (c*dt/h)**2
p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] +
k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1])
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 R. <ben...@ou...> - 2012-03-18 15:08:29
|
On Sunday, March 18, 2012, Tony Yu <ts...@gm...> wrote: > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote: >> >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...> wrote: >>> >>> For inline ipython, you want to switch to the object-oriented 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=a-sum(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=a-sum(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 <ts...@gm...> - 2012-03-18 13:36:26
|
On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote:
> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...>wrote:
>
>>
>> For inline ipython, you want to switch to the object-oriented 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=a-sum(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=a-sum(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 <kl...@gm...> - 2012-03-18 13:14:31
|
On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...> wrote: > > For inline ipython, you want to switch to the object-oriented 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=a-sum(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 M. <am...@gm...> - 2012-03-18 12:51:17
|
On 18 March 2012 08:43, klo uo <kl...@gm...> wrote: > On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland <am...@gm...> 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 object-oriented 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=a-sum(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 Post-doctoral research fellow Neurobiology, University of Pittsburgh |
|
From: klo uo <kl...@gm...> - 2012-03-18 12:43:10
|
On Sun, Mar 18, 2012 at 1:07 PM, Angus McMorland <am...@gm...> 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: gsal <sal...@gm...> - 2012-03-18 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/matplotlib-picking-mouseevent.key%3DNone-tp33494747p33524689.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|