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
(12) |
2
(14) |
3
(13) |
4
(6) |
|
5
(6) |
6
(21) |
7
(29) |
8
(30) |
9
(13) |
10
(4) |
11
(4) |
|
12
(4) |
13
(15) |
14
(22) |
15
(23) |
16
(23) |
17
(9) |
18
(23) |
|
19
(12) |
20
(10) |
21
(26) |
22
(5) |
23
(32) |
24
(5) |
25
(7) |
|
26
(4) |
27
(3) |
28
(19) |
29
(20) |
|
|
|
|
From: Michael R. <raw...@ya...> - 2012-02-18 19:27:11
|
________________________________ From: Eric Firing <ef...@ha...> To: mat...@li... Sent: Saturday, February 18, 2012 12:26 PM Subject: Re: [Matplotlib-users] installed python-scipy causing errors with numpy On 02/18/2012 07:17 AM, Michael Rawlins wrote: > > A couple weeks ago I installed version 1.2 from sources, as described here: > > http://matplotlib.sourceforge.net/users/installing.html > > I'm running Ubuntu 10.04 LTS. Everything was working fine. Looks like > numpy version 1.3 in place. A few minutes ago I installed python-scipy > from the Ubuntu Synaptic package manager. Getting this any time I run a > program: > > >python colorbar_testing.py > Traceback (most recent call last): > File "colorbar_testing.py", line 5, in <module> > from matplotlib import pyplot, mpl > File "/usr/local/lib/python2.6/dist-packages/matplotlib/__init__.py", > line 173, in <module> > __version__numpy__, numpy.__version__)) > ImportError: numpy 1.4 or later is required; you have 1.3.0 > > > Version control with python, matplotlib, numpy, etc problematic when > compiled from source? Shall I reinstall everything again, including > python-scipy? What order? Thanks. You need to remove your numpy and scipy packages and install both of these from source (just use the most recent releases), and then rebuild matplotlib. Numpy has to be installed before building either scipy or mpl, but mpl and scipy are independent of each other so either can be built once a suitable numpy is there. Eric I did not mention that I already had python 2.6 installed when I |
|
From: Tony Yu <ts...@gm...> - 2012-02-18 19:22:42
|
On Tue, Feb 14, 2012 at 12:49 PM, Olе Streicher <ole...@gm...>wrote:
> Jerzy Karczmarczuk
> <jer...@un...> writes:
> > Could you provide a /working/ example with the geometry you really want?
> > I believe I thought more or less about it as Tony Yu did. If it is
> > wrong, be more precise, please.
>
> I have a data set that looks like this:
>
> mydata = numpy.copy([
>
> # lambda, data
>
> # First data row
> [[5002., 0.5],
> [5200., 0.34],
> [5251., -1.2],
> # ...
> [8997., 2.4]],
>
> # second data row
> [[5002., 0.72],
> [5251., 0.9],
> # ...
> [8997., 0.1]],
>
> # other data rows to follow
> # ...
> ])
>
> where I want to put the first column (lambda) on the Y axis, which each
> data row as one colorbar (like in your code), and the data as the color
> of that data point -- interpolated vertically.
>
> Best regards
>
> Ole
>
>
OK, I see now.
Unfortunately, this makes it quite a bit more complex, but it's still
doable. Part of the complexity arises because of (what I believe to be) a
quirk in NonUniformImage: You can pass an extent argument, but this only
rescales the data---it doesn't clip the data. You have to manually clip the
borders of each bar.
Here's an example:
#---
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage
width = 0.5
height = 10
ax = plt.gca()
for x0 in np.arange(11):
y = np.sort(np.random.uniform(high=height, size=10))
z = np.random.random(size=(10, 1))
# Note NonUniformImage fails with single column; double up data
z = np.repeat(z, 2, axis=1)
x = [x0, x0]
extent = (x0-width/2., x0+width/2, y[0], y[-1])
im = NonUniformImage(ax, interpolation='bilinear', extent=extent)
im.set_data(x, y, z)
# clip image
x_left = extent[0]
xm = [x_left, x_left + width, x_left + width, x_left]
ym = [0, 0, height, height]
mask, = ax.fill(xm, ym, facecolor='none', edgecolor='none')
im.set_clip_path(mask)
ax.images.append(im)
ax.set_xlim(-width, x0+width)
plt.show()
#---
HTH,
-Tony
|
|
From: Eric F. <ef...@ha...> - 2012-02-18 17:26:17
|
On 02/18/2012 07:17 AM, Michael Rawlins wrote: > > A couple weeks ago I installed version 1.2 from sources, as described here: > > http://matplotlib.sourceforge.net/users/installing.html > > I'm running Ubuntu 10.04 LTS. Everything was working fine. Looks like > numpy version 1.3 in place. A few minutes ago I installed python-scipy > from the Ubuntu Synaptic package manager. Getting this any time I run a > program: > > >python colorbar_testing.py > Traceback (most recent call last): > File "colorbar_testing.py", line 5, in <module> > from matplotlib import pyplot, mpl > File "/usr/local/lib/python2.6/dist-packages/matplotlib/__init__.py", > line 173, in <module> > __version__numpy__, numpy.__version__)) > ImportError: numpy 1.4 or later is required; you have 1.3.0 > > > Version control with python, matplotlib, numpy, etc problematic when > compiled from source? Shall I reinstall everything again, including > python-scipy? What order? Thanks. You need to remove your numpy and scipy packages and install both of these from source (just use the most recent releases), and then rebuild matplotlib. Numpy has to be installed before building either scipy or mpl, but mpl and scipy are independent of each other so either can be built once a suitable numpy is there. Eric |
|
From: Michael R. <raw...@ya...> - 2012-02-18 17:17:11
|
A couple weeks ago I installed version 1.2 from sources, as described here: http://matplotlib.sourceforge.net/users/installing.html I'm running Ubuntu 10.04 LTS. Everything was working fine. Looks like numpy version 1.3 in place. A few minutes ago I installed python-scipy from the Ubuntu Synaptic package manager. Getting this any time I run a program: >python colorbar_testing.py Traceback (most recent call last): File "colorbar_testing.py", line 5, in <module> from matplotlib import pyplot, mpl File "/usr/local/lib/python2.6/dist-packages/matplotlib/__init__.py", line 173, in <module> __version__numpy__, numpy.__version__)) ImportError: numpy 1.4 or later is required; you have 1.3.0 Version control with python, matplotlib, numpy, etc problematic when compiled from source? Shall I reinstall everything again, including python-scipy? What order? Thanks. |
|
From: Benjamin R. <ben...@ou...> - 2012-02-18 16:00:20
|
On Saturday, February 18, 2012, Jerzy Karczmarczuk wrote: > Saurav Pathak : > > I am trying to generate key press events in matplotlib (imshow) embedded > > in pyqt4, but I am getting nowhere. > Yes, another victim... > > My small animation test program > > http://users.info.unicaen.fr/~karczma/TEACH/Test/isingVZ.py > > run under Windows XP / Python 2.7, shows the following > > 1. For WX and GTK the timing doesn't work properly. > 2. For QT4 key event processing doesn't work > > Only Ye Olde Tkinter backend seems to behave decently. > Well, the animation in matplotlib - as I have already mentioned some > week ago - is really imperfect, and should be re-analysed (in particular > not giving to the user the access to the event loop is a severe > handycap). Now I see that events in general need to be looked into in > details. I feel sorry that I have no time to dig more thoroughly. > (Of course, I may be doing some rubbish..., then mes plus plates excuses). > > Jerzy Karczmarczuk > > > Please file bug reports on these issues, as they are critical. Ben Root |
|
From: Ray O. <RO...@an...> - 2012-02-18 13:11:32
|
You're exactly right. That does fix it. Unfortunately, it means I have to refactor some of my code because the Pyside slot doesn't currently have access to the original data, but that's not a huge deal. Thanks, Ray On Feb 18, 2012, at 4:35 AM, Jerzy Karczmarczuk wrote: > Ray Osborn: >> >> OK - it turns out I can reproduce it in a simple ipython session using ipython --pylab=qt. >> >> I set up an image plot as follows: >> >> import numpy as np >> import matplotlib.pyplot as plt >> from matplotlib.image import NonUniformImage >> >> x=y=np.linspace(0,2*np.pi,101) >> X,Y=np.meshgrid(x,y) >> z=sin(X)*sin(Y) >> >> ax=plt.gca() >> extent = (x[0],x[-1],y[0],y[-1]) >> im = NonUniformImage(ax, extent=extent, origin=None) >> im.set_data(x,y,z) >> >> ax.images.append(im) >> ax.set_xlim(x[0],x[-1]) >> ax.set_ylim(y[0],y[-1]) >> >> plt.colorbar(im) >> >> plt.gcf().canvas.draw() >> >> >> After that, I try to change the color scale using: >> >> im.set_clim(0,0.5) >> plt.gcf().canvas.draw() >> >> The colorbar changes scale, but the plot is untouched. Is that the expected behavior? >> >> Thanks, >> Ray > > Try, perhaps, after set_clim, to reinstall the data: > > im.set_data(x,y,z) > plt.gcf().canvas.draw() > > = > > Jerzy Karczmarczuk > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Ray Osborn Materials Science Division Argonne National Laboratory Argonne, IL 60439, USA Phone: +1 (630) 252-9011 Email: RO...@an... |
|
From: Jerzy K. <jer...@un...> - 2012-02-18 12:12:42
|
Saurav Pathak : > I am trying to generate key press events in matplotlib (imshow) embedded > in pyqt4, but I am getting nowhere. Yes, another victim... My small animation test program http://users.info.unicaen.fr/~karczma/TEACH/Test/isingVZ.py run under Windows XP / Python 2.7, shows the following 1. For WX and GTK the timing doesn't work properly. 2. For QT4 key event processing doesn't work Only Ye Olde Tkinter backend seems to behave decently. Well, the animation in matplotlib - as I have already mentioned some week ago - is really imperfect, and should be re-analysed (in particular not giving to the user the access to the event loop is a severe handycap). Now I see that events in general need to be looked into in details. I feel sorry that I have no time to dig more thoroughly. (Of course, I may be doing some rubbish..., then mes plus plates excuses). Jerzy Karczmarczuk |
|
From: Saurav P. <sa...@sa...> - 2012-02-18 11:00:16
|
Hi,
I am trying to generate key press events in matplotlib (imshow) embedded
in pyqt4, but I am getting nowhere. My code is given below. Even though
the imshow seems to work OK, there is no response when I press keys.
I am using an mpl_connect
self.canvas.mpl_connect('key_press_event', self.on_key_press)
and define a function on_key_press:
def on_key_press(self, event):
print 'you pressed', event.key
The complete code is given below. I hope someone will show me where I
am going wrong. I am running this on Ubuntu, with python 2.6.x and
matplotlib 1.1.0.
Thanks for your help!
Saurav
==code begins==
import sys
import numpy as np
from matplotlib.figure import Figure
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg
as NavigationToolbar
class AppForm(QMainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.data = self.get_data2()
self.create_main_frame()
self.on_draw()
def create_main_frame(self):
self.main_frame = QWidget()
self.fig = Figure((5.0, 4.0), dpi=100)
self.canvas = FigureCanvas(self.fig)
self.canvas.setParent(self.main_frame)
self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame)
self.canvas.mpl_connect('key_press_event', self.on_key_press)
vbox = QVBoxLayout()
vbox.addWidget(self.canvas) # the matplotlib canvas
vbox.addWidget(self.mpl_toolbar)
self.main_frame.setLayout(vbox)
self.setCentralWidget(self.main_frame)
def get_data2(self):
return np.arange(20).reshape([4,5]).copy()
def on_draw(self):
self.fig.clear()
self.axes = self.fig.add_subplot(111)
#self.axes.plot(self.x, self.y, 'ro')
self.axes.imshow(self.data, interpolation='nearest')
self.canvas.draw()
def on_key_press(self, event):
print 'you pressed', event.key
def main():
app = QApplication(sys.argv)
form = AppForm()
form.show()
app.exec_()
if __name__ == "__main__":
main()
==code ends==
|
|
From: Jerzy K. <jer...@un...> - 2012-02-18 10:36:07
|
Ray Osborn: > OK - it turns out I can reproduce it in a simple ipython session using > ipython --pylab=qt. > > I set up an image plot as follows: > > import numpy as np > import matplotlib.pyplot as plt > from matplotlib.image import NonUniformImage > > x=y=np.linspace(0,2*np.pi,101) > X,Y=np.meshgrid(x,y) > z=sin(X)*sin(Y) > > ax=plt.gca() > extent = (x[0],x[-1],y[0],y[-1]) > im = NonUniformImage(ax, extent=extent, origin=None) > im.set_data(x,y,z) > > ax.images.append(im) > ax.set_xlim(x[0],x[-1]) > ax.set_ylim(y[0],y[-1]) > > plt.colorbar(im) > > plt.gcf().canvas.draw() > > > After that, I try to change the color scale using: > > im.set_clim(0,0.5) > plt.gcf().canvas.draw() > > The colorbar changes scale, but the plot is untouched. Is that the > expected behavior? > > Thanks, > Ray Try, perhaps, after set_clim, to reinstall the data: im.set_data(x,y,z) plt.gcf().canvas.draw() = Jerzy Karczmarczuk |
|
From: Mic <mic...@gm...> - 2012-02-18 07:39:39
|
would be great! Maybe you could submit it to matplotlib's github. On Sat, Dec 31, 2011 at 2:23 AM, fdu...@gm... <fdu...@gm...>wrote: > Dear all, > > I couldn't find a function to plot venn diagram with python, so I > written one for my daily use (with a lot inspirations from the internet > and R). Hope it could be of any help to someone else, so I put it on > github. The path to it is > https://github.com/icetime/pyinfor/blob/master/venn.py . > > I'm wondering if there is any chance that the function be included in > matplotlib. I think matplotlib need a function for venn diagram. > > Also, could someone kindly help to review the code, so I can make it > better? > > Any suggestions or comments will be greatly appreciated. Thanks a lot. > > Best Regards, > Jianfeng > > > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Ray O. <ro...@an...> - 2012-02-18 04:02:16
|
OK - it turns out I can reproduce it in a simple ipython session using ipython --pylab=qt. I set up an image plot as follows: import numpy as np import matplotlib.pyplot as plt from matplotlib.image import NonUniformImage x=y=np.linspace(0,2*np.pi,101) X,Y=np.meshgrid(x,y) z=sin(X)*sin(Y) ax=plt.gca() extent = (x[0],x[-1],y[0],y[-1]) im = NonUniformImage(ax, extent=extent, origin=None) im.set_data(x,y,z) ax.images.append(im) ax.set_xlim(x[0],x[-1]) ax.set_ylim(y[0],y[-1]) plt.colorbar(im) plt.gcf().canvas.draw() After that, I try to change the color scale using: im.set_clim(0,0.5) plt.gcf().canvas.draw() The colorbar changes scale, but the plot is untouched. Is that the expected behavior? Thanks, Ray On Feb 17, 2012, at 9:05 PM, Benjamin Root wrote: > > > On Friday, February 17, 2012, Ray Osborn wrote: > I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a slider to adjust the color scale of a 2D plot made using NonUnitformImage. I am connecting the slider value to im.set_clim([vmin,vmax]). I have got my axis sliders to work, but the intensity slider only adjusts the colorbar without touching the image itself. Is there some trick to making this work with NonUniformImage? > > My plotting routine has the following code: > > ax = plt.gca() > im = NonUniformImage(ax, extent=extent, origin=None, **opts) > im.set_data(x,y,z) > ax.images.append(im) > self.imgplot = im > plt.colorbar(im) > > while the Pyside slot has: > > zhi = self.zmin + (self.ztab.maxslider.value() * range / 100) > im = self.imgplot > im.set_clim([zlo,zhi]) > > The slider dynamically adjusts the colorbar beautifully, but leaves the color plot untouched. Any suggestions welcome. > > Thanks in advance, > Ray > > Without a more complete example, it is hard to say. Can you make a small stand-alone example that we can try out? > > Ben Root > -- Ray Osborn Materials Science Division Argonne National Laboratory Argonne, IL 60439, USA Phone: +1 (630) 252-9011 Email: RO...@an... |
|
From: Jerzy K. <jer...@un...> - 2012-02-18 03:40:29
|
Andrea Gavana continues to struggle with his parallel lines:
> I managed to get *almost* there, but there still is a small glitch. I
> attach a self-evident sample, which generates data very similar to the
> real ones I have and shows the two "parallel" curves to the main one.
>
> You will notice that the "parallel" curves look parallel almost all
> the time, except in a few areas (I have annotated the plot for
> reference). I can't see the reason for this difference, but it is
> obvious I am missing something.
Yes. I am afraid it it not a small glitch, but a serious bug.
Actually, there are still two things. The second one is the purely
visual scaling based on the aspect of your figure on the screen, and I
will not discuss it now, you can get into your axes, pick the frame, dig
out the extent, extract the "points" of the rectangle, and do some other
dirty stuff, which will get wrong when you touch your figure... So, here
- I believe - is better to adjust things by hand.
But the REAL STUFF is elsewhere. You added a vertical scaling, as I
suggested, based on the aspect ratio of your data. You rescaled the
offsets. I believe that I might have suggested that, if this is the
case, I am sorry, it was a mental abbreviation...
Rescaling JUST the offsets, and keeping the function itself in a
"distorted frame" is sinful. Here you are another attempt. With (or
without) your permission, I reconstruct the offset without your
!*##$%*!! arctan... This is my equivalent of your "get-normal points" :
def adp(x): # This computes the derivative without splines or other
heavy artillery.
xa=numpy.concatenate(([2*x[0]-x[1]],x,[2*x[-1]-x[-2]]))
return xa[2:]-xa[:-2]
def para(x,y,dst,ax): # ax is the current axes set, dst is the offset.
scal=ax.get_data_ratio() # Don't send human make the work of a machine!
y0=y/scal # Warp the original
dx=adp(x); dy=adp(y0)
ds=dst/numpy.sqrt(dx*dx+dy*dy)
x1=x-ds*dy; x2=x+ds*dy
y1=y0+ds*dx; y2=y0-ds*dx
return (x1,y1*scal,x2,y2*scal)
As you see, the function got "undistorted", the offsets calculated, and
Mister Sulu, get us back into the real space !
Now, within your main() :
...
fig = plt.figure(figsize=(fw,fh)) # whatever...
ax = plt.subplot(111)
ax.plot(x, y, color='orange', ls='-', lw=3, label='data', zorder=30) #
It should be done first
...
ax.set_xlim(xlims)
ax.set_ylim(ylims)
ax.grid()
ax.invert_yaxis()
...
xh,yh,xl,yl = para(x,y,distance,ax) # Here you are.
ax.plot(xl, yl, 'g-',zorder=30)
ax.plot(xh, yh, 'b-',zorder=30)
=================
OK, let's get back to the second problem. Here you have the additional
scaling.
def vscal(ax):
gf=ax.get_frame()
ex=gf.get_extents()
po=ex.get_points() # What a lousy way ! Probably Ben R. knows
some more direct access.
w,h = po[1,0]-po[0,0], po[1,1]-po[0,1]
return h/w
And within para(), the first line becomes:
scal=ax.get_data_ratio()/vscal(ax)
However, since my insomnia doesn't necessarily mean that I am fully
conscious, check everything twice. Add your
fig.subplots_adjust, and recheck.
Good luck.
Jerzy K.
|
|
From: Benjamin R. <ben...@ou...> - 2012-02-18 03:05:31
|
On Friday, February 17, 2012, Ray Osborn wrote: > I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a > slider to adjust the color scale of a 2D plot made using NonUnitformImage. > I am connecting the slider value to im.set_clim([vmin,vmax]). I have got my > axis sliders to work, but the intensity slider only adjusts the colorbar > without touching the image itself. Is there some trick to making this work > with NonUniformImage? > > My plotting routine has the following code: > > ax = plt.gca() > im = NonUniformImage(ax, extent=extent, origin=None, **opts) > im.set_data(x,y,z) > ax.images.append(im) > self.imgplot = im > plt.colorbar(im) > > while the Pyside slot has: > > zhi = self.zmin + (self.ztab.maxslider.value() * range / 100) > im = self.imgplot > im.set_clim([zlo,zhi]) > > The slider dynamically adjusts the colorbar beautifully, but leaves the > color plot untouched. Any suggestions welcome. > > Thanks in advance, > Ray Without a more complete example, it is hard to say. Can you make a small stand-alone example that we can try out? Ben Root |
|
From: Ray O. <ro...@an...> - 2012-02-18 01:55:37
|
I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a slider to adjust the color scale of a 2D plot made using NonUnitformImage. I am connecting the slider value to im.set_clim([vmin,vmax]). I have got my axis sliders to work, but the intensity slider only adjusts the colorbar without touching the image itself. Is there some trick to making this work with NonUniformImage?
My plotting routine has the following code:
ax = plt.gca()
im = NonUniformImage(ax, extent=extent, origin=None, **opts)
im.set_data(x,y,z)
ax.images.append(im)
self.imgplot = im
plt.colorbar(im)
while the Pyside slot has:
zhi = self.zmin + (self.ztab.maxslider.value() * range / 100)
im = self.imgplot
im.set_clim([zlo,zhi])
The slider dynamically adjusts the colorbar beautifully, but leaves the color plot untouched. Any suggestions welcome.
Thanks in advance,
Ray
--
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: RO...@an...
|
|
From: Andrea G. <and...@gm...> - 2012-02-17 23:14:12
|
Hello Jerzy & All, On 14 February 2012 17:55, Jerzy Karczmarczuk wrote: > Andrea, I believe that if you find ONE good visual aspect ratio, > according to your figure size, that should do. Yo know your > figsize, and if you know all in your axes([bot,lft,wid, height]), that > this visual ratio should be easy to fix. I managed to get *almost* there, but there still is a small glitch. I attach a self-evident sample, which generates data very similar to the real ones I have and shows the two "parallel" curves to the main one. You will notice that the "parallel" curves look parallel almost all the time, except in a few areas (I have annotated the plot for reference). I can't see the reason for this difference, but it is obvious I am missing something. One thing I didn't include is that in my real-life plot, the figure size should be full screen (which on my screen means 20x13.65 inches) and I use the subplots_adjust command like this: fig.subplots_adjust(left=0.03, right=0.7, bottom=0.04, top=0.96) Thank you in advance for any suggestion. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.alice.it/infinity77/ |
|
From: Jerzy K. <jer...@un...> - 2012-02-17 19:46:48
|
Francois Lemery :
> Hi Python World!
>
> I currently have a 2D array: A[i][j] which I can plot very nicely
> using the contourf function. However, in this plot, the axes span
> from (0, i) and (0, j).
> I would like to multiply each axes by a scaling constant- thereby
> turning the array element values into physical quantities (distance
> and time for example).
> Could anyone help me with this? I've looked around, but so far the
> only solution I have found is to create a new set of arrays with these
> scaling factors included. I can do this, but I feel as though it
> would be a waste.
You want just to change your labelling?
No problemo, Baby.
xmin,xmax = ........
ymin,ymax = ........
...
tbl=...
ic=contourf(tbl,
extent=(xmin,xmax,ymin,ymax))
axis([xmin,xmax,ymin,ymax])
show()
====
Bon courage.
Now, if you want to change your *values*, as Alexa understood, then be
more precise, please.
Jerzy Karczmarczuk
|
|
From: Francois L. <fra...@gm...> - 2012-02-17 19:43:32
|
Hi, Sorry for not giving sufficient detail. I open an HDF5 file and then read some EArray into a regular array: a = f.root MySource = a.myLineSource[:,:,1] # the dimensions of my source are (x, t) = (50, 15000) 50 corresponds to 50 gridpoints where I have recorded an electric field. and 15,000 corresponds to the number of timesteps I have run in my simulation. figure() A1=contourf(MySource) # When I do this, it gives me a beautiful plot. However the x axis spans (0, 50) when I would like it to go from (0, 50)*DX. Similarly, in time, my plot spans (0, 15,000) when I would like it to range from (0, 15000)*DT Where DX and DT are some real numbers (e.g. a micron, and a femtosecond.) I would suspect there to be some 'scaling' feature already available in python for just this kind of thing. That is why I argued that introducing new arrays to incorporate the adjusted/properly scaled values would be a waste. Thanks again! On Fri, Feb 17, 2012 at 1:26 PM, Alexa Villaume <ale...@gm...> wrote: > Hi François, > > Why would it be a waste to multiply the values in an array by the scaling > factors? > > Can you provide an example of your code so everybody can get a better idea > of what you're doing now? > > Thanks, > Alexa > > On Fri, Feb 17, 2012 at 9:07 AM, Francois Lemery <fra...@gm...> > wrote: >> >> Hi Python World! >> >> I currently have a 2D array: A[i][j] which I can plot very nicely >> using the contourf function. However, in this plot, the axes span >> from (0, i) and (0, j). >> I would like to multiply each axes by a scaling constant- thereby >> turning the array element values into physical quantities (distance >> and time for example). >> Could anyone help me with this? I've looked around, but so far the >> only solution I have found is to create a new set of arrays with these >> scaling factors included. I can do this, but I feel as though it >> would be a waste. >> >> -- >> Thanks! >> François >> >> >> ------------------------------------------------------------------------------ >> Virtualization & Cloud Management Using Capacity Planning >> Cloud computing makes use of virtualization - but cloud computing >> also focuses on allowing computing to be delivered as a service. >> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Thanks, François |
|
From: Alexa V. <ale...@gm...> - 2012-02-17 19:26:59
|
Hi François, Why would it be a waste to multiply the values in an array by the scaling factors? Can you provide an example of your code so everybody can get a better idea of what you're doing now? Thanks, Alexa On Fri, Feb 17, 2012 at 9:07 AM, Francois Lemery <fra...@gm...>wrote: > Hi Python World! > > I currently have a 2D array: A[i][j] which I can plot very nicely > using the contourf function. However, in this plot, the axes span > from (0, i) and (0, j). > I would like to multiply each axes by a scaling constant- thereby > turning the array element values into physical quantities (distance > and time for example). > Could anyone help me with this? I've looked around, but so far the > only solution I have found is to create a new set of arrays with these > scaling factors included. I can do this, but I feel as though it > would be a waste. > > -- > Thanks! > François > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Francois L. <fra...@gm...> - 2012-02-17 19:07:58
|
Hi Python World! I currently have a 2D array: A[i][j] which I can plot very nicely using the contourf function. However, in this plot, the axes span from (0, i) and (0, j). I would like to multiply each axes by a scaling constant- thereby turning the array element values into physical quantities (distance and time for example). Could anyone help me with this? I've looked around, but so far the only solution I have found is to create a new set of arrays with these scaling factors included. I can do this, but I feel as though it would be a waste. -- Thanks! François |
|
From: Bedartha G. <go...@pi...> - 2012-02-17 15:59:02
|
Hi all, I am new to Mpl, and I am making a 4x4 subplot now. I wish to offset (downwards) the locations of the tick labels on the Y-axis of one subplot. Actually, I just want to offset one particular tick label but its also okay if its a small (and equal) offset for the tick labels. Can you please help me out? Best, Bedartha |
|
From: Bartosz T. <b.t...@bi...> - 2012-02-17 14:54:01
|
Hi all, I had the same problem and I implemented a small library for manipulating SVG figures (for example, matplotlib-generated). It is on github: https://github.com/btel/svg_utils There is also a related blog post: http://neuroscience.telenczuk.pl/?p=331 The library does NOT allow to import svg figures into matplotlib, but it allows to combine a mpl figure exported to SVG and and a external SVG file. I hope it helps! Cheers, Bartosz On 16.02.2012, at 20:43, William Hoburg wrote: > Hi everybody, > Is there a way to import a svg-image into a plot? > I know that there are some possibilities to import png (http://matplotlib.sourceforge.net/examples/pylab_examples/demo_annotation_box.html) or eps (which is then rastered). > But till now I didn't find any way to import/embed a real vector graphic which is still a vector when I save the figure again as pdf or svg. > Thanks in advance, > HoWil > -- > Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir > belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Bartosz Telenczuk Institute for Theoretical Biology Humboldt University of Berlin, Germany Phone: +4930/2093-8838 Homepage: http://neuroscience.telenczuk.pl |
|
From: Eric F. <ef...@ha...> - 2012-02-17 08:21:28
|
On 02/15/2012 03:10 PM, Alexa Villaume wrote: > Hi Eric, > > Thanks for your help, I'm still really new to python and matplotlib. > I've got my labels defined but now I'm having another problem with the > formatting. > > I'm doing - > > CS1.level=[14.07, 14.27] > > plt.clabel(CS1,CS1.level[::2],inline=True,fmt='OIII',fontize=14) Alexa, First, it looks like you might have slightly misunderstood my suggestion. When levels are specified as a kwarg for contour or contourf, they are saved as the "levels" attribute of the ContourSet object that is returned. So, one does not assign directly to that attribute. Second, clabel is intended for use with contour, not contourf, and can produce odd results with the ContourSet returned by a call to contourf. (This might be considered a bug; I only stumbled over it while trying to understand your problem. It had never occurred to me to try to use clabel with contourf. I think that either it should be made to work as one might reasonably expect, or clabel should raise an exception if given a ContourSet from contourf.) You can always use both contour and contourf as in this example: http://matplotlib.sourceforge.net/examples/pylab_examples/contourf_demo.html If you don't want the lines you can make them invisible and leave only the labels. > > > Where I get a type error that says that not all string arguments are > getting converted during formatting. This is the full error, > > Traceback (most recent call last): > > File "ContourAttempt.py", line 81, in <module> > > plt.clabel(CS1,CS1.level[::2],inline=True,fmt='OIII',fontize=14) # > Something wrong with formmating > Third, in your line above, you are trying to set fmt to a string that is not a number formatting string; that is why you are getting the exception. The code is trying to use the fmt string to format a numeric level, but there is no % expression in it, so it can't. It looks like your earlier code, with the dictionary as fmt, was more along the right lines. I have never tried this option myself, though. If you run into another problem (or need more advice with the present problem) please try to provide a complete, self-contained example that illustrates it. That way someone else can run it, see exactly the problem, and show you exactly how to solve it. Or in the process of condensing the problem down to an example in a few lines, sometimes one sees the solution. Welcome to python and mpl! Eric > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/pyplot.py", > line 2176, in clabel > > ret = ax.clabel(CS, *args, **kwargs) > > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/axes.py", > line 7326, in clabel > > return CS.clabel(*args, **kwargs) > > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/contour.py", > line 217, in clabel > > self.labels(inline,inline_spacing) > > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/contour.py", > line 624, in labels > > lw = self.get_label_width(lev, self.labelFmt, fsize) > > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/contour.py", > line 284, in get_label_width > > lev = self.get_text(lev, fmt) > > File "/Users/alexavillaume/src/matplotlib/lib/matplotlib/contour.py", > line 344, in get_text > > return fmt%lev > > TypeError: not all arguments converted during string formatting > > > > > On Wed, Feb 15, 2012 at 10:34 AM, Eric Firing <ef...@ha... > <mailto:ef...@ha...>> wrote: > > On 02/15/2012 10:15 AM, Alexa Villaume wrote: > > Hi Everybody, > > > > > > I'm trying to label the contours of my contour plot following this > > example - > > > > > http://matplotlib.sourceforge.net/examples/pylab_examples/contour_label_demo.html > > > > > > My actual code looks like this - > > > > > > import matplotlib > > > > matplotlib.use('PDF') > > > > frompylab import* > > > > import numpy as np > > > > > > # Define the surface of the plot > > > > metals=np.arange(-3.0, 1.1, 0.1) > > > > U=np.arange(-6.0, 0.25, 0.25) > > > > > > # Create the arrays that the data will be stored in > > > > o3=np.zeros([25,41]) > > > > o2=np.zeros([25,41]) > > > > c3=np.zeros([25,41]) > > > > mg2=np.zeros([25,41]) > > > > c3=np.zeros([25,41]) > > > > si2=np.zeros([25,41]) > > > > s3=np.zeros([25,41]) > > > > > > CS=plt.contourf(metals, U, o3, levels=[o3col-nsig*o3sig, > > o3col+nsig*o3sig], alpha=0.50, colors='#f88534') > > > > CS=plt.contourf(metals, U, o2, levels=[o2col-nsig*o2sig, > > o2col+nsig*o2sig], alpha=0.50, colors='#f2f34f') > > > > CS=plt.contourf(metals, U, c3, levels=[c3col-nsig*c3sig, > > c3col+nsig*c3sig], alpha=0.50, colors='#93d3f3') > > > > CS=plt.contourf(metals, U, mg2, levels=[mg2col-nsig*mg2sig, > > mg2col+nsig*mg2sig], alpha=0.50, colors='#ff536d') > > > > CS=plt.contourf(metals, U, s3, levels=[s3col-nsig*s3sig, > > s3col+nsig*s3sig], alpha=0.50, colors='#83c460') > > > > CS=plt.contourf(metals, U, si2, levels=[si2col-nsig*si2sig, > > si2col+nsig*si2sig], alpha=0.50, colors='black') > > > > > > > > # Trying to label the contours > > > > > > fmt = {} > > > > strs = [ 'O III', 'O II', 'C III', 'Mg II', 'S III', 'Si II'] > > > > for l,s in zip(levels, strs): > > > > fmt[l] = s > > > > plt.clabel(CS,levels[::2],inline=True,fmt=fmt,fontize=14) > > > > > > But I get an error that says that "levels" is not defined. What > should I do? > > Define levels! > > In your call to clabel, you are referencing a global "levels" which you > did not define; what you did define is the levels attribute of each CS > object. So probably what you want is something like: > > plt.clabel(CS, CS.levels[::2],inline=True,fmt=fmt,fontize=14) > > but you need one such call for each CS you create, if you want all of > them labeled. > > > Eric > > > > > > > Thanks! > > > > Alexa |
|
From: Jakob G. <ga...@il...> - 2012-02-17 08:09:40
|
Hi, if the import filetype is not restricted to svg, you can use PyX to place vector eps figures into other eps figures. I used this in a two step approach (first create the plot with matplotlib and store is as eps and second, use PyX to combine the plot with a vector figure) in a single script. This usually worked fine and the resulting file is still completely vectorized! br Jakob On 02/16/2012 08:43 PM, William Hoburg wrote: > Hi everybody, > Is there a way to import a svg-image into a plot? > I know that there are some possibilities to import png (http://matplotlib.sourceforge.net/examples/pylab_examples/demo_annotation_box.html) or eps (which is then rastered). > But till now I didn't find any way to import/embed a real vector graphic which is still a vector when I save the figure again as pdf or svg. > Thanks in advance, > HoWil |
|
From: Benjamin R. <ben...@ou...> - 2012-02-16 23:23:46
|
On Thursday, February 16, 2012, Kathleen M Tacina wrote: > ** > I've found matplotlib to be a very nice tool. In particular, I've been > using the LightSource class in colors.py. > > However, LightSource.shade always uses the array min and max to set the > minimum and maximum colormap values. I'd like to be able to manually set > minimum and maximum values used in the colormap, and I'd also be like to > limit the elevation for the shading algorithm. I have three use cases: > (1) comparing related images, which is much easier to do when the > colormaps are constant > (2) cases where I have very high or very low values > (3) cases where I've used the set_over or set_under methods of the > colormap because low and/or high values are significant. > > Since it was fairly easy to modify this code myself, I did so. This > modification might be useful to other people, too, so I was wondering if it > would be possible to modify LightSource.shade similar to the code below. > > def shade(self,data,cmap,vmin=None,vmax=None,limit_elevation=False): > """ > Take the input data array, convert to HSV values in the > given colormap, then adjust those color values > to given the impression of a shaded relief map with a > specified light source. > RGBA values are returned, which can then be used to > plot the shaded image with imshow. > > Parameters > ---------- > data Input data array > vmin Minimum data value for colormap. Default > min(data). > vmax Maximum data value for colormap. Default > max(data). > limit_elevation Limit the elevation in the shading routine? > Default False. > If true, the elevation will be limited by vmin and > vmax. > > Returns > ------- > rgb Shaded RGBA values, suitable for use with imshow. > > """ > > if (vmin is not None) or (vmax is not None): > limitschanged = True > else: > limitschanged = False > if vmin is None: > vmin = np.min(data) > if vmax is None: > vmax = np.max(data) > rgb0 = cmap((data-vmin)/(np.float(vmax-vmin))) > #avoid using extra memory if copy of array not needed > if limitschanged and limit_elevation: > d = data.copy() > d[d<vmin] = vmin > d[d>vmax] = vmax > rgb1 = self.shade_rgb(rgb0, elevation=d) > else: > rgb1 = self.shade_rgb(rgb0, elevation=data) > rgb0[:,:,0:3] = rgb1 > return rgb0 > > I've attached a colors.py with a modified LightSource.shade and some > examples (shading3.py and shading4.py) that use the modifications to > shade. > > This is the first time I've suggested a change to matplotlib, so please > let me know if there was a better way to make this suggestion. > > Regards, > Kathy > Kathy, It is great that you have found mpl to be useful, and better still that you found a way to improve it. The recommended way to submit changes is through github. The developers' guide at matplotlib.sourceforge.net will describe how to do that. At the very least, diff patches are needed so that we can be sure we make exactly the right changes. Welcome! Ben Root |
|
From: Benjamin R. <ben...@ou...> - 2012-02-16 23:16:51
|
On Thursday, February 16, 2012, Martin Mokrejs wrote: > Hi Ben, > glad you found the answer. Once again, does F.get_size_inches() have to > return to > the user the numpy array? Why not a list or tuple? I don't mind matplotlib > internal > stuff. ;-) We don't return a list or a tuple because other functions within mpl needs the numpy array. > > In an answer to your proposed workaround > > > DefaultSize = tuple(F.get_size_inches()) > > let me comment that (I think) I tried also > > DefaultSize = F.get_size_inches()[:] > > but that also did not work for me. And was similarly think of the copy > module haven't > bothered to try that. ;-) > > You might want to read up on numpy arrays. A slice of an array returns a view. A slice on a view also returns a view. If you want a copy, the array has a copy() method. I don't know if the copy module would actually work because it would merely be copying the view (creating a duplicate view). Ben Root > > Yes, please document this at least if you really cannot return a simple > list or tuple. > Thanks, > Martin > > Benjamin Root wrote: > > > > > > On Thu, Feb 16, 2012 at 3:09 PM, Martin Mokrejs < > mmo...@fo... <javascript:;> <mailto: > mmo...@fo... <javascript:;>>> wrote: > > > > Hi Benjamin, > > thank you for you explanation. My comment is below in the text: > > > > Benjamin Root wrote: > > > > > > > > > On Tue, Feb 14, 2012 at 4:43 PM, Martin Mokrejs < > mmo...@fo... <mailto:mmo...@fo...> <mailto: > mmo...@fo... <mailto:mmo...@fo...>>> wrote: > > > > > > Ah, this seems to be the issue that my figsize was growing all > the time so it > > > went over the maximum limits. > > > > > > I thought this is valid: > > > DefaultSize = F.get_size_inches() > > > print str(DefaultSize) > > > blah > > > F.set_size_inches(DefaultSize) > > > > > > See http://matplotlib.sourceforge.net/api/figure_api.html > > > > > > <quote> > > > set_size_inches(*args, **kwargs) > > > > > > set_size_inches(w,h, forward=False) > > > > > > Set the figure size in inches > > > > > > Usage: > > > > > > fig.set_size_inches(w,h) # OR > > > fig.set_size_inches((w,h) ) > > > > > > optional kwarg forward=True will cause the canvas size to > be automatically updated; eg you can resize the figure window from the shell > > > > > > ACCEPTS: a w,h tuple with w,h in inches > > > </quote> > > > > > > Nope, it does not work. The print call gives me: [ 8. 6.]. > So, this is not a tuple? > > > Or python-2.7 issue how is it printed ... I fear? ;-) > > > Anyway, doing > > > > > > F.set_size_inches(11.2, 15) > > > > > > works for me. > > > > > > Martin > > > > > > > > > I am a little bit confused by your code example. You get the > figure size and print it, and *then* you set it with the exact same values, > and you are surprised that it came out as [8. 6.]? Note that the figure > size is stored internally as a numpy array, so when you do "print > str(DefaultSize)", you will get the string representation of the numpy > array. You can still pass in a tuple, list, or two separate elements. Try > this code: > > > > No, in my experience it did NOT work. I suspect F.set_size_inches() > either did not like the input tuple or something else. Now. after reading > your clarification, are you sure it can input the numpy array as well? What > I also tried was to re-set the figsize to original values. > > > > > > Yes, it can. I found the source of the problem, see further down. > > > > > > Ouch, I use pylab not matplotlib directly. :( > > > > > > Doesn't matter. > > > > > > $ python > > Python 2.7.2 (default, Feb 7 2012, 19:33:08) > > [GCC 4.5.3] on linux2 > > Type "help", "copyright", "credits" or "license" for more > information. > > >>> import pylab > > >>> F = pylab.gcf() > > >>> print F.get_size_inches() > > [ 8. 6.] > > >>> DefaultSize = F.get_size_inches() > > >>> print DefaultSize > > [ 8. 6.] > > >>> F.set_size_inches(10, 10) > > >>> print F.get_size_inches() > > [ 10. 10.] > > > |