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
(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)



Showing 22 results of 22

From: Russell O. <ro...@uw...> - 2012年02月14日 23:20:22
Yes at some point, but I don't have a git repository for matplotlib yet so it may take me awhile. It's a one-liner as per the posting.
-- Russell
On Feb 14, 2012, at 2:50 PM, Benjamin Root wrote:
> On Tuesday, February 14, 2012, Russell E. Owen <ro...@uw...> wrote:
> > I just created a binary installer for python.org's 64-bit Python 2.7
> > (MacOS X 10.6 and later). I'd like a few folks to test it to make sure
> > it works for more than just me, before serving it at the usual location.
> >
> > The temporary link is:
> > <http://www.astro.washington.edu/users/rowen/python/matplotlib-1.1.0-py2.
> > 7-python.org-macosx10.6.dmg>
> >
> > Thanks to Ned Deily for providing the fix. It turned out to be a known
> > bug in XCode 3.2.6 -- an incorrect symlink -- as described here
> > (including the fix):
> > <https://discussions.apple.com/message/13314424?messageID=13314424>
> > once I fixed that the normal matplotlib build worked perfectly
> > after editing setupext.py to set:
> > 'darwin': ['/usr/local', '/usr/', '/usr/X11'],
> >
> > I recommend that as the default value in future releases of matplotlib
> > because:
> > - It works if using python.org python or Apple's Python
> > - If one is using macports or other such package managers then
> > matplotlib is probably already available -- folks are less likely to
> > build from source.
> >
> > -- Russell
> >
> 
> Can you do a pull request against v1.1.x for these changes?
> 
> Thanks!
> Ben Root
From: Benjamin R. <ben...@ou...> - 2012年02月14日 22:50:20
On Tuesday, February 14, 2012, Russell E. Owen <ro...@uw...> wrote:
> I just created a binary installer for python.org's 64-bit Python 2.7
> (MacOS X 10.6 and later). I'd like a few folks to test it to make sure
> it works for more than just me, before serving it at the usual location.
>
> The temporary link is:
> <http://www.astro.washington.edu/users/rowen/python/matplotlib-1.1.0-py2.
> 7-python.org-macosx10.6.dmg>
>
> Thanks to Ned Deily for providing the fix. It turned out to be a known
> bug in XCode 3.2.6 -- an incorrect symlink -- as described here
> (including the fix):
> <https://discussions.apple.com/message/13314424?messageID=13314424>
> once I fixed that the normal matplotlib build worked perfectly
> after editing setupext.py to set:
> 'darwin': ['/usr/local', '/usr/', '/usr/X11'],
>
> I recommend that as the default value in future releases of matplotlib
> because:
> - It works if using python.org python or Apple's Python
> - If one is using macports or other such package managers then
> matplotlib is probably already available -- folks are less likely to
> build from source.
>
> -- Russell
>
Can you do a pull request against v1.1.x for these changes?
Thanks!
Ben Root
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
Martin Mokrejs wrote:
> Hi,
> the below code works for me but in case there are few values to be rendered
> it chokes (I think this is the culprit or maybe one of the values isn't unique
> in those input lists?):
> 
> 
> pylab.clf()
> if longlegends:
> F.set_size_inches( (DefaultSize[0], DefaultSize[1]*2.5) )
> 
> _e = []
> _ee = []
> _eee = []
> for _name in _unique_names:
> _d = []
> for _i, _name2, _position in zip(range(len(_matching[1])), _matching[1], _matching[11]):
> if _name == _name2:
> _d.append(_matching[11][_i])
> _c = _colors_for_unique_names[_name]
> _l = _name
> if _d:
> _e.append(_d)
> _ee.append(_c)
> _eee.append(_l)
> 
> if longlegends:
> pylab.subplot(211)
> params = {'legend.fontsize': 8}
> pylab.rcParams.update(params)
> 
> pylab.hist(_e, bins=50, histtype='barstacked', align='mid', color=_ee, log=False, label=_eee)
> pylab.title("some title")
> pylab.xlabel("... position")
> pylab.ylabel("Occurrence ... (barstacked)")
> pylab.ylim(ymin=0)
> pylab.xlim(xmin=0, xmax=1200)
> if longlegends:
> pylab.legend(loc='upper left', bbox_to_anchor = (-0.15, -0.1), ncol=2)
> F.savefig(prefix + ".png", dpi=100)
> else:
> F.savefig(prefix + ".png", dpi=100)
> 
> 
> F.savefig(prefix + ".png", dpi=100)
> File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1172, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 2017, in print_figure
> **kwargs)
> File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 103, in print_png
> return agg.print_png(filename, *args, **kwargs)
> File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 445, in print_png
> FigureCanvasAgg.draw(self)
> File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw
> self.renderer = self.get_renderer()
> File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 411, in get_renderer
> self.renderer = RendererAgg(w, h, self.figure.dpi)
> File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 59, in __init__
> self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
> ValueError: width and height must each be below 32768
> 
> 
> Could anybody make something out of the error message? I tried NOT to specify
> bins=50 but that does not help. I have matplotlib-1.1.0. Thanks for any clues,
> Martin
> BTW: The ugly for loop I had to introduce because I could simply pass nested lists
> with data values and color to pylab.hist().
> 
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
From: Russell E. O. <ro...@uw...> - 2012年02月14日 21:43:06
I just created a binary installer for python.org's 64-bit Python 2.7 
(MacOS X 10.6 and later). I'd like a few folks to test it to make sure 
it works for more than just me, before serving it at the usual location.
The temporary link is:
<http://www.astro.washington.edu/users/rowen/python/matplotlib-1.1.0-py2.
7-python.org-macosx10.6.dmg>
Thanks to Ned Deily for providing the fix. It turned out to be a known 
bug in XCode 3.2.6 -- an incorrect symlink -- as described here 
(including the fix):
<https://discussions.apple.com/message/13314424?messageID=13314424>
once I fixed that the normal matplotlib build worked perfectly
after editing setupext.py to set:
 'darwin': ['/usr/local', '/usr/', '/usr/X11'],
