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
2
(13)
3
(5)
4
(5)
5
(21)
6
(10)
7
(9)
8
(4)
9
(11)
10
(9)
11
(11)
12
(25)
13
(5)
14
(2)
15
(5)
16
(8)
17
(16)
18
(11)
19
(15)
20
(5)
21
(8)
22
(4)
23
(24)
24
(9)
25
(14)
26
(5)
27
(28)
28
(2)
29
(13)
30
(14)
31
(11)




Showing results of 319

1 2 3 .. 13 > >> (Page 1 of 13)
From: Tony Yu <ts...@gm...> - 2012年01月31日 21:54:06
On Tue, Jan 31, 2012 at 12:56 PM, Petro Khoroshyy <kho...@gm...>wrote:
> Hi all
> I try to use matplotlib ti anotate some pictures.
> I wanted to combine two pictures into one using subplot. But apparently
> subplot does not work with images. How can I do it?
> Thanks
>
> P.S. Here is the source:
> import pylab
> import numpy
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib import rcParams
> golden_mean = (numpy.sqrt(5)-1.0)/2.0 # Aesthetic ratio
> fig_width = 5.6 # width in inches
> fig_height = fig_width*golden_mean # height in inches
> fig_size = [fig_width,fig_height]
> rcParams['figure.figsize']=fig_width, fig_width
> rcParams['figure.dpi']=300
> rcParams['mathtext.default']='regular'
> rcParams['xtick.labelsize']=8
> rcParams['ytick.labelsize']=8
> pylab.rc('font', family='serif')
> pylab.rc('font', serif='Times New Roman')
> pylab.rc('text', usetex='false')
> pyp=mpimg.imread('/home/petro/mydoc/thesis/ready_pictures/pyp.jpg')
> fig=pylab.figure(facecolor="white")
> fig.subplots_adjust(top=0.95)
> fig.subplots_adjust(bottom=0.05)
> fig.subplots_adjust(left=0.05)
> fig.subplots_adjust(right=0.95)
> ax_left=fig.add_subplot(121)
> ax_left = pylab.axes(frameon=False)
> ax_left.set_axis_off()
> ax_left.imshow(pyp, origin='lower')
> plt.text(821, 707, r'$\beta _1$', {'color' : 'k', 'fontsize' : 12})
> pylab.savefig("pylab_pyp.png")
>
> --
> Petro.
>
>
Hi Petro,
I think the problem is that you create a subplot (...`add_subplot`...) and
then override it (...`pylab.axes`...). Remove the call to axes and you
should be set.
-Tony
From: Eric P. <epe...@in...> - 2012年01月31日 20:34:10
I1m using python-3.2.2 with matplotlib 1.1.0 (from the py3 fork). I
attempted a simple plotting test, and I get a blank Figure window together
with the error messages below. I suspect that I haven1t got matplotlib and
tk/tcl setup properly, but I1m not sure how to track down the issue.
TIA,
Eric
$ ipython3 --pylab
Python 3.2.2 (default, Dec 5 2011, 12:00:35)
Type "copyright", "credits" or "license" for more information.
IPython 0.11 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Welcome to pylab, a matplotlib-based Python environment [backend: TkAgg].
For more information, type 'help(pylab)'.
In [1]: y = pylab.linspace( 0, 1, 10 )
In [2]: pylab.plot( y )
Exception in Tkinter callback
Traceback (most recent call last):
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/tka
gg.py", line 13, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
_tkinter.TclError: invalid command name "PyAggImagePhoto"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "tkinter/__init__.py", line 1399, in __call__
 return self.func(*args)
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/bac
kend_tkagg.py", line 236, in resize
 self.show()
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/bac
kend_tkagg.py", line 240, in draw
 tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/tka
