SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
(47)
2
(13)
3
(12)
4
(16)
5
(3)
6
(6)
7
(20)
8
(45)
9
(24)
10
(30)
11
(14)
12
(4)
13
(1)
14
(6)
15
(6)
16
(10)
17
(15)
18
(13)
19
(4)
20
21
(14)
22
(13)
23
(9)
24
(19)
25
(24)
26
27
(4)
28
(20)
29
(17)
30
(7)



Showing results of 47

1 2 > >> (Page 1 of 2)
From: Malte D. <mal...@we...> - 2010年06月01日 23:48:01
Howard Sun <hs...@nv...>
> Sorry for the newbie question, how do you plot one x with multiple ys. In
> below data, x column is followed by 5 y columns: Many thanks!
> Howard
> 
> 2 1.0000e+00 6.6232e-02 9.9392e-03 2.2992e-02 3.8111e-07
> 3 6.3664e-01 1.0269e-01 7.9107e-03 1.8254e-02 1.1391e-07
> 4 2.7590e-01 4.9783e-02 6.2644e-03 1.0943e-02 5.8480e-08
> 5 1.6550e-01 2.3269e-02 4.7482e-03 8.4312e-03 5.8239e-08
> 6 1.1590e-01 1.7234e-02 3.8567e-03 8.7010e-03 4.5506e-08
> 7 7.4337e-02 1.1662e-02 3.3756e-03 8.0889e-03 4.0900e-08
> 8 5.7775e-02 1.0917e-02 2.8980e-03 6.9654e-03 3.7520e-08
> 9 4.7310e-02 1.1869e-02 2.5929e-03 5.8326e-03 3.4745e-08
> 10 3.9591e-02 1.1301e-02 2.4691e-03 5.2749e-03 3.2126e-08
> 11 3.6517e-02 1.0755e-02 2.3121e-03 4.8631e-03 3.7942e-08
> 12 3.2872e-02 9.8306e-03 2.1692e-03 4.6281e-03 3.2358e-08
> 13 3.1235e-02 9.1704e-03 2.0419e-03 4.3928e-03 3.1479e-08
> 14 2.9528e-02 8.6926e-03 1.9364e-03 4.1360e-03 3.5639e-08
> 15 2.7895e-02 8.3080e-03 1.8475e-03 3.9015e-03 3.0486e-08
> 16 2.6440e-02 7.9610e-03 1.7776e-03 3.6790e-03 3.0307e-08
> 17 2.5259e-02 7.6345e-03 1.6984e-03 3.4743e-03 3.1805e-08
> 18 2.4064e-02 7.3267e-03 1.6341e-03 3.2848e-03 3.0188e-08
> 19 2.3171e-02 7.0284e-03 1.5821e-03 3.1098e-03 2.7565e-08
> 20 2.2317e-02 6.7322e-03 1.5247e-03 2.9475e-03 2.7009e-08
First, you take the data apart, like in:
import csv, numpy
# let's call your array "filecopy"
d = csv.Sniffer().sniff(filecopy[0])
for this_one_line in csv.reader(filecopy, d):
 header = this_one_line
 break
data = numpy.zeros((len(header), len(filecopy)))
for line in csv.reader(filecopy[1:], d):
 for n in range(len(header)):
 data[n][linecounter] = float(line[n])
 linecounter += 1
And then, you plot it:
from matplotlib import pyplot
fig = pyplot.figure()
s = fig.add_subplot(1, 1, 1)
for c in data:
 s.plot(data[0], c)