I recommend that as the default value in future releases of matplotlib 
because:
- It works if using python.org python or Apple's Python
- If one is using macports or other such package managers then 
matplotlib is probably already available -- folks are less likely to 
build from source.
-- Russell
Hi,
 the below code works for me but in case there are few values to be rendered
it chokes (I think this is the culprit or maybe one of the values isn't unique
in those input lists?):
 pylab.clf()
 if longlegends:
 F.set_size_inches( (DefaultSize[0], DefaultSize[1]*2.5) )
 _e = []
 _ee = []
 _eee = []
 for _name in _unique_names:
 _d = []
 for _i, _name2, _position in zip(range(len(_matching[1])), _matching[1], _matching[11]):
 if _name == _name2:
 _d.append(_matching[11][_i])
 _c = _colors_for_unique_names[_name]
 _l = _name
 if _d:
 _e.append(_d)
 _ee.append(_c)
 _eee.append(_l)
 if longlegends:
 pylab.subplot(211)
 params = {'legend.fontsize': 8}
 pylab.rcParams.update(params)
 pylab.hist(_e, bins=50, histtype='barstacked', align='mid', color=_ee, log=False, label=_eee)
 pylab.title("some title")
 pylab.xlabel("... position")
 pylab.ylabel("Occurrence ... (barstacked)")
 pylab.ylim(ymin=0)
 pylab.xlim(xmin=0, xmax=1200)
 if longlegends:
 pylab.legend(loc='upper left', bbox_to_anchor = (-0.15, -0.1), ncol=2)
 F.savefig(prefix + ".png", dpi=100)
 else:
 F.savefig(prefix + ".png", dpi=100)
 F.savefig(prefix + ".png", dpi=100)
 File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1172, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 2017, in print_figure
 **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 103, in print_png
 return agg.print_png(filename, *args, **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 445, in print_png
 FigureCanvasAgg.draw(self)
 File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw
 self.renderer = self.get_renderer()
 File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 411, in get_renderer
 self.renderer = RendererAgg(w, h, self.figure.dpi)
 File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 59, in __init__
 self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
ValueError: width and height must each be below 32768
 Could anybody make something out of the error message? I tried NOT to specify
bins=50 but that does not help. I have matplotlib-1.1.0. Thanks for any clues,
Martin
BTW: The ugly for loop I had to introduce because I could simply pass nested lists
with data values and color to pylab.hist().
From: Russell E. O. <ro...@uw...> - 2012年02月14日 21:34:06
In article <201...@we...>,
 "Full Name" <7s...@ex...> wrote:
> Hello,
> 
> Mac OSX 10.6.8
> matplotlib 1.1.0
> 
> 
> From the matplotlib website:
> =========
> Installing OSX binaries
> If you want to install matplotlib from one of the binary installers we build, 
> you have two choices: a mpkg installer, which is a typical Installer.app, or 
> a binary OSX egg, which you can install via setuptools’ easy_install.
> 
> The mkpg installer will have a “zip” extension, and will have a name like 
> matplotlib-0.99.0.rc1-py2.5-macosx10.5_mpkg.zip. 
> ==========
> 
> Where are those files? I can't find them anywhere.
> 
> Also from the matplotlib website:
> =======
> You can also use the eggs we build for OSX (see the installation instructions 
> for easy_install if you do not have it on your system already). You can try:
> 
> > easy_install matplotlib
> which should grab the latest egg from the sourceforge site, but sometimes the 
> naming conventions for OSX eggs can be broken (see below). Therefore, there 
> is no guarantee the right egg will be found. We recommend you download the 
> latest egg from our download site directly to your harddrive, and manually 
> install it, eg:
> 
> > easy_install --install-dir=~/dev/lib/python2.5/site-packages/ 
> > matplotlib-0.99.0.rc1-py2.5-macosx-10.5-i386.egg
> =======
> 
> Where are those eggs? I can't find them anywhere.
> 
> On the home page of the matplotlib website, on the right hand side, is a link 
> "downloads", which took me here:
> 
> http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/
> 
> There isn't anything later than osx 10.3 there, and there are no egg files at 
> all. Yet the install directions mention osx10.5. 
> 
> I installed python 2.7, which automatically installed an interpreter named 
> python2.7, because the Numpy installer I found was for python 2.7 and mac osx 
> 10.6. I installed this for matplotlib:
> 
> matplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg
>...
There are no Mac eggs for the current version of matplotlib. The 
references to them are obsolete.
The file you found is the only option for MacOS X (presently). It 
requires python.org's 32-bit Python 2.7, which is for MacOS X 10.3.9 and 
later.
I just built an installer for python.org's 64-bit Python 2.7, which 
requires MacOS X 10.6 and after a bit of testing I'll serve that.
-- Russell
From: <ole...@gm...> - 2012年02月14日 17:49:51
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
From: <de...@ve...> - 2012年02月14日 16:43:48
...Earn money right from your computer. http://ponto.kelly-systems.com.br/job.link.php?gid_friend=78u5
 ------------------------------
 Sent using Verizon.net Mobile
From: Jerzy K. <jer...@un...> - 2012年02月14日 16:39:27
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.
Jerzy Karczmarczuk
From: Tony Yu <ts...@gm...> - 2012年02月14日 16:29:50
On Tue, Feb 14, 2012 at 10:33 AM, Olе Streicher <ole...@gm...>wrote:
> Tony Yu <ts...@gm...> writes:
> > Does the following do what you need?
> >
> > #----
> > import numpy as np
> > import matplotlib.pyplot as plt
> >
> > width = 0.5
> > height = 10
> >
> > for x in np.arange(11):
> > strip = np.random.random(size=(50, 1))
> > plt.imshow(strip, extent=(x-width/2, x+width/2, 0, height))
> >
> > plt.xlim(-width, x+width)
> >
> > plt.show()
> > #----
>
> Not completely since it requires an equally spaced "strip". I have two
> vectors (one for the vertical axis, one for the data).
>
> Best regards
>
> Ole
>
>
I'm not sure what you mean by equally spaced strip. If you need to scale
the height, you can just calculate it as from the length of the strip. If
you mean the placement of the strips, you can substitue the x values above
with your data instead of the `arange` call---you'd have to appropriately
scale `width` so that matches your x-spacing.
-Tony
From: Jerzy K. <jer...@un...> - 2012年02月14日 15:55:17
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.
BTW, I did not understand why do you play with your "angle" = 
arctan(...), then compute sin and cos, etc. Two issues.
1. You are wasting your time.
2. If your data is a functional sequence, with x growing, its OK, but 
for ANY data you may get zero in the denominator, and your arctan will 
locally explode, producing holes in the plotted data. Use arctan2. Or 
rather, don't compute angles at all.
Concerning 1.
If you compute dx = xhigh-xlow; dy=yhigh-ylow;
then the parameters of a normal offset are (nx,ny) = (-dy,dx), 
appropriately normalized, and that's all.
All the best.
Jerzy
From: Andrea G. <and...@gm...> - 2012年02月14日 15:42:33
Hi Jerzy,
On 14 February 2012 16:03, Jerzy Karczmarczuk wrote:
> Andrea Gavana :
>> after some great help from the Numpy users list, I have managed to
>> create "parallel curves".
>>
>>
>> But I can't really do that with the set of data I have, as the X and Y
>> variables have different order of magnitude and I need a single
>> subplot on the figure to have rectangular axes (not square).
> (...)
>> So, my question would be: how do I scale the
>> X and Y vectors so that the parallels look parallel to the main curve
>> even if the axes are not square and the X and Y variables have
>> different data-ranges/magnitudes?
> Andrea, you have TWO problems.
>
> The first is to scale your offset according to your axes range. This can
> be done using ax.get_data_ratio(). In your case you will get 5, and this
> factor should enhance your vertical offset wrt. the horizontal.
> (Or, use .get_xlim() and .get_ylim() and do the computations yourself).
Thank you for your answer, I have implemented this and it looks a bit
better (on the real X/Y pairs I have).
> The second problem is that your FIGURE scales your plot visually,
> independently of your axes, so without special scaling it will have
> different aspects according to your manipulation. An arbitrary affine
> transform will keep straight lines parallel, but no chance with
> arbitrary curves. You may play with fig.get_figwidth(), etc., but here
> my digging stops.
Will this argument still stand if I am only interested in a single
figure size (maximized window on my screen, plus set_size_inches(20,
12)) and fixed axes positions (set by figure.subplots_adjust)? If not,
should the further scaling simply be the ratio between the x-axis
extent and y-axis extent (in pixels)? Or am I missing something
(again)?
Thank you in advance for your suggestions.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
From: <ole...@gm...> - 2012年02月14日 15:34:05
Tony Yu <ts...@gm...> writes:
> Does the following do what you need?
>
> #----
> import numpy as np
> import matplotlib.pyplot as plt
>
> width = 0.5
> height = 10
>
> for x in np.arange(11):
>   strip = np.random.random(size=(50, 1))
>   plt.imshow(strip, extent=(x-width/2, x+width/2, 0, height))
>
> plt.xlim(-width, x+width)
>
> plt.show()
> #----
Not completely since it requires an equally spaced "strip". I have two
vectors (one for the vertical axis, one for the data).
Best regards
Ole
From: Tony Yu <ts...@gm...> - 2012年02月14日 15:30:32
On Tue, Feb 14, 2012 at 9:48 AM, Olе Streicher <ole...@gm...>wrote:
> Hi list,
>
> I have a list of 48 individual data sets (lambda,y) which I want to plot in
> the following diagram:
>
> lambda
> ^
> |
> |
> |
> |
> +--------------->
> 1 2 3 4 5 6 .. Dataset #
>
> The "y" values should be color coded here, in a similar fashion as it is
> done in a color bar (f.e. that I can interpolate between data points).
>
> Practically, I want to have 48 vertical color bars here, all with the
> same scaling. From the documentation, I could not find out how to do
> this; and also I could not find a good example for this.
>
> Could anyone help me here?
>
> Best
>
> Ole
>
>
>
Does the following do what you need?
#----
import numpy as np
import matplotlib.pyplot as plt
width = 0.5
height = 10
for x in np.arange(11):
 strip = np.random.random(size=(50, 1))
 plt.imshow(strip, extent=(x-width/2, x+width/2, 0, height))
plt.xlim(-width, x+width)
plt.show()
#----
-Tony
From: Jerzy K. <jer...@un...> - 2012年02月14日 15:03:20
Andrea Gavana :
> after some great help from the Numpy users list, I have managed to
> create "parallel curves".
>
>
> But I can't really do that with the set of data I have, as the X and Y
> variables have different order of magnitude and I need a single
> subplot on the figure to have rectangular axes (not square).
(...)
> So, my question would be: how do I scale the
> X and Y vectors so that the parallels look parallel to the main curve
> even if the axes are not square and the X and Y variables have
> different data-ranges/magnitudes?
Andrea, you have TWO problems.
The first is to scale your offset according to your axes range. This can 
be done using ax.get_data_ratio(). In your case you will get 5, and this 
factor should enhance your vertical offset wrt. the horizontal.
(Or, use .get_xlim() and .get_ylim() and do the computations yourself).
The second problem is that your FIGURE scales your plot visually, 
independently of your axes, so without special scaling it will have 
different aspects according to your manipulation. An arbitrary affine 
transform will keep straight lines parallel, but no chance with 
arbitrary curves. You may play with fig.get_figwidth(), etc., but here 
my digging stops.
Good luck.
Jerzy Karczmarczuk
From: Mark L. <bre...@ya...> - 2012年02月14日 15:00:16
On 14/02/2012 13:52, Debashish Saha wrote:
> import numpy
>
> from enthought.mayavi import mlab
>
> #def test_mesh():
> #"""A very pretty picture of spherical harmonics translated from
>
> #the octaviz example."""
> for r in range (1,5):
> print r
>
>
> pi = numpy.pi
>
> cos = numpy.cos
>
> sin = numpy.sin
>
> dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01
>
> #[phi,theta] = numpy.mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
> [phi,z] = numpy.mgrid[0:2*pi+dphi*1.5:dphi,0:2+dz*1.5:dz]
>
> m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
>
> # r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + 5*sin(m4*theta)**m5 +
> cos(m6*theta)**m7
>
> #x = 1*sin(phi)*cos(theta)
>
> #y = 1*sin(phi)*sin(theta)
>
> #z = 1*cos(phi);
> x=r*cos(phi)
> y=r*sin(phi)
> z=z
> i=['Reds','greens','autumn','purples']
> print i[r-1]
> e=i[r-1]
>
> mlab.mesh(x, y, z,colormap='e')
> #print i[r-1]
>
> Error:
> TypeError Traceback (most recent call last)
> C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in
> execfile(fname, glob, loc)
> 166 else:
> 167 filename = fname
> --> 168 exec compile(scripttext, filename, 'exec') in glob, loc
> 169 else:
> 170 def execfile(fname, *where):
>
> C:\Users\as\jhgf.py in<module>()
> 24 print i[r-1]
> 25 e=i[r-1]
> ---> 26 mlab.mesh(x, y, z,'e')
> 27 #print i[r-1]
>
> 28
>
> C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
> the_function(*args, **kwargs)
> 32 def document_pipeline(pipeline):
> 33 def the_function(*args, **kwargs):
> ---> 34 return pipeline(*args, **kwargs)
> 35
> 36 if hasattr(pipeline, 'doc'):
>
> C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
> __call__(self, *args, **kwargs)
> 77 scene.disable_render = True
> 78 # Then call the real logic
>
> ---> 79 output = self.__call_internal__(*args, **kwargs)
> 80 # And re-enable the rendering, if needed.
>
> 81 if scene is not None:
>
> C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
> __call_internal__(self, *args, **kwargs)
> 830 filters.
> 831 """
> --> 832 self.source = self._source_function(*args, **kwargs)
> 833 kwargs.pop('name', None)
> 834 self.store_kwargs(kwargs)
>
> TypeError: grid_source() takes exactly 3 arguments (4 given)
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just 99ドル.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
Didn't this get answered on the python tutor mailing list within the 
last couple of hours? What's with it with you?
-- 
Cheers.
Mark Lawrence.
From: <ole...@gm...> - 2012年02月14日 14:49:05
Hi list,
I have a list of 48 individual data sets (lambda,y) which I want to plot in
the following diagram:
lambda
^ 
|
|
|
|
+--------------->
 1 2 3 4 5 6 .. Dataset #
The "y" values should be color coded here, in a similar fashion as it is
done in a color bar (f.e. that I can interpolate between data points).
Practically, I want to have 48 vertical color bars here, all with the
same scaling. From the documentation, I could not find out how to do
this; and also I could not find a good example for this.
Could anyone help me here?
Best
Ole
From: Debashish S. <sil...@gm...> - 2012年02月14日 13:52:40
import numpy
from enthought.mayavi import mlab
#def test_mesh():
#"""A very pretty picture of spherical harmonics translated from
#the octaviz example."""
for r in range (1,5):
 print r
 pi = numpy.pi
 cos = numpy.cos
 sin = numpy.sin
 dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01
 #[phi,theta] = numpy.mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
 [phi,z] = numpy.mgrid[0:2*pi+dphi*1.5:dphi,0:2+dz*1.5:dz]
 m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
 # r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + 5*sin(m4*theta)**m5 +
cos(m6*theta)**m7
 #x = 1*sin(phi)*cos(theta)
 #y = 1*sin(phi)*sin(theta)
 #z = 1*cos(phi);
 x=r*cos(phi)
 y=r*sin(phi)
 z=z
 i=['Reds','greens','autumn','purples']
 print i[r-1]
 e=i[r-1]
 mlab.mesh(x, y, z,colormap='e')
 #print i[r-1]
Error:
TypeError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in
execfile(fname, glob, loc)
 166 else:
 167 filename = fname
--> 168 exec compile(scripttext, filename, 'exec') in glob, loc
 169 else:
 170 def execfile(fname, *where):
C:\Users\as\jhgf.py in <module>()
 24 print i[r-1]
 25 e=i[r-1]
---> 26 mlab.mesh(x, y, z,'e')
 27 #print i[r-1]
 28
C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
the_function(*args, **kwargs)
 32 def document_pipeline(pipeline):
 33 def the_function(*args, **kwargs):
---> 34 return pipeline(*args, **kwargs)
 35
 36 if hasattr(pipeline, 'doc'):
C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
__call__(self, *args, **kwargs)
 77 scene.disable_render = True
 78 # Then call the real logic
---> 79 output = self.__call_internal__(*args, **kwargs)
 80 # And re-enable the rendering, if needed.
 81 if scene is not None:
C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in
__call_internal__(self, *args, **kwargs)
 830 filters.
 831 """
--> 832 self.source = self._source_function(*args, **kwargs)
 833 kwargs.pop('name', None)
 834 self.store_kwargs(kwargs)
TypeError: grid_source() takes exactly 3 arguments (4 given)
From: Scott S. <sco...@gm...> - 2012年02月14日 13:18:25
On 14 February 2012 14:23, <a....@ya...> wrote:
> I have already installed scipy , numpy & python 2.6.6. Also , I installed
> matplotlip from its website. I strongly need basemap toolkits but when I try
> to install it I cannot do that always I got error massage or command cannot
> found. So could you please help me to get it. NB: I use mac OS X 10.6.8
I'm replying on list (I accidentally replied directly to you).
You'll need to be far more specific about the steps you are taking to
try and install Basemap and what the error message says.
> ‏من جهاز الـ iPhone الخاص بي
>
> في 14/02/2012، الساعة 2:48 AM، كتب Scott Sinclair
> <sco...@gm...>:
>
> Hi Fadhah,
>
> If you'd like someone to help. You'll need to explain in more detail, what
> steps you're trying and what's going wrong.
>
> Cheers,
> Scott
>
> On Feb 13, 2012 5:44 PM, "love ali" <a....@ya...> wrote:
>>
>> Dear all,
>>
>> I use the mac OS X 10.6.8 and I try to install the matplotlib but I cannot
>> run it in my computer so could you please help me?
>>
>>
>> Thanks,
>>
>> Fadhah
This is relating wxmpl (wxPython+matplotlib). version 2.0dev of wxmpl,
matplotlib ver 1.1.0, and wx version is 2.8.12.1.
Since wxmpl is a very "thin" layer above mpl, I believe this is an issue
with mpl.
I'm using wxmpl and trying to get mouse points and selection. This
fails when there is more than one axes in the same place, which I do
since I'm using twinx() in my original code.
I believe the issue is the overlapping of both axes on the same area.
The following code shows that overlapping two axes makes
the mouse events in the overlapped area fail. For example, the cursor
doesn't change in them and the crosshairs disappear (if enabled).
Removing the ax2 code, or just ensuring ax1 and ax2 do not overlap
allows all the events to reach the handler.
Any idea on how to receive mouse events from the overlapped area?
Thanks,
Oren
----------------------------------------------------
import wxmpl
if __name__ == '__main__':
 class MainWindow(wx.Frame):
 def __init__(self):
 wx.Frame.__init__(self, parent=None, title='Graph Test',
size=(700,700))
 self.plot = wxmpl.PlotPanel(self, -1, dpi=70)
 fig = self.plot.get_figure()
 ax1 = fig.add_axes((0.1, 0.1, .6, .6))
 ax1.plot([0,3], [-1,1])
 ax2 = fig.add_axes( (0.3, 0.3, .6, .6) )
 ax2.plot([2,4], [-10,10])
 wxmpl.EVT_POINT(self.plot, -1, self.handle_event)
 self.Show()
 def handle_event(self, event):
 print event, event.GetId()
 app = wx.App()
 mw = MainWindow()
 app.MainLoop()
From: Andrea G. <and...@gm...> - 2012年02月14日 08:48:15
Attachments: sample_buffer.py
Hi All,
 after some great help from the Numpy users list, I have managed to
create "parallel curves".
Basically I have a set of X, Y data (around 1,000 elements each) and I
want to create 2 parallel "curves" (offset curves) to the original
one; "parallel" means curves which are displaced from the base curve
by a constant offset, either positive or negative, in the direction of
the curve's normal. I attach a sample demonstrating what I am doing
(and if you have the Shapely package installed, the two additional
subplots look even nicer).
Now, the generated parallels are really parallels (see right subplot),
but visually it doesn't seem so (see the left subplot) because the X
and Y scales are different and the axes area is not square. I know I
could force the axes to be equals via:
ax.set_aspect('equal', 'datalim')
But I can't really do that with the set of data I have, as the X and Y
variables have different order of magnitude and I need a single
subplot on the figure to have rectangular axes (not square). In my
situation, unfortunately it wouldn't make sense to set the axes
square/equal as the plot will lose its meaning and visual usefulness.
I have been told to scale the X, Y variables normalizing them by the
display units of the plot, but I must be dumber than usual as I can't
get it to work properly. So, my question would be: how do I scale the
X and Y vectors so that the parallels look parallel to the main curve
even if the axes are not square and the X and Y variables have
different data-ranges/magnitudes?
Thank you in advance for your suggestions.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
From: Full N. <7s...@ex...> - 2012年02月14日 03:35:55
Hello,
Mac OSX 10.6.8
matplotlib 1.1.0
>From the matplotlib website:
=========
Installing OSX binaries
If you want to install matplotlib from one of the binary installers we build, you have two choices: a mpkg installer, which is a typical Installer.app, or a binary OSX egg, which you can install via setuptools’ easy_install.
The mkpg installer will have a "zip" extension, and will have a name like matplotlib-0.99.0.rc1-py2.5-macosx10.5_mpkg.zip. 
==========
Where are those files? I can't find them anywhere.
Also from the matplotlib website:
=======
You can also use the eggs we build for OSX (see the installation instructions for easy_install if you do not have it on your system already). You can try:
> easy_install matplotlib
which should grab the latest egg from the sourceforge site, but sometimes the naming conventions for OSX eggs can be broken (see below). Therefore, there is no guarantee the right egg will be found. We recommend you download the latest egg from our download site directly to your harddrive, and manually install it, eg:
> easy_install --install-dir=~/dev/lib/python2.5/site-packages/ matplotlib-0.99.0.rc1-py2.5-macosx-10.5-i386.egg
=======
Where are those eggs? I can't find them anywhere.
On the home page of the matplotlib website, on the right hand side, is a link "downloads", which took me here:
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/
There isn't anything later than osx 10.3 there, and there are no egg files at all. Yet the install directions mention osx10.5. 
I installed python 2.7, which automatically installed an interpreter named python2.7, because the Numpy installer I found was for python 2.7 and mac osx 10.6. I installed this for matplotlib:
matplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg
because that is the only thing even close.
This works:
import matplotlib
print(matplotlib.__version__)
print(matplotlib.__file__)
$ python2.7 my_prog.py
1.1.0
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc
/Users/Me/.matplotlib
But this does not work:
import matplotlib.pyplot as plot
xs = [2, 3, 5, 7, 11]
ys = [4, 9, 5, 9, 1]
plot.plot(xs, ys)
plot.savefig("squaremod10.png")
$ python2.7 my_prog.py
 File "my_prog.py", line 1, in <module>
 import matplotlib.pyplot as plot
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 23, in <module>
 from matplotlib.figure import Figure, figaspect
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 16, in <module>
 import artist
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 6, in <module>
 from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 34, in <module>
 from matplotlib._path import affine_transform
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, 2): no suitable image found. Did find:
	/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: no matching architecture in universal wrapper

Showing 22 results of 22

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 によって変換されたページ (->オリジナル) /