gg.py", line 20, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
_tkinter.TclError
Out[2]: [<matplotlib.lines.Line2D at 0xed73e02c>]
In [3]: Exception in Tkinter callback
Traceback (most recent call last):
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/tka
gg.py", line 13, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
_tkinter.TclError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
 File "tkinter/__init__.py", line 1399, in __call__
 return self.func(*args)
 File "tkinter/__init__.py", line 487, in callit
 func(*args)
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/bac
kend_tkagg.py", line 254, in idle_draw
 self.draw()
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/bac
kend_tkagg.py", line 240, in draw
 tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
 File 
"/usr/local/python-3.2.2/lib/python3.2/site-packages/matplotlib/backends/tka
gg.py", line 20, in blit
 tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
id(bbox_array))
_tkinter.TclError
From: Petro K. <kho...@gm...> - 2012年01月31日 20:25:19
Hi all
I try to use matplotlib ti anotate some pictures.
I wanted to combine two pictures into one using subplot. But apparently
subplot does not work with images. How can I do it?
Thanks
P.S. Here is the source:
import pylab 
import numpy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams 
golden_mean = (numpy.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = 5.6 # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height]
rcParams['figure.figsize']=fig_width, fig_width
rcParams['figure.dpi']=300
rcParams['mathtext.default']='regular'
rcParams['xtick.labelsize']=8
rcParams['ytick.labelsize']=8
pylab.rc('font', family='serif')
pylab.rc('font', serif='Times New Roman')
pylab.rc('text', usetex='false')
pyp=mpimg.imread('/home/petro/mydoc/thesis/ready_pictures/pyp.jpg')
fig=pylab.figure(facecolor="white")
fig.subplots_adjust(top=0.95)
fig.subplots_adjust(bottom=0.05)
fig.subplots_adjust(left=0.05)
fig.subplots_adjust(right=0.95)
ax_left=fig.add_subplot(121)
ax_left = pylab.axes(frameon=False)
ax_left.set_axis_off()
ax_left.imshow(pyp, origin='lower')
plt.text(821, 707, r'$\beta _1$', {'color' : 'k', 'fontsize' : 12})
pylab.savefig("pylab_pyp.png") 
-- 
Petro.
From: Benjamin R. <ben...@ou...> - 2012年01月31日 20:13:23
On Tue, Jan 31, 2012 at 2:01 PM, Serhat Sevki Dincer <jfc...@gm...>wrote:
> Hi,
>
> I have just installed the latest Numpy-1.6, Scipy-0.10 and
> matplotlib-1.1 from github on my ubuntu 11.04 i386 laptop.
> numpy and scipy tests pass, but matplotlib tests fail with two errors.
> Attaching the related files..
>
> What could be wrong?
>
>
Thanks for the heads-up. Looking through the results, there shouldn't be
any concern on your part.
I can not see any immediately obvious difference for the imshow failure.
It is likely a off-by-one-pixel error or some sort of "snapping" issue.
As for the polar-wrap failure, it appears that we accidentially saved a bad
image into the test suite. The "expected" image shows an outline around
the plot points, but your image does not. This was a bug that cropped up
and was later fixed. I guess we have to replace that image.
Cheers!
Ben Root
From: Serhat S. D. <jfc...@gm...> - 2012年01月31日 20:01:43
Attachments: mpl_fail.tar.xz
Hi,
I have just installed the latest Numpy-1.6, Scipy-0.10 and
matplotlib-1.1 from github on my ubuntu 11.04 i386 laptop.
numpy and scipy tests pass, but matplotlib tests fail with two errors.
Attaching the related files..
What could be wrong?
From: Benjamin R. <ben...@ou...> - 2012年01月31日 16:38:43
On Tue, Jan 31, 2012 at 10:05 AM, BG <bar...@gm...> wrote:
> Here are the outputs from running a basemap test and a test from the
> matplotlib examples. Thank you for your help.
>
> TEST FROM MATPLOTLIB EXAMPLES:
>
> ~/Downloads/matplotlib-1.1.0/examples/axes_grid$ python simple_axesgrid.py
> Traceback (most recent call last):
> File "simple_axesgrid.py", line 2, in <module>
> from mpl_toolkits.axes_grid1 import ImageGrid
> ImportError: No module named axes_grid1
>
> TEST FROM BASEMAP EXAMPLES:
>
> ~/Downloads/basemap-1.0.2/examples$ python simpletest.py
> Traceback (most recent call last):
> File "simpletest.py", line 1, in <module>
> from mpl_toolkits.basemap import Basemap
> File
> "/usr/local/lib/python2.6/dist-packages/mpl_toolkits/basemap/__init__.py",
> line 31, in <module>
> from mpl_toolkits.axes_grid1 import make_axes_locatable
> ImportError: No module named axes_grid1
>
> BG
>
As Jae-Joon mentioned, Ubuntu 10.04 has v0.99.1 from the repositories. I
thought you were saying that the tests that come with the package were
failing. Instead, it looks like you downloaded/extracted the tarball and
were trying the examples in it. Those examples from v1.1.0 require the mpl
v1.1.0. Also that version of basemap also requires at least mpl v1.0.x
(IIRC). Either use an earlier version of basemap from the repositories, or
install from source (information on how to do that is available in the FAQ
section of the online documentation).
Ben Root
From: BG <bar...@gm...> - 2012年01月31日 16:05:42
Here are the outputs from running a basemap test and a test from the matplotlib examples. Thank you for your help.
TEST FROM MATPLOTLIB EXAMPLES:
~/Downloads/matplotlib-1.1.0/examples/axes_grid$ python simple_axesgrid.py
Traceback (most recent call last):
 File "simple_axesgrid.py", line 2, in <module>
 from mpl_toolkits.axes_grid1 import ImageGrid
ImportError: No module named axes_grid1
TEST FROM BASEMAP EXAMPLES:
~/Downloads/basemap-1.0.2/examples$ python simpletest.py
Traceback (most recent call last):
 File "simpletest.py", line 1, in <module>
 from mpl_toolkits.basemap import Basemap
 File "/usr/local/lib/python2.6/dist-packages/mpl_toolkits/basemap/__init__.py", line 31, in <module>
 from mpl_toolkits.axes_grid1 import make_axes_locatable
ImportError: No module named axes_grid1
BG
On Jan 31, 2012, at 10:06 AM, Benjamin Root wrote:
> 
> 
> On Sunday, January 29, 2012, BG <bar...@gm...> wrote:
> > Hello all,
> >
> > I'm new to using Matplotlib. I am on Ubuntu 10.4, and I installed through apt-get. I then downloaded and installed basemap according to the instructions on the basemap site. However, when I run simpletest.py from the basemap package, I get an error "ImportError: No module named axes_grid1". I thought this was a basemap problem at first, but I can reproduce this error using matplotlib tests. Am I doing something wrong? As I understand it, axes_grid1 is a set of helper classes which comes with Matplotlib. Does it need to be installed? Thanks!
> >
> > -BG
> >
> 
> This is likely a packaging bug by Ubuntu. Can you give us the full log from the matplotlib tests?
> 
> Ben Root
From: Jae-Joon L. <lee...@gm...> - 2012年01月31日 15:56:21
I believe the matplotlib package in ubuntu 10.4 is v0.99.1, which does
not include axes_grid1.
You need to install newer version of matplotlib.
Regards,
-JJ
On Mon, Jan 30, 2012 at 3:58 AM, BG <bar...@gm...> wrote:
> Hello all,
>
> I'm new to using Matplotlib. I am on Ubuntu 10.4, and I installed through apt-get. I then downloaded and installed basemap according to the instructions on the basemap site. However, when I run simpletest.py from the basemap package, I get an error "ImportError: No module named axes_grid1". I thought this was a basemap problem at first, but I can reproduce this error using matplotlib tests. Am I doing something wrong? As I understand it, axes_grid1 is a set of helper classes which comes with Matplotlib. Does it need to be installed? Thanks!
>
> -BG
>
> ------------------------------------------------------------------------------
> 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: Benjamin R. <ben...@ou...> - 2012年01月31日 15:06:37
On Sunday, January 29, 2012, BG <bar...@gm...> wrote:
> Hello all,
>
> I'm new to using Matplotlib. I am on Ubuntu 10.4, and I installed
through apt-get. I then downloaded and installed basemap according to the
instructions on the basemap site. However, when I run simpletest.py from
the basemap package, I get an error "ImportError: No module named
axes_grid1". I thought this was a basemap problem at first, but I can
reproduce this error using matplotlib tests. Am I doing something wrong?
 As I understand it, axes_grid1 is a set of helper classes which comes with
Matplotlib. Does it need to be installed? Thanks!
>
> -BG
>
This is likely a packaging bug by Ubuntu. Can you give us the full log
from the matplotlib tests?
Ben Root
From: Christoph P. <anm...@du...> - 2012年01月31日 06:35:57
Hello everybody,
I have a problem transferring from 3D data to a 2D representation.
I used mayavi to define a cut plane through a volume data set and got 
the xyz
coordinates for the points on the plane and the data at each point.
Now I would like to make a contour plot of that data in matplotlib.
My first try was rotating the normal of the cut plane parallel to the 
z-axes and leaving the data unchanged.
Unfortunately, this changed the number of grid points, so I do not know 
how to fit these both sets together.
Is there a convenient way how to sample these 3d data and put it on a 2d 
grid?
Thank you very much in advance, Chris
From: Tony Yu <ts...@gm...> - 2012年01月31日 01:58:53
On Sun, Jan 29, 2012 at 10:10 PM, C M <cmp...@gm...> wrote:
>
>
> On Wed, Jan 4, 2012 at 2:19 PM, Benjamin Root <ben...@ou...> wrote:
>
>>
>>
>> On Wednesday, January 4, 2012, jeffsp <je...@gm...> wrote:
>> >
>> > plt.tight_layout(), sweet
>> >
>> > it still makes the labels too close to read, even if they don't overlap.
>> > that is, they're just a continuous string of numbers with no whitespace
>> > between.
>> >
>> > it does clean up the rest of the plot really nicely, though, without
>> having
>> > to continually dick around with subplots_adjust
>> >
>> >
>>
>> Well, it is a new feature with plenty of room for improvements. Maybe
>> some sort of mindist parameter would be useful to establish a minimum
>> distance between text objects?
>>
>> Ben Root
>>
>>
> Something like that sounds good. If there were a way to make it the
> default that labels would never overlap (but that default could be toggled
> for those who, somehow, want to not be able to read their labels?), that
> strikes me as best.
>
> In the meantime, what are other ways to do this?
>
>
Just to clarify, I don't think improvements to `tight_layout` will fix your
issues with tick layout; `tight_layout` adjusts the subplot spacing, not
the spacing of tick labels.
If you just want to prevent overlap in the static case, you can just set
the tick labels yourself, e.g. `plt.xticks([1, 2, 3])`. If you want
something automatic and dynamic, ...
I believe this is actually a pretty difficult problem to solve in the
general case. I've implemented a hacky attempt
here<https://gist.github.com/1708133>,
but it leaves out a lot of common use cases (e.g. subplots) and doesn't
account for spacing between the axes and figure.
-Tony
From: Howard <ho...@re...> - 2012年01月30日 21:37:59
Hi Nicolas
Thanks for the post. I'm going to finish optimizing all of the 
non-rendering pieces of my code, then I'll see if trying the hardware 
rendering makes sense. Right now I am software rendering 3.5 million 
triangles in about 5 seconds, but the setup (masking etc) is taking 
about 40. When I get the setup lower (which I think I will), I'll get 
back to you about this.
Thanks again
Howard
On 1/29/12 7:43 AM, Nicolas Rougier wrote:
>
>
> Thanks for posting the link to glumpy.
>
> As Benjamin explained, glumpy servers as a testbed for various 
> technics that could be implemented later in matplotlib. The main 
> problem today is that if you want to benefit from hardware 
> acceleration, you have to use some GL features that are not compatible 
> with he whole matplotlib framework (and we need to ensure some degree 
> of compatibilty). I do not have yet a clean solution and I'm still 
> experimenting.
>
> For your tricontourf problem, I think it might be solved quite easily 
> with the proper GL shader but I would need a complete (and basic) 
> matplotlib script example to check if this is actually the case.
>
>
> Nicolas
>
>
> On Jan 27, 2012, at 23:12 , Benjamin Root wrote:
>
>> On Fri, Jan 27, 2012 at 10:06 AM, Howard <ho...@re... 
>> <mailto:ho...@re...>> wrote:
>>
>> On 1/27/12 3:39 AM, Ian Thomas wrote:
>>> On 26 January 2012 19:36, Howard <ho...@re...
>>> <mailto:ho...@re...>> wrote:
>>>
>>> I'm rendering some images with about 3.5 million triangles
>>> into a 512x512 png file using tricontourf. I'm running this
>>> in a virtual machine, and I'm pretty sure that there is no
>>> graphics rendering hardware being used. Is it possible,
>>> assuming the hardware was available, to make tricontourf use
>>> the rendering hardware? Will that happen by default?
>>>
>>>
>>> You are correct, there is no graphics hardware rendering. 
>>> Rendering is controlled by the various matplotlib backends, and
>>> to my knowledge there are no backends currently available that
>>> use hardware rendering.
>>>
>>> There has been some work done on an OpenGL backend, but I am not
>>> sure of the status of this. The last time I checked it was
>>> pretty experimental. Perhaps someone involved with it can
>>> comment on its current status.
>>>
>>> Ian Thomas
>> Ian
>>
>> Thanks very much for the reply. If it helps whoever is doing the
>> OpenGL backend, I may be able to play with it a bit.
>>
>>
>> Howard
>>
>>
>> That would be the Glumpy project.
>>
>> http://code.google.com/p/glumpy/
>>
>> As stated in an email response a while back, glumpy is intended to be 
>> a testbed for developing the OpenGL backend for future inclusion into 
>> matplotlib.
>>
>> Cheers!
>> Ben Root
>>
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> 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-dev2_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Howard Lander <mailto:ho...@re...>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651
From: johanngoetz <jg...@uc...> - 2012年01月30日 18:39:05
nahren manuel wrote:
> 
> Hello ,
> I have a two dimensional array, 40X20(rowsXcolumns). Each of the 40 rows
> themselves hold values of the bins of a distribution (which is not always
> normal, can expect a bimodal curve as well)
> 
> It is little difficult to explain to I actually created a sample figure:
> 
> http://www.flickr.com/photos/nahrenmascarenhas/6771369071/in/photostream
> 
> Any help or trick will be very useful
> loads of thanks
> 
> nahren
> 
I took some of the code that I use regularly and came up with this minimal
example of fitting data very similar to the figure you showed above. I hope
the explanations in the code are clear enough.
https://sites.google.com/site/theodoregoetz/notes/fittingaprofilein2dhistogramdata
link to my website with code example 
Here is the code and the output figure. Hope this helps someone!
Johann.
http://old.nabble.com/file/p33231288/y_profile.py y_profile.py 
http://old.nabble.com/file/p33231288/y_profile.png 
-- 
View this message in context: http://old.nabble.com/histogram-plots-color-range-tp33215265p33231288.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: C M <cmp...@gm...> - 2012年01月30日 18:35:43
On Mon, Jan 30, 2012 at 12:32 PM, Daryl Herzmann <ak...@ia...>wrote:
> On Sun, Jan 29, 2012 at 10:10 PM, C M <cmp...@gm...> wrote:
> > If I use the DateFormatter, like this:
> >
> > mydateformatter =
>
> >
> > I'll get dates like (note the time part):
> >
> > Nov 27 2011
> > 03:00 PM
> >
> > Instead, I'd like to lose the zero on times, like:
> >
> > Nov 27 2011
> > 3:00 PM
> >
> > Is there a way to do that?
>
> I believe if you put a '-' sign in there, it will work
>
> DateFormatter("%b%d \n %-I:%M%p", self._tz)
>
> daryl
>
Thanks, but that doesn't work. If I use that, I get all times listed as
1:00 AM.
Che
From: Daryl H. <ak...@ia...> - 2012年01月30日 17:33:09
On Sun, Jan 29, 2012 at 10:10 PM, C M <cmp...@gm...> wrote:
> If I use the DateFormatter, like this:
>
> mydateformatter =
>
> I'll get dates like (note the time part):
>
> Nov 27 2011
> 03:00 PM
>
> Instead, I'd like to lose the zero on times, like:
>
> Nov 27 2011
>  3:00 PM
>
> Is there a way to do that?
I believe if you put a '-' sign in there, it will work
DateFormatter("%b%d \n %-I:%M%p", self._tz)
daryl
From: Robert K. <rob...@gm...> - 2012年01月30日 16:59:24
On 1/30/12 3:50 PM, Fabien Lafont wrote:
> Hello,
>
> Do somebody knows how to keep only the x first terms of a numpy 1D array?
>
> like
>
> a = array([8,4,5,7,9])
> function(a,2)
>>>> [8,4]
These questions belong on the numpy mailing list. You have already asked this 
question on scipy-user and received a correct answer.
 http://www.scipy.org/Mailing_Lists
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Fabien L. <laf...@gm...> - 2012年01月30日 15:50:27
Hello,
Do somebody knows how to keep only the x first terms of a numpy 1D array?
like
a = array([8,4,5,7,9])
function(a,2)
>>> [8,4]
From: Jerzy K. <jer...@un...> - 2012年01月30日 13:53:03
David Craig :
> Hi, thanks for that. I've made the following changes:
>
> NFFT = 100*60*10 # Linked to window size
> Fs = stream[0].stats.sampling_rate
> win = np.hanning(NFFT)
> overlap = NFFT/2
> power, freq = plt.psd(data, NFFT, Fs, win, overlap)
>
> but it returns the following error:
>
> Traceback (most recent call last):
> File "/home/davcra/Desktop/python_scripts/welchPSD.py", line 20, in 
> <module>
> power, freq = plt.psd(data, NFFT, Fs, win, overlap)
> File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 
> 2322, in psd
> ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, 
> sides, scale_by_freq, **kwargs)
> File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 
> 7876, in psd
> sides, scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 
> 389, in psd
> scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 
> 419, in csd
> noverlap, pad_to, sides, scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 
> 268, in _spectral_helper
> thisX = windowVals * detrend(thisX)
> TypeError: 'int' object is not callable
Please, look the syntax of .psd in
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=psd#matplotlib.pyplot.psd
You will find, for example, that the 5th argument, detrend, should be 
callable. In your code it is just a number.
Use explicit keywords, it may save you from misunderstanding yourself...
Jerzy Karczmarczuk
OH.
Fabrice Silva found it as well. OK, two is better than one...
From: Fabrice S. <si...@lm...> - 2012年01月30日 13:48:02
Le lundi 30 janvier 2012 à 13:34 +0000, David Craig a écrit :
> Hi, thanks for that. I've made the following changes:
> 
> NFFT = 100*60*10 # Linked to window size
> Fs = stream[0].stats.sampling_rate
> win = np.hanning(NFFT)
> overlap = NFFT/2
> power, freq = plt.psd(data, NFFT, Fs, win, overlap)
> 
> but it returns the following error:
> 
> Traceback (most recent call last):
> File "/home/davcra/Desktop/python_scripts/welchPSD.py", line 20, in <module>
> power, freq = plt.psd(data, NFFT, Fs, win, overlap)
> File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2322, in psd
> ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, sides, scale_by_freq, **kwargs)
> File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 7876, in psd
> sides, scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 389, in psd
> scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 419, in csd
> noverlap, pad_to, sides, scale_by_freq)
> File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 268, in _spectral_helper
> thisX = windowVals * detrend(thisX)
> TypeError: 'int' object is not callable
Please be careful with argument order. Expected arguments for psd are
- the data array
- the NFFT value
- the sampling frequency
- the detrend callable (*missing in your example*)
- and then the overlap number
You should either specify on of the detrend pylab functions
(detrend_none, detrend_mean, and detrend_linear) or use keyword
arguments as I did in the example. 
-- 
Fabrice Silva
From: David C. <dcd...@gm...> - 2012年01月30日 13:34:34
Hi, thanks for that. I've made the following changes:
NFFT = 100*60*10 # Linked to window size
Fs = stream[0].stats.sampling_rate
win = np.hanning(NFFT)
overlap = NFFT/2
power, freq = plt.psd(data, NFFT, Fs, win, overlap)
but it returns the following error:
Traceback (most recent call last):
 File "/home/davcra/Desktop/python_scripts/welchPSD.py", line 20, in