pyplot.show()
Obviously, that's all taken from another script and won't work "as is" and 
there might be functions which would make some of this easier.
The main reason for posting this is being that bad that someone couldn't take 
the pain and post something better - and me learning in the process.
Sincerely,
Malte
From: Angus M. <am...@gm...> - 2010年06月01日 23:38:41
On 1 June 2010 19:05, Howard Sun <hs...@nv...> wrote:
> Sorry for the newbie question, how do you plot one x with multiple ys. In
> below data, x column is followed by 5 y columns:
> Many thanks!
>
You can make an x vector and a y array, so that the first dimension of y is
the same length as x:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(2,21)
y = np.random.random(size=(19,5)) + np.arange(5)[None,:]
plt.plot(x,y)
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Alan G I. <ala...@gm...> - 2010年06月01日 23:36:00
On 6/1/2010 7:05 PM, Howard Sun wrote:
> Sorry for the newbie question, how do you plot one x with multiple ys. In below data, x column is followed by 5 y columns
> 
Matplotlib has excellent documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
hth,
Alan Isaac
From: Howard S. <hs...@nv...> - 2010年06月01日 23:05:47
Sorry for the newbie question, how do you plot one x with multiple ys. In below data, x column is followed by 5 y columns:
Many thanks!
Howard
2 1.0000e+00 6.6232e-02 9.9392e-03 2.2992e-02 3.8111e-07 
3 6.3664e-01 1.0269e-01 7.9107e-03 1.8254e-02 1.1391e-07 
4 2.7590e-01 4.9783e-02 6.2644e-03 1.0943e-02 5.8480e-08 
5 1.6550e-01 2.3269e-02 4.7482e-03 8.4312e-03 5.8239e-08 
6 1.1590e-01 1.7234e-02 3.8567e-03 8.7010e-03 4.5506e-08 
7 7.4337e-02 1.1662e-02 3.3756e-03 8.0889e-03 4.0900e-08 
8 5.7775e-02 1.0917e-02 2.8980e-03 6.9654e-03 3.7520e-08 
9 4.7310e-02 1.1869e-02 2.5929e-03 5.8326e-03 3.4745e-08 
10 3.9591e-02 1.1301e-02 2.4691e-03 5.2749e-03 3.2126e-08 
11 3.6517e-02 1.0755e-02 2.3121e-03 4.8631e-03 3.7942e-08 
12 3.2872e-02 9.8306e-03 2.1692e-03 4.6281e-03 3.2358e-08 
13 3.1235e-02 9.1704e-03 2.0419e-03 4.3928e-03 3.1479e-08 
14 2.9528e-02 8.6926e-03 1.9364e-03 4.1360e-03 3.5639e-08 
15 2.7895e-02 8.3080e-03 1.8475e-03 3.9015e-03 3.0486e-08 
16 2.6440e-02 7.9610e-03 1.7776e-03 3.6790e-03 3.0307e-08 
17 2.5259e-02 7.6345e-03 1.6984e-03 3.4743e-03 3.1805e-08 
18 2.4064e-02 7.3267e-03 1.6341e-03 3.2848e-03 3.0188e-08 
19 2.3171e-02 7.0284e-03 1.5821e-03 3.1098e-03 2.7565e-08 
20 2.2317e-02 6.7322e-03 1.5247e-03 2.9475e-03 2.7009e-08
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
From: Jae-Joon L. <lee...@gm...> - 2010年06月01日 22:39:32
On Tue, Jun 1, 2010 at 2:22 PM, rugspin <pie...@we...> wrote:
> That's doing it, thought there might be an internal way within matplotlib,
> but I could figure one.
If you need more hard-core way of doing this,
a = np.arange(16384).reshape(128, 128)
from matplotlib.colors import Normalize
import matplotlib.cm as cm
norm = Normalize(vmin=0, vmax=16383)
cmap = cm.summer
A = (cmap(norm(a))*255).astype(np.uint8)
import Image
pilim = Image.fromarray(A, "RGBA")
From: Denis L. <dla...@gm...> - 2010年06月01日 22:28:36
Hi Ben,
Thanks for your answer.
Actually, options for savefig seem to only operate on 2D axes whereas
I'm trying to change the color of 3D axes (x,y,z) which, by default,
have a grid with a gray background.
I manage to remove the grid lines but not the background color.
(My initial question was not very clear perhaps...)
 Denis
Le mardi 01 juin 2010 à 16:57 -0500, Benjamin Root a écrit :
> Denis,
> 
> There are probably other ways, but the one that I know off the top of my
> head is done at the savefig() function. If you want to remove the
> background entirely, you can specify the keyword argument transparent=True.
> You can change the color using the facecolor keyword argument. You can
> specify any color in that argument like you would elsewhere in matplotlib.
> 
> Ben Root
> 
> On Tue, Jun 1, 2010 at 4:42 PM, Denis Laxalde <dla...@gm...> wrote:
> 
> > Hi,
> >
> > Is there a way to change (and maybe remove) the background color (gray
> > by default) of axis in mplot3d graphics ?
> >
> > Thanks,
> >
> > Denis
> >
From: Jae-Joon L. <lee...@gm...> - 2010年06月01日 22:26:59
 this is supposed to be explained in
http://matplotlib.sourceforge.net/trunk-docs/users/gridspec.html
But the trunk documentation is failed to build at this moment.
In short, in the svn version of matplotlib, axes_grid is divided into
two separate modules, axes_grid1 and axisartist (axes_grid is provided
for backward compatibility).
Please see the above link when it is back online.
Regards,
-JJ
On Tue, Jun 1, 2010 at 5:34 PM, Benjamin Root <ben...@ou...> wrote:
> Hello,
>
> Does anybody know what is the difference between mpl_toolkit.axes_grid and
> mpl_toolkit.axes_grid1?
>
> Thanks,
> Ben Root
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Benjamin R. <ben...@ou...> - 2010年06月01日 21:57:47
Denis,
There are probably other ways, but the one that I know off the top of my
head is done at the savefig() function. If you want to remove the
background entirely, you can specify the keyword argument transparent=True.
You can change the color using the facecolor keyword argument. You can
specify any color in that argument like you would elsewhere in matplotlib.
Ben Root
On Tue, Jun 1, 2010 at 4:42 PM, Denis Laxalde <dla...@gm...> wrote:
> Hi,
>
> Is there a way to change (and maybe remove) the background color (gray
> by default) of axis in mplot3d graphics ?
>
> Thanks,
>
> Denis
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Denis L. <dla...@gm...> - 2010年06月01日 21:50:17
Hi,
Is there a way to change (and maybe remove) the background color (gray
by default) of axis in mplot3d graphics ?
Thanks,
 Denis