<module>
 power, freq = plt.psd(data, NFFT, Fs, win, overlap)
 File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2322,
in psd
 ret = ax.psd(x, NFFT, Fs, Fc, detrend, window, noverlap, pad_to, sides,
scale_by_freq, **kwargs)
 File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 7876, in
psd
 sides, scale_by_freq)
 File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 389, in
psd
 scale_by_freq)
 File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 419, in
csd
 noverlap, pad_to, sides, scale_by_freq)
 File "/usr/lib/python2.7/site-packages/matplotlib/mlab.py", line 268, in
_spectral_helper
 thisX = windowVals * detrend(thisX)
TypeError: 'int' object is not callable
On Mon, Jan 30, 2012 at 12:13 PM, Fabrice Silva <si...@lm...>wrote:
> Le lundi 30 janvier 2012 à 11:45 +0000, David Craig a écrit :
> > Hi I have some data for a 24hr period with a sample rate of 100
> > samples/second. I want to create a power spectrum using matplotlibs
> > function psd. I want it to have 10 minute windows with a 50% overlap,
> > but cant seem to get the syntax right. My code is as follows:
> >
> > NFFT = len(data)
> > Fs = 100
> > window=np.hanning(Fs*60*10)
> > noverlap = window*0.5
> > plt.psd(data, NFFT, Fs, window, noverlap )
> >
> > anyone kow how to do this properly???
>
> Be careful to use a suitable value for NFFT. It must be linked to your
> windows size, not the total data length, and you would rather use a
> power of 2 for efficience. Do not use it to increase the frequency
> resolution (use pad_to instead).
>
> Fs = 100
> NFFT = Fs*60*10
> Pxx, f = plt.psd(data, NFFT, Fs, window=np.hanning(NFFT), NFFT/2)
>
> --
> Fabrice Silva
>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> 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-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Fabrice S. <si...@lm...> - 2012年01月30日 12:10:28
Le lundi 30 janvier 2012 à 11:45 +0000, David Craig a écrit :
> Hi I have some data for a 24hr period with a sample rate of 100
> samples/second. I want to create a power spectrum using matplotlibs
> function psd. I want it to have 10 minute windows with a 50% overlap,
> but cant seem to get the syntax right. My code is as follows:
> 
> NFFT = len(data)
> Fs = 100
> window=np.hanning(Fs*60*10)
> noverlap = window*0.5
> plt.psd(data, NFFT, Fs, window, noverlap )
> 
> anyone kow how to do this properly???
Be careful to use a suitable value for NFFT. It must be linked to your
windows size, not the total data length, and you would rather use a
power of 2 for efficience. Do not use it to increase the frequency
resolution (use pad_to instead).
Fs = 100
NFFT = Fs*60*10
Pxx, f = plt.psd(data, NFFT, Fs, window=np.hanning(NFFT), NFFT/2)
-- 
Fabrice Silva
From: David C. <dcd...@gm...> - 2012年01月30日 11:45:55
Hi I have some data for a 24hr period with a sample rate of 100
samples/second. I want to create a power spectrum using matplotlibs
function psd. I want it to have 10 minute windows with a 50% overlap, but
cant seem to get the syntax right. My code is as follows:
NFFT = len(data)
Fs = 100
window=np.hanning(Fs*60*10)
noverlap = window*0.5
plt.psd(data, NFFT, Fs, window, noverlap )
anyone kow how to do this properly???
Thanks,
D
From: Pål G. E. <pa...@gm...> - 2012年01月30日 08:39:06
Hi
Thank you very much, it worked perfectly :D
Kind regards
Pål
On 27 January 2012 15:29, Tony Yu <ts...@gm...> wrote:
>
>
> On Fri, Jan 27, 2012 at 9:13 AM, Pål Gunnar Ellingsen <pa...@gm...>wrote:
>
>> Hi
>>
>> I have a array, M, which is (4Nx4M), and an array (image), im, which is
>> NxM.
>> I can currently plot the matrix as a 2d image using imshow using:
>>
>> import matplotlib.pyplot as plt
>> from matplotlib import cm
>>
>> # some code for reading in the matrix
>>
>> cmap = cm.get_cmap('jet', 256)
>> imM = plt.imshow(M, cmap=cmap, vmin= -1, vmax=1)
>>
>> But now i would like to plot im on top of M, such that it covers the firs
>> element of M.
>> If I do
>>
>> plt.hold()
>> plt.imshow(im)
>>
>> I only see im, and not M. I'm used to doing this in Matlab, where this
>> would work.
>>
>> Can anyone explain me what I'm doing wrong?
>>
>>
>> Kind Regards
>>
>
> A call to `plt.autoscale` should fix your problem. It looks like `imshow`
> rescales the axes limits to the current image limits, instead of the limits
> for all the data in the axes. (Executable example below; note, axes "hold"
> by default, so it's not necessary to call hold).
>
> -Tony
>
>
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> background = np.random.uniform(0, 255, size=(20, 20))
> overlay = np.arange(25).reshape((5, 5))
>
> plt.imshow(background, interpolation='nearest', cmap=plt.cm.gray)
> plt.imshow(overlay, cmap=plt.cm.jet, alpha=0.5)
> # You could also replace this with `plt.axis([0, 20, 0, 20])
> plt.autoscale()
> plt.show()
>
From: C M <cmp...@gm...> - 2012年01月30日 04:11:09
If I use the DateFormatter, like this:
mydateformatter = DateFormatter("%b%d \n %I:%M%p", self._tz)
I'll get dates like (note the time part):
Nov 27 2011
 03:00 PM
Instead, I'd like to lose the zero on times, like:
Nov 27 2011
 3:00 PM
Is there a way to do that?
Thanks,
Che
From: C M <cmp...@gm...> - 2012年01月30日 03:10:33
On Wed, Jan 4, 2012 at 2:19 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Wednesday, January 4, 2012, jeffsp <je...@gm...> wrote:
> >
> > plt.tight_layout(), sweet
> >
> > it still makes the labels too close to read, even if they don't overlap.
> > that is, they're just a continuous string of numbers with no whitespace
> > between.
> >
> > it does clean up the rest of the plot really nicely, though, without
> having
> > to continually dick around with subplots_adjust
> >
> >
>
> Well, it is a new feature with plenty of room for improvements. Maybe
> some sort of mindist parameter would be useful to establish a minimum
> distance between text objects?
>
> Ben Root
>
>
Something like that sounds good. If there were a way to make it the
default that labels would never overlap (but that default could be toggled
for those who, somehow, want to not be able to read their labels?), that
strikes me as best.
In the meantime, what are other ways to do this?
3 messages has been excluded from this view by a project administrator.

Showing results of 319

1 2 3 .. 13 > >> (Page 1 of 13)
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 によって変換されたページ (->オリジナル) /