From: Benjamin R. <ben...@ou...> - 2010年06月01日 21:35:18
Hello,
Does anybody know what is the difference between mpl_toolkit.axes_grid and
mpl_toolkit.axes_grid1?
Thanks,
Ben Root
From: Friedrich R. <fri...@gm...> - 2010年06月01日 19:35:07
Attachments: canvas.py
> That's doing it, thought there might be an internal way within matplotlib,
> but I could figure one.
I think you can use the agg backend and the corresponding Canvas'es method
canvas.tostring_rgb()
. Then you can load this in PIL by Image.fromstring.
Well, I simply send you my PIL backend. Tell me if it's still working ...
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年06月01日 19:07:48
this list configuration got me again ...
2010年6月1日 Oz Nahum <na...@gm...>:
> the numbers on my figure's color bar range from 0 to 1.7,
> but mpl writes the following numbers:
>
> 0.0000, 0.000250,0.000050,0.000750,
>
> etc.
>
> This is totally not somthing I can use, it looks horrible.
What do you mean by
> the numbers on my figure's color bar range from 0 to 1.7
? Actually the colorbar in your pic ranges from 1.179 + 0.000000 to
1.1792 = 1.179 + 0.000200
Hmm, so I guess ScalarFormatter is already used and does its best job
already. The notation chosen is at least not erratic or random.
You can modify the data to suit plotting needs or modify the plotting
rules by writing a simple own formatter.
Friedrich
From: Avery F. <af...@sl...> - 2010年06月01日 18:56:30
Hello,
I'm having trouble getting a multi-yaxis plot looks right. See:
http://tesla.slu.edu/images/test.ps
The red bars are associated with the left y-axis. The green and blue bars
are associated with the right y-axis. If you zoom in close enough, you'll
notice that the borders of the plot (the actual axes I guess) are drawn over
and under the bars. Specifically, they slightly cover the red bars and are
slighty covered by the green and blue bars.
So,
1.) Is there a way to draw the borders completely outside of the actual
plotting area regardless of how thick they are?
2.) If not, is there a way to have all bars appear underneath the
border/axes when I have multiple subplots via twinx?
Thanks,
Avery Fay
From: rugspin <pie...@we...> - 2010年06月01日 18:22:58
Thanks Jae-Joo
That's doing it, thought there might be an internal way within matplotlib,
but I could figure one.
I'm quite confused with the canvas, dpi, ...
Regards Hans
Jae-Joon Lee wrote:
> 
> You may use StringIO.
> 
> from scipy import *
> from pylab import *
> from PIL import Image
> 
> import cStringIO
> 
> 
> a = arange(16384).reshape(128,128)
> 
> f = cStringIO.StringIO()
> imsave(f, a, cmap=cm.summer,vmin=0,vmax=16383, format="png") # you'd
> better set the format explicitly.
> f.reset()
> b = Image.open(f)
> f.close()
> 
> IHTH,
> 
> -JJ
> 
> 
> On Tue, Jun 1, 2010 at 5:18 AM, rugspin <pie...@we...> wrote:
>>
>>
>>
>> Angus McMorland-2 wrote:
>>>
>>> On 31 May 2010 23:17, Angus McMorland <am...@gm...> wrote:
>>>
>>>> On 31 May 2010 19:49, rugspin <pie...@we...> wrote:
>>>>
>>>>>
>>>>> I have a small problem how to convert an image from matplotlib to PIL
>>>>>
>>>>> right now doing somthing like this:
>>>>> ------------------------------------------
>>>>> from scipy import *
>>>>> from pylab import *
>>>>> from PIL import Image
>>>>>
>>>>> a = arange(16384).reshape(128,128)
>>>>> imsave( "test.png", a, cmap=cm.summer,vmin=0,vmax=16383)
>>>>> b = Image.open("test.png" )
>>>>> ------------------------------------------
>>>>>
>>>>
>>>> The Image.fromarray function should do what you want. For example,
>>>>
>>>> import numpy as np  # note: use of "from foo import *"
>>>> import Image       # is discouraged where possible
>>>>
>>>> a = np.arange(128)[None,:] * np.ones(128)[:,None]
>>>>
>>>
>>> Sorry - I was playing around with a few iterations of this line, and
>>> didn't
>>> provide the most useful one. Your example:
>>>
>>> a = np.arange(128**2).reshape(128,128)
>>>
>>> should also work fine.
>>>
>>>
>>>> b = Image.fromarray(a)
>>>> c = np.asarray(b)
>>>> np.all(c == a)
>>>>  -> True
>>>>
>>>> I hope that helps,
>>>>
>>>> Angus.
>>>>
>>>
>>> --
>>> AJC McMorland
>>> Post-doctoral research fellow
>>> Neurobiology, University of Pittsburgh
>>>
>>> ------------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>> Thank you Angus
>> but that's not exactly what i was looking for. The fromarray function is
>> very basic, so I would have to take care of all the RGBA of the array.
>> the
>> imshow and imsave functions take care of all that for example adding a
>> colormap. After choosing a reasonable colormap (vmin, vmax, ....) I would
>> like to convert this into a PIL image.
>>
>> Best Regard
>> Hans
>>
>> --
>> View this message in context:
>> http://old.nabble.com/imshow%2C-imsave-to-PIL-image-conversion-tp28736246p28739401.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> ------------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/imshow%2C-imsave-to-PIL-image-conversion-tp28736246p28745632.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年06月01日 18:22:29
As Eric told, you need to build it from the "svn". Unfortunately, no
released version (I believe) includes this feature.
http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
Anyhow, the patch for "box-forced" involves only a few lines of
change. You may consider to apply it by yourself (or do some monkey
patching).
Regards,
-JJ
On Tue, Jun 1, 2010 at 2:11 PM, Adam Fraser <ada...@gm...> wrote:
> Hi all, I updated to version 99.1.1 and I'm still getting the error
> "ValueError: argument must be "box", or "datalim" at set_adjustable..."
> from axes.py
> when I try to do ax.set_adjustable("box-forced") as you suggested.
> -Adam
>
>
> On Thu, May 27, 2010 at 3:08 PM, Adam Fraser <ada...@gm...>
> wrote:
>>
>> Thanks very much,
>> I'm getting ValueError: argument must be "box", or "datalim" at
>> set_adjustable...
>> I'm using Matplotlib version 0.98.5.3, do I need to update?
>>
>> On Thu, May 27, 2010 at 2:59 PM, Jae-Joon Lee <lee...@gm...>
>> wrote:
>>>
>>> ax1 = subplot(121)
>>> ax2 = subplot(122, sharex=ax1, sharey=ax1)
>>>
>>> ax1.set_adjustable("box-forced")
>>> ax2.set_adjustable("box-forced")
>>>
>>> arr1 = np.arange(100).reshape((10, 10))
>>> ax1.imshow(arr1)
>>>
>>> arr2 = np.arange(100, 0, -1).reshape((10, 10))
>>> ax2.imshow(arr2)
>>>
>>> Note the use of set_adjustable("box-forced").
>>> sharex and sharey does not get along with axes of aspect=1 &
>>> adjustable="box".
>>>
>>> -JJ
>>>
>>>
>>>
>>> On Thu, May 27, 2010 at 2:10 PM, <PH...@ge...> wrote:
>>> > Do the "sharex" and "sharey" kwargs help?
>>> >
>>> >
>>> > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes
>>> >
>>> >
>>> > http://matplotlib.sourceforge.net/examples/pylab_examples/shared_axis_demo.html
>>> >
>>> > -paul
>>> >
>>> >
>>> >
>>> > From: Adam Fraser [mailto:ada...@gm...]
>>> > Sent: Thursday, May 27, 2010 10:44 AM
>>> > To: matplotlib-users
>>> > Subject: [Matplotlib-users] Is there a way to link axes of imshow
>>> > plots?
>>> >
>>> >
>>> >
>>> > Suppose I have a figure canvas with 3 plots... 2 are images of the same
>>> > dimensions plotted with imshow, and the other is a scatterplot. I'd
>>> > like to
>>> > be able to link the x and y axes of the imshow plots so that when I
>>> > zoom in
>>> > one, the other zooms to the same coordinates, and when I pan in one,
>>> > the
>>> > other pans as well.
>>> >
>>> >
>>> >
>>> > I started hacking my way around this by
>>> > subclassing NavigationToolbar2WxAgg
>>> > (shown below)... but there are several problems here.
>>> >
>>> > 1) This will link the axes of all plots in a canvas since all I've done
>>> > is
>>> > get rid of the checks for a.in_axes()
>>> >
>>> > 2) This worked well for panning, but zooming caused all subplots to
>>> > zoom
>>> > from the same global point, rather than from the same point in each of
>>> > their
>>> > respective axes.
>>> >
>>> >
>>> >
>>> > Can anyone suggest a workaround?
>>> >
>>> >
>>> >
>>> > Much thanks!
>>> >
>>> > -Adam
>>> >
>>> >
>>> >
>>> > from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
>>> > as
>>> > NavigationToolbar
>>> >
>>> > class MyNavToolbar(NavigationToolbar):
>>> >
>>> >   def __init__(self, canvas, cpfig):
>>> >
>>> >     NavigationToolbar.__init__(self, canvas)
>>> >
>>> >
>>> >
>>> >   # override
>>> >
>>> >   def press_pan(self, event):
>>> >
>>> >     'the press mouse button in pan/zoom mode callback'
>>> >
>>> >
>>> >
>>> >     if event.button == 1:
>>> >
>>> >       self._button_pressed=1
>>> >
>>> >     elif event.button == 3:
>>> >
>>> >       self._button_pressed=3
>>> >
>>> >     else:
>>> >
>>> >       self._button_pressed=None
>>> >
>>> >       return
>>> >
>>> >
>>> >
>>> >     x, y = event.x, event.y
>>> >
>>> >
>>> >
>>> >     # push the current view to define home if stack is empty
>>> >
>>> >     if self._views.empty(): self.push_current()
>>> >
>>> >
>>> >
>>> >     self._xypress=[]
>>> >
>>> >     for i, a in enumerate(self.canvas.figure.get_axes()):
>>> >
>>> >       # only difference from overridden method is that this one
>>> > doesn't
>>> >
>>> >       # check a.in_axes(event)
>>> >
>>> >       if x is not None and y is not None and a.get_navigate():
>>> >
>>> >         a.start_pan(x, y, event.button)
>>> >
>>> >         self._xypress.append((a, i))
>>> >
>>> >         self.canvas.mpl_disconnect(self._idDrag)
>>> >
>>> >
>>> > self._idDrag=self.canvas.mpl_connect('motion_notify_event',
>>> > self.drag_pan)
>>> >
>>> >
>>> >
>>> >   def press_zoom(self, event):
>>> >
>>> >     'the press mouse button in zoom to rect mode callback'
>>> >
>>> >     if event.button == 1:
>>> >
>>> >       self._button_pressed=1
>>> >
>>> >     elif event.button == 3:
>>> >
>>> >       self._button_pressed=3
>>> >
>>> >     else:
>>> >
>>> >       self._button_pressed=None
>>> >
>>> >       return
>>> >
>>> >
>>> >
>>> >     x, y = event.x, event.y
>>> >
>>> >
>>> >
>>> >     # push the current view to define home if stack is empty
>>> >
>>> >     if self._views.empty(): self.push_current()
>>> >
>>> >
>>> >
>>> >     self._xypress=[]
>>> >
>>> >     for i, a in enumerate(self.canvas.figure.get_axes()):
>>> >
>>> >       # only difference from overridden method is that this one
>>> > doesn't
>>> >
>>> >       # check a.in_axes(event)
>>> >
>>> >       if x is not None and y is not None and a.get_navigate() and
>>> > a.can_zoom():
>>> >
>>> >         self._xypress.append(( x, y, a, i, a.viewLim.frozen(),
>>> > a.transData.frozen()))
>>> >
>>> >
>>> >
>>> >     self.press(event)
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > ------------------------------------------------------------------------------
>>> >
>>> >
>>> > _______________________________________________
>>> > Matplotlib-users mailing list
>>> > Mat...@li...
>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> >
>>> >
>>
>
>
From: Adam F. <ada...@gm...> - 2010年06月01日 18:12:03
Hi all, I updated to version 99.1.1 and I'm still getting the error
"ValueError: argument must be "box", or "datalim" at set_adjustable..."
from axes.py
when I try to do ax.set_adjustable("box-forced") as you suggested.
-Adam
On Thu, May 27, 2010 at 3:08 PM, Adam Fraser <ada...@gm...>wrote:
> Thanks very much,
>
> I'm getting ValueError: argument must be "box", or "datalim" at
> set_adjustable...
>
> I'm using Matplotlib version 0.98.5.3, do I need to update?
>
>
> On Thu, May 27, 2010 at 2:59 PM, Jae-Joon Lee <lee...@gm...>wrote:
>
>> ax1 = subplot(121)
>> ax2 = subplot(122, sharex=ax1, sharey=ax1)
>>
>> ax1.set_adjustable("box-forced")
>> ax2.set_adjustable("box-forced")
>>
>> arr1 = np.arange(100).reshape((10, 10))
>> ax1.imshow(arr1)
>>
>> arr2 = np.arange(100, 0, -1).reshape((10, 10))
>> ax2.imshow(arr2)
>>
>> Note the use of set_adjustable("box-forced").
>> sharex and sharey does not get along with axes of aspect=1 &
>> adjustable="box".
>>
>> -JJ
>>
>>
>>
>> On Thu, May 27, 2010 at 2:10 PM, <PH...@ge...> wrote:
>> > Do the "sharex" and "sharey" kwargs help?
>> >
>> >
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes
>> >
>> >
>> http://matplotlib.sourceforge.net/examples/pylab_examples/shared_axis_demo.html
>> >
>> > -paul
>> >
>> >
>> >
>> > From: Adam Fraser [mailto:ada...@gm...]
>> > Sent: Thursday, May 27, 2010 10:44 AM
>> > To: matplotlib-users
>> > Subject: [Matplotlib-users] Is there a way to link axes of imshow plots?
>> >
>> >
>> >
>> > Suppose I have a figure canvas with 3 plots... 2 are images of the same
>> > dimensions plotted with imshow, and the other is a scatterplot. I'd like
>> to
>> > be able to link the x and y axes of the imshow plots so that when I zoom
>> in
>> > one, the other zooms to the same coordinates, and when I pan in one, the
>> > other pans as well.
>> >
>> >
>> >
>> > I started hacking my way around this by
>> subclassing NavigationToolbar2WxAgg
>> > (shown below)... but there are several problems here.
>> >
>> > 1) This will link the axes of all plots in a canvas since all I've done
>> is
>> > get rid of the checks for a.in_axes()
>> >
>> > 2) This worked well for panning, but zooming caused all subplots to zoom
>> > from the same global point, rather than from the same point in each of
>> their
>> > respective axes.
>> >
>> >
>> >
>> > Can anyone suggest a workaround?
>> >
>> >
>> >
>> > Much thanks!
>> >
>> > -Adam
>> >
>> >
>> >
>> > from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg as
>> > NavigationToolbar
>> >
>> > class MyNavToolbar(NavigationToolbar):
>> >
>> > def __init__(self, canvas, cpfig):
>> >
>> > NavigationToolbar.__init__(self, canvas)
>> >
>> >
>> >
>> > # override
>> >
>> > def press_pan(self, event):
>> >
>> > 'the press mouse button in pan/zoom mode callback'
>> >
>> >
>> >
>> > if event.button == 1:
>> >
>> > self._button_pressed=1
>> >
>> > elif event.button == 3:
>> >
>> > self._button_pressed=3
>> >
>> > else:
>> >
>> > self._button_pressed=None
>> >
>> > return
>> >
>> >
>> >
>> > x, y = event.x, event.y
>> >
>> >
>> >
>> > # push the current view to define home if stack is empty
>> >
>> > if self._views.empty(): self.push_current()
>> >
>> >
>> >
>> > self._xypress=[]
>> >
>> > for i, a in enumerate(self.canvas.figure.get_axes()):
>> >
>> > # only difference from overridden method is that this one
>> > doesn't
>> >
>> > # check a.in_axes(event)
>> >
>> > if x is not None and y is not None and a.get_navigate():
>> >
>> > a.start_pan(x, y, event.button)
>> >
>> > self._xypress.append((a, i))
>> >
>> > self.canvas.mpl_disconnect(self._idDrag)
>> >
>> >
>> self._idDrag=self.canvas.mpl_connect('motion_notify_event',
>> > self.drag_pan)
>> >
>> >
>> >
>> > def press_zoom(self, event):
>> >
>> > 'the press mouse button in zoom to rect mode callback'
>> >
>> > if event.button == 1:
>> >
>> > self._button_pressed=1
>> >
>> > elif event.button == 3:
>> >
>> > self._button_pressed=3
>> >
>> > else:
>> >
>> > self._button_pressed=None
>> >
>> > return
>> >
>> >
>> >
>> > x, y = event.x, event.y
>> >
>> >
>> >
>> > # push the current view to define home if stack is empty
>> >
>> > if self._views.empty(): self.push_current()
>> >
>> >
>> >
>> > self._xypress=[]
>> >
>> > for i, a in enumerate(self.canvas.figure.get_axes()):
>> >
>> > # only difference from overridden method is that this one
>> > doesn't
>> >
>> > # check a.in_axes(event)
>> >
>> > if x is not None and y is not None and a.get_navigate() and
>> > a.can_zoom():
>> >
>> > self._xypress.append(( x, y, a, i, a.viewLim.frozen(),
>> > a.transData.frozen()))
>> >
>> >
>> >
>> > self.press(event)
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> >
>> >
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>>
>
>
From: Jae-Joon L. <lee...@gm...> - 2010年06月01日 16:34:26
You may use StringIO.
from scipy import *
from pylab import *
from PIL import Image
import cStringIO
a = arange(16384).reshape(128,128)
f = cStringIO.StringIO()
imsave(f, a, cmap=cm.summer,vmin=0,vmax=16383, format="png") # you'd
better set the format explicitly.
f.reset()
b = Image.open(f)
f.close()
IHTH,
-JJ
On Tue, Jun 1, 2010 at 5:18 AM, rugspin <pie...@we...> wrote:
>
>
>
> Angus McMorland-2 wrote:
>>
>> On 31 May 2010 23:17, Angus McMorland <am...@gm...> wrote:
>>
>>> On 31 May 2010 19:49, rugspin <pie...@we...> wrote:
>>>
>>>>
>>>> I have a small problem how to convert an image from matplotlib to PIL
>>>>
>>>> right now doing somthing like this:
>>>> ------------------------------------------
>>>> from scipy import *
>>>> from pylab import *
>>>> from PIL import Image
>>>>
>>>> a = arange(16384).reshape(128,128)
>>>> imsave( "test.png", a, cmap=cm.summer,vmin=0,vmax=16383)
>>>> b = Image.open("test.png" )
>>>> ------------------------------------------
>>>>
>>>
>>> The Image.fromarray function should do what you want. For example,
>>>
>>> import numpy as np  # note: use of "from foo import *"
>>> import Image       # is discouraged where possible
>>>
>>> a = np.arange(128)[None,:] * np.ones(128)[:,None]
>>>
>>
>> Sorry - I was playing around with a few iterations of this line, and
>> didn't
>> provide the most useful one. Your example:
>>
>> a = np.arange(128**2).reshape(128,128)
>>
>> should also work fine.
>>
>>
>>> b = Image.fromarray(a)
>>> c = np.asarray(b)
>>> np.all(c == a)
>>>  -> True
>>>
>>> I hope that helps,
>>>
>>> Angus.
>>>
>>
>> --
>> AJC McMorland
>> Post-doctoral research fellow
>> Neurobiology, University of Pittsburgh
>>
>> ------------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> Thank you Angus
> but that's not exactly what i was looking for. The fromarray function is
> very basic, so I would have to take care of all the RGBA of the array. the
> imshow and imsave functions take care of all that for example adding a
> colormap. After choosing a reasonable colormap (vmin, vmax, ....) I would
> like to convert this into a PIL image.
>
> Best Regard
> Hans
>
> --
> View this message in context: http://old.nabble.com/imshow%2C-imsave-to-PIL-image-conversion-tp28736246p28739401.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: L1011 <yab...@ho...> - 2010年06月01日 16:18:04
Thank you Jae-Joon Lee, it works just fine!
L1011 wrote:
> 
> Hello everyone!
> 
> Here's my first (bout not last) post:
> 
> I'm trying to customize one of my plot and I wondered if there was easy
> way to:
> -set the font size of the legend
> -set the number of markers displayed in the legend. Indeed, I got by
> default to markers showing in my legend and I want to keep only one of
> them.
> 
> Sorry if those questions have already been post, but I could not find
> exactly where.
> 
> L1011.
> 
-- 
View this message in context: http://old.nabble.com/Legend-size-and-markers-tp28738771p28744244.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年06月01日 15:36:14
On Tue, Jun 1, 2010 at 3:58 AM, L1011 <yab...@ho...> wrote:
>
> Hello everyone!
>
> Here's my first (bout not last) post:
>
> I'm trying to customize one of my plot and I wondered if there was easy way
> to:
> -set the font size of the legend
> -set the number of markers displayed in the legend. Indeed, I got by default
> to markers showing in my legend and I want to keep only one of them.
>
> Sorry if those questions have already been post, but I could not find
> exactly where.
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend
Provide following keywords when you call legend.
prop=dict(size=35), numpoints=1
Regards,
-JJ
>
> L1011.
> --
> View this message in context: http://old.nabble.com/Legend-size-and-markers-tp28738771p28738771.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Samuel T. S. <arc...@gm...> - 2010年06月01日 14:30:03
I will prefer update it very soon
thanks for the response
2010年6月1日 John Hunter <jd...@gm...>
> On Tue, Jun 1, 2010 at 9:09 AM, Samuel Teixeira Santos
> <arc...@gm...> wrote:
> > I just want confirm because I new here
> >
> > on my server I have this scpy 0.7.2, numpy 1.4.1, matplotlib 0.99.1.1.
>
> You can, but I recommend upgrading mpl to 0.99.3 or setting
> 'path.simplify : False' in your matplotlibrc because there is a
> serious bug in the path simplification algorithm in 0.99.1 that was
> fixed in 0.99.3. You can work around the bug by turning off
> path.simplify or you can upgrade your mpl.
>
> path.simplify is an rc parameter which can be customized according the
> instructions at
> http://matplotlib.sourceforge.net/users/customizing.html
>
>
> JDH
>
From: John H. <jd...@gm...> - 2010年06月01日 14:22:53
On Tue, Jun 1, 2010 at 9:09 AM, Samuel Teixeira Santos
<arc...@gm...> wrote:
> I just want confirm because I new here
>
> on my server I have this scpy 0.7.2, numpy 1.4.1, matplotlib 0.99.1.1.
You can, but I recommend upgrading mpl to 0.99.3 or setting
'path.simplify : False' in your matplotlibrc because there is a
serious bug in the path simplification algorithm in 0.99.1 that was
fixed in 0.99.3. You can work around the bug by turning off
path.simplify or you can upgrade your mpl.
path.simplify is an rc parameter which can be customized according the
instructions at
http://matplotlib.sourceforge.net/users/customizing.html
JDH
From: Samuel T. S. <arc...@gm...> - 2010年06月01日 14:09:42
I just want confirm because I new here
on my server I have this scpy 0.7.2, numpy 1.4.1, matplotlib 0.99.1.1.
may I keep that?
thanks
2010年6月1日 John Hunter <jd...@gm...>
> On Tue, Jun 1, 2010 at 8:34 AM, Alan G Isaac <ala...@gm...> wrote:
> > On 6/1/2010 9:06 AM, John Hunter wrote:
>
> > For the binaries, what is the recommended NumPy version?
> > I assume the current release (1.4.1)?
>
> Are you on windows? The windows binaries are build against numpy
> 1.3.0 so any and numpy since then should be good since they are
> forward but not backward compatible. At lease that is my
> understanding. The OSX binaries are built against numpy 1.2.1 so any
> numpy after than should work.
>
>
> > (Also wondering, not that it's any of my business, whether the
> > current refactoring project for NumPy has implications for the
> > upcoming MPL 1.0 relase.)
>
> Are you referring to the refactoring to try and make numpy more
> accessible as a C library? That has no implications for 1.0, since
> we are hoping to get that out soon and the numpy project is
> multi-month at least. In any case, mpl 1.0 should be able to be
> compiled against all the recent numpys in the wild.
>
> > PS Btw, it gets said often but once more won't hurt:
> > Matplotlib is wonderful!
>
> Thanks! Jae-Joon Lee, Michael Droettboom, Ryan May, and Eric Firing
> have been doing the heavy lifting on the regular development work, and
> we continue to see lots of fantastic contributions from users. I'm
> just trying to keep up :-) There is really a lot of fantastic stuff
> in the upcoming 1.0 so I look forward to getting that out soon.
>
>
> JDH
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jd...@gm...> - 2010年06月01日 13:56:10
On Tue, Jun 1, 2010 at 8:34 AM, Alan G Isaac <ala...@gm...> wrote:
> On 6/1/2010 9:06 AM, John Hunter wrote:
> For the binaries, what is the recommended NumPy version?
> I assume the current release (1.4.1)?
Are you on windows? The windows binaries are build against numpy
1.3.0 so any and numpy since then should be good since they are
forward but not backward compatible. At lease that is my
understanding. The OSX binaries are built against numpy 1.2.1 so any
numpy after than should work.
> (Also wondering, not that it's any of my business, whether the
> current refactoring project for NumPy has implications for the
> upcoming MPL 1.0 relase.)
Are you referring to the refactoring to try and make numpy more
accessible as a C library? That has no implications for 1.0, since
we are hoping to get that out soon and the numpy project is
multi-month at least. In any case, mpl 1.0 should be able to be
compiled against all the recent numpys in the wild.
> PS Btw, it gets said often but once more won't hurt:
> Matplotlib is wonderful!
Thanks! Jae-Joon Lee, Michael Droettboom, Ryan May, and Eric Firing
have been doing the heavy lifting on the regular development work, and
we continue to see lots of fantastic contributions from users. I'm
just trying to keep up :-) There is really a lot of fantastic stuff
in the upcoming 1.0 so I look forward to getting that out soon.
JDH
From: Tommy G. <tg...@ma...> - 2010年06月01日 13:48:04
On Jun 1, 2010, at 9:34 AM, Alan G Isaac wrote:
> PS Btw, it gets said often but once more won't hurt:
> Matplotlib is wonderful!
I just wanted to second this. Having suffered many years
with super mongo, matplotlib (and python in general) has
made my work so much easier.
Tommy Grav
+----------------------------------------------------------------------------+
Associate Researcher @ Dept. of Physics and Astronomy
Johns Hopkins University
+----------------------------------------------------------------------------+
tg...@ph...
(410) 516-7683
http://web.mac.com/tgrav/Astronomy/Welcome.html
+----------------------------------------------------------------------------+
From: Alan G I. <ala...@gm...> - 2010年06月01日 13:41:44
On 6/1/2010 9:06 AM, John Hunter wrote:
> We have uploaded a bugfix release of the matplotlib-0.99 branch.
> 
For the binaries, what is the recommended NumPy version?
I assume the current release (1.4.1)?
(Also wondering, not that it's any of my business, whether the
current refactoring project for NumPy has implications for the
upcoming MPL 1.0 relase.)
Thanks!
Alan Isaac
PS Btw, it gets said often but once more won't hurt:
Matplotlib is wonderful!

Showing results of 47

1 2 > >> (Page 1 of 2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /