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
(1) |
2
(12) |
3
(12) |
4
(19) |
5
(7) |
6
(6) |
7
(2) |
8
(2) |
9
(11) |
10
(15) |
11
(27) |
12
(27) |
13
(18) |
14
(3) |
15
(3) |
16
(25) |
17
(9) |
18
(3) |
19
(4) |
20
(2) |
21
(4) |
22
(9) |
23
(28) |
24
(18) |
25
(16) |
26
(9) |
27
(4) |
28
(13) |
29
(15) |
30
(33) |
|
|
|
|
|
From: Geoffrey E. <ge...@us...> - 2009-11-30 22:54:37
|
Hi, I found this old thread discussing the possibility of placing un- resampled images in PS, PDF and SVG. It was questioned weather there were any potential users for such a feature to justify the effort. If it makes a difference, here is one user who very much welcome it. I need to overlay plotting onto images without the degradation cause by resampling. Is this possible? Currently I use interpolation='nearest' and a high DPI setting for savefig, but this is not ideal. Thanks for any help, Geoff Re: imshow without resampling by Jouni K. Seppänen Apr 05, 2009; 03:13am Eric Firing <efiring@...> writes: > I'm not sure who the SVG expert is, and I presume the attached message > applies to pdf as well as ps. I'm bringing it to your attention > because it is suggesting what would seem to be significant > improvements in some backends by taking better advantage of their > native image support. I know nothing about this; would either of you > (or anyone else) like to comment? Thanks for forwarding this Eric - yes, it applies to pdf. > From: Thomas Robitaille <thomas.robitaille@...> > I am using matplotlib to create postscript and SVG files. I am > currently using imshow to show the contents of an array, but this > means that when saving vector graphics files, matplotlib resamples the > image/array onto a finer grid. [...] Postscript and SVG (as languages) > both allow a bitmap of an arbitrary resolution to be scaled, > translated, and rotated without resampling. This is complicated by the wide variety of interpolation methods offered by imshow: Acceptable values are *None*, 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', where None means to use the matplotlibrc value, and I think the default is bicubic. The 'nearest' case is what you get by simply scaling the original bitmap, so in that case all vector backends could probably support skipping the interpolation step. The other interpolation methods could be programmed in Postscript, but that doesn't help with other backends - though perhaps PDF shadings (gradient fills) could be hacked to do this. I don't know anything about SVG. I wonder how the API between the backend and the image object should look like. Currently the AxesImage object does essentially im = self.make_image(renderer.get_image_magnification()) renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(), clippath, affine) and then the backend does things like h, w = im.get_size_out() [...] h,w,s = im.as_rgba_str() rgba.shape = (h, w, 4) rgb = rgba[:,:,:3] a = rgba[:,:,3:] Instead, I suppose AxesImage needs to first query the renderer if it supports the interpolation being used, and if so, call a new renderer method, say draw_interpolated_image(im). Or perhaps it could just call the new method, and its implementation in RendererBase would fall back to interpolating the image and calling the old draw_image. Vector backends could override it to be smarter when possible. A possibly related thought: the pdf backend could render some kinds of image files by passing through the encoded image data from the original file, so when e.g. image_demo3.py does lena = Image.open('../data/lena.jpg') im = imshow(lena, origin='lower') the pdf backend could try to read the JPEG file directly, and only decode it into a bitmap if it happens to be a wrong subtype of JPEG. For someone who's using big image files, this would decrease both rendering time and output size, but I don't know if there are any actual users and if the benefit is large enough to justify the added complexity - but if we modify the API anyway to support non-resampling imshow, it might be good to keep that use-case in mind. -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Eric F. <ef...@ha...> - 2009-11-30 21:42:28
|
Alan G Isaac wrote: > On 11/29/2009 11:44 PM, Eric Firing wrote: >> in svn there is such an option, but it still doesn't seem to >> do exactly the right thing in this case > > OK, looking forward ... Try svn 7993 with "scale_units='xy', angles='xy', scale=1". Having a separate "scale_units" kwarg is in the trunk only. Eric |
From: Jorge S. <jor...@ya...> - 2009-11-30 19:59:57
|
Michael Droettboom <mdroe@...> writes: > > It shouldn't always return True -- it should return a tuple of type > (bool, dict). The first element is whether it's inside, and the second > is a dictionary of indices of subobjects (used only for Collections). > Unfortunately, this tuple always evaluates to True. Have you tried > changing your contains test from ".contains()" to ".contains()[0]"? > > If that's not what's happening for you, can you send a self-contained > example that illustrates this bug? > > (I noticed the looking_glass.py example has this bug -- I'll fix that.) > > Mike You're right. I keep making these dumb mistakes... This time it was made worst cause the looking_glass.py example did the same. Jorge |
From: Wayne W. <sie...@sb...> - 2009-11-30 19:56:47
|
Another related question. is there some statistics function that computes the mean, std. dev., min/max, etc. from a frequency distribution? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Wayne W. <sie...@sb...> - 2009-11-30 19:54:48
|
Thanks. Very good. Pierre de Buyl wrote: > bar does what you need. > > import numpy as np > import matplotlib.pyplot as plt > > freq = np.array( [127516, 8548, 46797, 46648, 21085, 9084, 7466, > 6534, 5801, > 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0] ) > > fig = plt.figure() > plt.bar(range(0,255,8),freq*1./freq.sum(),width=8) > # the 1. avoid an integer division that gives 0 everywhere. > # width=8 specifies that each bins takes 8 units of width, > corresponding to the spacing in range(0,255,8) > plt.show() > > Le 30 nov. 09 à 17:46, Wayne Watson a écrit : > >> That helped by using the original data of 256 elements. So all the >> large values in the array beyond 120 would be tiny bars stretched >> out to x of about 127516. OK, now with the original 256 elements >> I see some problems. >> >> Individually, they contain some high counts, so I guess they are >> going off scale. This is unfortunate, since the original data was >> put into 256 bins by hardware from 307,000 + values. It looks like >> what I should be feeding hist, but recreating the 307K from the 256 >> seems something of a waste in that it is undoing what the hardware >> did. Is there some graph function that will treat the input as >> already binned? For example, if I have [10, 7, 5], I want to see a >> histogram of three bars, one at x =0 of height 10, one at x=1 of >> height 6, and 2 of height 5. x might be some other numbers like >> 18.2, 46.3 and 60.1. >> >> Pierre de Buyl wrote: >>> Hello, >>> >>> hist takes the raw data directly, and not a histogram already computed. >>> >>> If data is an array containing your pixels, >>> hist(data, bins = range(0,255,8) , normed=True) should do what you >>> expect >>> >>> The code you sent adequately counts 13 occurences for 0 in freq and >>> one at 121, with some rescaling. >>> >>> Pierre >>> >>> Le 30 nov. 09 à 16:52, Wayne Watson a écrit : >>> >>>> I'm working with a Python program that produces freq below. There >>>> are 32 >>>> bins. The bins represent 0-7, 8-14, ..., 248 - 255 of a set of >>>> frequencies (integer counts). 0 to 255 are the brightness pixel values >>>> from a 640x480 frame of b/w pixels. I binned 8 into each of 32 >>>> bins. One >>>> can easily see that the various bins are of a different height. >>>> However, >>>> the result is fixed height bar from 0 to 10, and a shorter single bar >>>> from about 120 to 130. The x-scale goes from 0 to 140 and not from >>>> 0 to >>>> 255, or somewhere in that range. It seems like hist is clumping >>>> everything into two groups. I've changed the range parameter several >>>> times and get the same result. I'd send an attachment of the >>>> figure, but >>>> that often seems to delay a post in most of these Python mail lists. >>>> >>>> freq = [127516, 8548, 46797, 46648, 21085, 9084, 7466, 6534, 5801, >>>> 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, 0, >>>> 0, 0, >>>> 0, 0, 0, 0, 0, 0, 0, 0] >>>> fig = pylab.figure() >>>> v = array(freq) >>>> plt.hist(v, bins=linspace(0,256,nplt_bins+1), normed=1, >>>> range=(30,200)) >>>> pylab.show() >>>> >>>> -- >>>> Wayne Watson (Watson Adventures, Prop., Nevada City, CA) >>> >>> >> >> -- >> Wayne Watson (Watson Adventures, Prop., Nevada City, CA) >> >> (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) >> Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 >> feet The popular press and many authorities >> believe the number >> of pedifiles that prowl the web is 50,00. There are no >> figures that support this. The number of children below >> 18 years of age kidnapped by strangers is 1 in 600,00, >> or 115 per year. -- The Science of Fear by D. Gardner >> Web Page: <www.speckledwithstars.net/> >> > > -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Jouni K. S. <jk...@ik...> - 2009-11-30 19:26:16
|
Michael Droettboom <md...@st...> writes: > Just a note when implementing this feature (I'm too busy at the moment > as well) -- the SVG backend already supports hyperlinks, so if possible > the PDF support should piggyback on its public API (get_url/set_url). Yes, for URL links the API should look similar, but I think for multimedia we need a richer API. PDF has support for embedding sound files in various formats since version 1.2, and (very complicated looking) support for general multimedia since version 1.5. -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Michael D. <md...@st...> - 2009-11-30 18:30:35
|
It shouldn't always return True -- it should return a tuple of type (bool, dict). The first element is whether it's inside, and the second is a dictionary of indices of subobjects (used only for Collections). Unfortunately, this tuple always evaluates to True. Have you tried changing your contains test from ".contains()" to ".contains()[0]"? If that's not what's happening for you, can you send a self-contained example that illustrates this bug? (I noticed the looking_glass.py example has this bug -- I'll fix that.) Mike On 11/28/2009 02:44 PM, Jorge Scandaliaris wrote: > Hi, > I was trying to find out when a button_press_event happened inside a patch > (tried Circle and Rectangle) using the contains(mouseevent) method, but it > always seem to return True. I got the inspiration from the looking_glass.py > example, which also doesn't work as (Ithink) it should. I know Ican do this the > hard way, i.e. checking with event.xdata event.ydata, but I was really happy > there was already a pre-defined method for doing so. > > Cheers, > > Jorge > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Michael D. <md...@st...> - 2009-11-30 18:17:49
|
Unfortunately, at present you can't. The figure referencing in Sphinx works because there is a hard-coded phase to match labels to figures (which doesn't know about plots). I think the matplotlib plot directive needs to write such a phase at well (should be possible using Sphinx event hooks) but it doesn't do that at the moment. Can you file a feature request so this doesn't get forgotten? Mike On 11/26/2009 02:56 PM, Jose Gomez-Dans wrote: > Hi, > I'm not sure this is entirely on-topic as it relates to the matplotlib > sphinx extension. I hope it's still acceptable! > > I am writing some documentation using sphinx, and I would like to > refer plots that are rendered from an external python script. I can do > the plot and it gets imported fine just by issuing > > .. plot:: ../samples/MyPythonPlot.py > > I would like to have a cross reference to it and a caption. If I were > to select a normal figure, I could do this just by (see > <http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>) > > .. _my-figure: > > .. figure:: whatever > > Figure caption > > But how can I do this with a matplotlib plot rather than a png file? > > Thanks! > J > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Michael D. <md...@st...> - 2009-11-30 17:50:21
|
Just a note when implementing this feature (I'm too busy at the moment as well) -- the SVG backend already supports hyperlinks, so if possible the PDF support should piggyback on its public API (get_url/set_url). Mike On 11/28/2009 11:09 AM, Fabricio Silva wrote: > Le samedi 28 novembre 2009 à 17:04 +0200, Jouni K. Seppänen a écrit : > >>> More specifically, I have a figure with a bunch of nicely-formatted >>> subplots and I embed this figure in a beamer presentation. I wish I >>> could play the associated sound when I click on one of the subplots in >>> Beamer (running a shell command). >>> >> Beamer comes with a package called multimedia, and I think it allows you >> to achieve something much like this -- see the \sound and >> \hyperlinksound macros. It might be difficult to make the hyperlink be >> exactly some subplot, but perhaps you could use e.g. speaker icons as >> link anchors and place them in suitable locations. >> > I have the second solution by now. But I hope I will succeed to make a > clickable area match to each subplot, probably using tikz to set the > size of the area. > > > |
From: Michael D. <md...@st...> - 2009-11-30 17:47:56
|
Scrollbars seem like the only reasonable solution I can think of. Of course, this will require adding support in all the backends -- not a small undertaking. I've filed a feature request for this here: https://sourceforge.net/tracker/?func=detail&aid=2906107&group_id=80706&atid=560723 Maybe if we can select a developer for each backend it won't be too much work. Any takers? Mike On 11/28/2009 12:03 AM, Michiel de Hoon wrote: > I think the best solution to this problem is to have scroll bars in the figure window if needed. Depending on the size of the figure (in physical units), the size of the window containing the figure, and the zoom factor the scroll bars would appear or disappear. This would require some modifications to all GUI backends. > > The same problem occurs in the Mac OS X backend, where the figure window size can be smaller than the requested size if the requested size is larger than the monitor size. See bug 2891502: > > http://sourceforge.net/tracker/?func=detail&atid=560720&aid=2891502&group_id=80706 > > Any comments, opinions? > > > --Michiel. > > --- On Wed, 11/25/09, do...@us...<do...@us...> wrote: > > >> From: do...@us...<do...@us...> >> Subject: Re: [Matplotlib-users] Large figure sizes get squashed or clipped? >> To: "Michael Droettboom"<md...@st...> >> Cc: mat...@li... >> Date: Wednesday, November 25, 2009, 7:43 PM >> Yes, I should have mentioned that; >> saving an image works fine. But >> then if I want to display it 1:1 with figimage() or such, I >> can't. :( >> Silly GUIs, not wanting to display a window larger than my >> screen.... >> >> >> >> On Wed, Nov 25, 2009 at 9:43 AM, Michael Droettboom<md...@st...> >> wrote: >> >>> There may be a limitation on window sizes in the >>> >> various GUI backends. Have >> >>> you tried using the non-GUI backend (agg), and now >>> >> "show"ing it, but just >> >>> using "savefig"? >>> >>> Mike >>> >>> do...@us... >>> >> wrote: >> >>>> I'm trying to make a 10 inch wide by 30 inch high, >>>> >> 72 dpi figure and >> >>>> display it interactively. Matplotlib seems to >>>> >> squash the height for >> >>>> anything over a certain size, depending on the >>>> >> backend: >> >>>> >>>> >> --------------------------------------------------- >> >>>> #!/usr/bin/env python >>>> >>>> import sys, os, matplotlib >>>> matplotlib.use('TkAgg') >>>> import matplotlib.pyplot as plt >>>> >>>> print os.uname() >>>> print sys.version >>>> print matplotlib.__version__ >>>> print >>>> >>>> f = plt.figure(figsize=(10,30), dpi=72) >>>> print "figheight before show(): %f" % >>>> >> f.get_figheight() >> >>>> plt.show() >>>> print "figheight after show(): %f" % >>>> >> f.get_figheight() >> >>>> >> -------------------------------------------------- >> >>>> Prints this: >>>> >>>> ========================== >>>> ('Linux', 'prime', '2.6.31-14-generic', >>>> >> '#48-Ubuntu SMP Fri Oct 16 >> >>>> 14:05:01 UTC 2009', 'x86_64') >>>> 2.6.4 (r264:75706, Nov 2 2009, 14:44:17) >>>> [GCC 4.4.1] >>>> 0.99.0 >>>> >>>> figheight before show(): 30.000000 >>>> figheight after show(): 22.027778 >>>> ========================== >>>> >>>> Tk squashes heights over 12 inches (the heights do >>>> >> get larger as you >> >>>> request larger figures, but not as large as what >>>> >> you request); GTK >> >>>> goes up to 11; and Qt4Agg only goes up to 7.3. >>>> >> WX seems to be the >> >>>> only backend that will give me a 30 inch figure, >>>> >> but even then I have >> >>>> to manually resize the window to make it fit. >>>> >> This happens in scripts >> >>>> with pyplot, in ipython with or without -pylab, >>>> >> and via the matplotlib >> >>>> API. >>>> >>>> Is there some limitation on figure sizes? >>>> >>>> >>>> >>>> >> ------------------------------------------------------------------------------ >> >>>> Let Crystal Reports handle the reporting - Free >>>> >> Crystal Reports 2008 >> >>>> 30-Day trial. Simplify your report design, >>>> >> integration and deployment - and >> >>>> focus on what you do best, core application >>>> >> coding. Discover what's new with >> >>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>>> >>> -- >>> Michael Droettboom >>> Science Software Branch >>> Operations and Engineering Division >>> Space Telescope Science Institute >>> Operated by AURA for NASA >>> >>> >>> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal >> Reports 2008 30-Day >> trial. Simplify your report design, integration and >> deployment - and focus on >> what you do best, core application coding. Discover what's >> new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > |
From: Michael D. <md...@st...> - 2009-11-30 17:37:53
|
Sorry this thread fell through the cracks. Thanks for the reminder. The error is not actually on importing and parsing the .py file (it seems to do that just fine). The error is on printing to the console, at which point it tries to convert the Unicode string to ascii (which fails because it has character points > 127). One way around this is to encode Unicode as UTF-8 (which seems to be the default for most modern Linux X terminals etc.), eg.: print(u"accent aigus é".encode("utf8")) Mike On 11/25/2009 02:11 PM, Sébastien Barthélemy wrote: > Hi, > > just wanted to raise this problem on the devel list, where it probably > belongs. Also, if nobody has time to look at it now and you prefer me > to file a bug, please don't hesitate to tell it. > > the original post is there: > http://thread.gmane.org/gmane.comp.python.matplotlib.general/20411 > > Cheers > > Le 21 novembre 2009 17:50, Sébastien Barthélemy <bar...@cr... > <mailto:bar...@cr...>> a écrit : > > Le 18 novembre 2009 17:24, Michael Droettboom <md...@st... > <mailto:md...@st...>> a écrit : > > This is a bug -- but it has a fairly straightforward fix: to > use Sphinx's "include" directive rather than roll our own as > we currently do. This has been fixed in SVN r7972. > plot-directive now takes an "encoding" option, exactly like > the Sphinx include directive. It does not do automatic > encoding detection (meaning it ignores the "# coding: latin1" > comments), just as the Sphinx include directive does. > > > Hello Michael, > > thank you for your fast reply and action. I just tried with the > version from trunk (r7978) and I still have an encoding problem on > the same test case. It seems to happen when the file is ran (to > produce the figure) rather than when it is included. I had a look > at the code, but cannot understand what is happenning, I would > have expected imp to proprely guess the encoding. > > Could you tell me if you have the same problem ? Do you have any > idea of what is going on ? > > Thanks ! > > $ git clone git://github.com/sbarthelemy/SphinxEncoding.git > <http://github.com/sbarthelemy/SphinxEncoding.git> > $ cd SphinxEncoding/ > $ make html > sphinx-build -b html -d _build/doctrees . _build/html > Making output directory... > Running Sphinx v0.6.2 > loading pickled environment... not found > building [html]: targets for 1 source files that are out of date > updating environment: 1 added, 0 changed, 0 removed > /home/barthelemy/.local/lib/python2.6/site-packages/matplotlib/sphinxext/plot_directive.py:273: > UserWarning: Exception running plot ./fileutf8.py > Traceback (most recent call last): > File > "/home/barthelemy/.local/lib/python2.6/site-packages/matplotlib/sphinxext/plot_directive.py", > line 270, in render_figures > run_code(plot_path, function_name, plot_code) > File > "/home/barthelemy/.local/lib/python2.6/site-packages/matplotlib/sphinxext/plot_directive.py", > line 182, in run_code > "__plot__", fd, fname, ('py', 'r', imp.PY_SOURCE)) > File "fileutf8.py", line 2, in <module> > print(u"accent aigus é") > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' > in position 13: ordinal not in range(128) > > |
From: Pierre de B. <pd...@ul...> - 2009-11-30 17:37:34
|
bar does what you need. import numpy as np import matplotlib.pyplot as plt freq = np.array( [127516, 8548, 46797, 46648, 21085, 9084, 7466, 6534, 5801, 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ) fig = plt.figure() plt.bar(range(0,255,8),freq*1./freq.sum(),width=8) # the 1. avoid an integer division that gives 0 everywhere. # width=8 specifies that each bins takes 8 units of width, corresponding to the spacing in range(0,255,8) plt.show() Le 30 nov. 09 à 17:46, Wayne Watson a écrit : > That helped by using the original data of 256 elements. So all the > large values in the array beyond 120 would be tiny bars stretched > out to x of about 127516. OK, now with the original 256 > elements I see some problems. > > Individually, they contain some high counts, so I guess they are > going off scale. This is unfortunate, since the original data > was put into 256 bins by hardware from 307,000 + values. It looks > like what I should be feeding hist, but recreating the 307K from > the 256 seems something of a waste in that it is undoing what the > hardware did. Is there some graph function that will treat the > input as already binned? For example, if I have [10, 7, 5], I want > to see a histogram of three bars, one at x =0 of height 10, one at > x=1 of height 6, and 2 of height 5. x might be some other numbers > like 18.2, 46.3 and 60.1. > > Pierre de Buyl wrote: >> Hello, >> >> hist takes the raw data directly, and not a histogram already >> computed. >> >> If data is an array containing your pixels, >> hist(data, bins = range(0,255,8) , normed=True) should do what you >> expect >> >> The code you sent adequately counts 13 occurences for 0 in freq >> and one at 121, with some rescaling. >> >> Pierre >> >> Le 30 nov. 09 à 16:52, Wayne Watson a écrit : >> >>> I'm working with a Python program that produces freq below. There >>> are 32 >>> bins. The bins represent 0-7, 8-14, ..., 248 - 255 of a set of >>> frequencies (integer counts). 0 to 255 are the brightness pixel >>> values >>> from a 640x480 frame of b/w pixels. I binned 8 into each of 32 >>> bins. One >>> can easily see that the various bins are of a different height. >>> However, >>> the result is fixed height bar from 0 to 10, and a shorter single >>> bar >>> from about 120 to 130. The x-scale goes from 0 to 140 and not >>> from 0 to >>> 255, or somewhere in that range. It seems like hist is clumping >>> everything into two groups. I've changed the range parameter several >>> times and get the same result. I'd send an attachment of the >>> figure, but >>> that often seems to delay a post in most of these Python mail lists. >>> >>> freq = [127516, 8548, 46797, 46648, 21085, 9084, 7466, 6534, 5801, >>> 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, >>> 0, 0, 0, >>> 0, 0, 0, 0, 0, 0, 0, 0] >>> fig = pylab.figure() >>> v = array(freq) >>> plt.hist(v, bins=linspace(0,256,nplt_bins+1), normed=1, range= >>> (30,200)) >>> pylab.show() >>> >>> -- >>> Wayne Watson (Watson Adventures, Prop., Nevada City, CA) >> >> > > -- > Wayne Watson (Watson Adventures, Prop., Nevada City, CA) > > (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) > Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 > feet The popular press and many > authorities believe the number > of pedifiles that prowl the web is 50,00. There are no > figures that support this. The number of children below > 18 years of age kidnapped by strangers is 1 in 600,00, > or 115 per year. -- The Science of Fear by D. Gardner > Web Page: <www.speckledwithstars.net/> > |
From: <PH...@Ge...> - 2009-11-30 17:12:16
|
This is indeed a DOS prompt issue. Right-click the very top of the window and go to Properties. Upon exit, select that the changes should be applied to future windows "with the same title." HTH -paul > -----Original Message----- > From: Wayne Watson [mailto:sie...@sb...] > Sent: Monday, November 30, 2009 8:58 AM > To: mat...@li... > Subject: Re: [Matplotlib-users] Installing iPython on Win XP > > Looking a little further at this problem it looks like iPython was > installed. I mis-interpreted some lines at the bottom. The very bottom > one showed [1]. I didn't recognize that as a line prompt. The next > question is whether one can accept a complete program. I suspect this > is a purely interactive program, and it's total interface is the DOS > like console? I see one must use properties of the Window to change its > size. I would think there would be a way to make these the same each > time? I think there's a tutor for this, so it looks like I need to > visit it. > > Wayne Watson wrote: > > I downloaded ipython-0.10.win32-setup.exe and began the execution. It > > seem like it installed components. It may have brought up a download > for > > ipython-0.10-py2.5.egg some minutes later. When I noticed it I thought > > maybe I accidentally triggered its appearnace from the Start menu. I > > tried ipython from the menu to see what it might look like. I got a > > console window with messages of various kinds about a successful > install > > and some general comments about features. It stated I should hit Enter > > to continue. That did nothing. I closed the window. What next? > > > > Am I supposed to install the egg file? I thought I'd download it and > > try, but Win doesn't recognize it. > > > > > > -- > Wayne Watson (Watson Adventures, Prop., Nevada City, CA) > > (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) > Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet > > The popular press and many authorities believe the number > of pedifiles that prowl the web is 50,00. There are no > figures that support this. The number of children below > 18 years of age kidnapped by strangers is 1 in 600,00, > or 115 per year. -- The Science of Fear by D. Gardner > > Web Page: <www.speckledwithstars.net/> > > > ------------------------------------------------------------------------- > ----- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30- > Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Pekeika <m.e...@um...> - 2009-11-30 17:09:40
|
Good morning All, I am creating figures that need to overlay with maps, so disabling the box around my figures is a must. (need no title, legend, etc...) I have my plain figure now without surroundings but now need the axis numbers "on" the grid inside the plot area (like latitude and longitude numbers appear next to the grids on maps)... I cannot find a function or an argument for the axis() or axes() functions that translates axes into the plot area... Any ideas please? Thank you so much, Angelica. -- View this message in context: http://old.nabble.com/How-to-display-axis-numbers-inside-the-figure-area-tp26578109p26578109.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Wayne W. <sie...@sb...> - 2009-11-30 16:58:31
|
Looking a little further at this problem it looks like iPython was installed. I mis-interpreted some lines at the bottom. The very bottom one showed [1]. I didn't recognize that as a line prompt. The next question is whether one can accept a complete program. I suspect this is a purely interactive program, and it's total interface is the DOS like console? I see one must use properties of the Window to change its size. I would think there would be a way to make these the same each time? I think there's a tutor for this, so it looks like I need to visit it. Wayne Watson wrote: > I downloaded ipython-0.10.win32-setup.exe and began the execution. It > seem like it installed components. It may have brought up a download for > ipython-0.10-py2.5.egg some minutes later. When I noticed it I thought > maybe I accidentally triggered its appearnace from the Start menu. I > tried ipython from the menu to see what it might look like. I got a > console window with messages of various kinds about a successful install > and some general comments about features. It stated I should hit Enter > to continue. That did nothing. I closed the window. What next? > > Am I supposed to install the egg file? I thought I'd download it and > try, but Win doesn't recognize it. > > -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Wayne W. <sie...@sb...> - 2009-11-30 16:46:55
|
That helped by using the original data of 256 elements. So all the large values in the array beyond 120 would be tiny bars stretched out to x of about 127516. OK, now with the original 256 elements I see some problems. Individually, they contain some high counts, so I guess they are going off scale. This is unfortunate, since the original data was put into 256 bins by hardware from 307,000 + values. It looks like what I should be feeding hist, but recreating the 307K from the 256 seems something of a waste in that it is undoing what the hardware did. Is there some graph function that will treat the input as already binned? For example, if I have [10, 7, 5], I want to see a histogram of three bars, one at x =0 of height 10, one at x=1 of height 6, and 2 of height 5. x might be some other numbers like 18.2, 46.3 and 60.1. Pierre de Buyl wrote: > Hello, > > hist takes the raw data directly, and not a histogram already computed. > > If data is an array containing your pixels, > hist(data, bins = range(0,255,8) , normed=True) should do what you expect > > The code you sent adequately counts 13 occurences for 0 in freq and > one at 121, with some rescaling. > > Pierre > > Le 30 nov. 09 à 16:52, Wayne Watson a écrit : > >> I'm working with a Python program that produces freq below. There are 32 >> bins. The bins represent 0-7, 8-14, ..., 248 - 255 of a set of >> frequencies (integer counts). 0 to 255 are the brightness pixel values >> from a 640x480 frame of b/w pixels. I binned 8 into each of 32 bins. One >> can easily see that the various bins are of a different height. However, >> the result is fixed height bar from 0 to 10, and a shorter single bar >> from about 120 to 130. The x-scale goes from 0 to 140 and not from 0 to >> 255, or somewhere in that range. It seems like hist is clumping >> everything into two groups. I've changed the range parameter several >> times and get the same result. I'd send an attachment of the figure, but >> that often seems to delay a post in most of these Python mail lists. >> >> freq = [127516, 8548, 46797, 46648, 21085, 9084, 7466, 6534, 5801, >> 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, 0, 0, 0, >> 0, 0, 0, 0, 0, 0, 0, 0] >> fig = pylab.figure() >> v = array(freq) >> plt.hist(v, bins=linspace(0,256,nplt_bins+1), normed=1, range=(30,200)) >> pylab.show() >> >> -- >> Wayne Watson (Watson Adventures, Prop., Nevada City, CA) > > -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Wayne W. <sie...@sb...> - 2009-11-30 15:52:54
|
I'm working with a Python program that produces freq below. There are 32 bins. The bins represent 0-7, 8-14, ..., 248 - 255 of a set of frequencies (integer counts). 0 to 255 are the brightness pixel values from a 640x480 frame of b/w pixels. I binned 8 into each of 32 bins. One can easily see that the various bins are of a different height. However, the result is fixed height bar from 0 to 10, and a shorter single bar from about 120 to 130. The x-scale goes from 0 to 140 and not from 0 to 255, or somewhere in that range. It seems like hist is clumping everything into two groups. I've changed the range parameter several times and get the same result. I'd send an attachment of the figure, but that often seems to delay a post in most of these Python mail lists. freq = [127516, 8548, 46797, 46648, 21085, 9084, 7466, 6534, 5801, 5051, 4655, 4168, 4343, 3105, 2508, 2082, 1200, 488, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fig = pylab.figure() v = array(freq) plt.hist(v, bins=linspace(0,256,nplt_bins+1), normed=1, range=(30,200)) pylab.show() -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Dilip W. <di...@ya...> - 2009-11-30 14:53:03
|
Thanks, Christoph. I confirmed that this build solves the problem. Dilip. ----- Original Message ---- From: Christoph Gohlke <cg...@uc...> To: matplotlib-users <mat...@li...> Sent: Tue, November 24, 2009 5:55:03 PM Subject: Re: [Matplotlib-users] Unable to import matplotlib.pylab in Windows I was able to reproduce your problem on one of our Pentium III computers and traced it down to a bug in the _path module initialization function (will file a separate bug report). Please try again installing the updated <matplotlib-0.99.1.1.win32-py2.6.exe> from <http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib>. Christoph ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Oliver T. <oli...@no...> - 2009-11-30 10:48:55
|
4 2.4 1 1 1 1.23 3.25 2.31 4.65 3.14 2.9 1.95 3.45 2.12 |
From: Wayne W. <sie...@sb...> - 2009-11-30 10:30:16
|
I downloaded ipython-0.10.win32-setup.exe and began the execution. It seem like it installed components. It may have brought up a download for ipython-0.10-py2.5.egg some minutes later. When I noticed it I thought maybe I accidentally triggered its appearnace from the Start menu. I tried ipython from the menu to see what it might look like. I got a console window with messages of various kinds about a successful install and some general comments about features. It stated I should hit Enter to continue. That did nothing. I closed the window. What next? Am I supposed to install the egg file? I thought I'd download it and try, but Win doesn't recognize it. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: xiaoni <wa...@ya...> - 2009-11-30 09:44:14
|
Hello, Dear all, I am using matplotlib and basemap. It worked well in my home computer until recently, when I perhaps made an automatic upgrade of the system and softwares using apt-get . Now I can import matplotlib and basemap without errors, but when I run the example/simpletest.py from the basemap package, there is a segmentation error. I tracked and found it happens with the line "Basemap(projection='robin',lon_0=200.1666487)". I have search internet but not found the solution, and I am completely confused now. It would be very good to have help from anyone here, and many thanks in advance ! the version of matplotlib: 0.99.0 the version of numpy: 1.3.0 the version of basemap: 0.99.3 the version of geos: perhaps 3.0 or 3.1 (I used dpkp -l and found both) the version of python: 2.6 (though 2.5 is also installed). OS : kubuntu 9.10 best, xiaoni wang |
From: Eric F. <ef...@ha...> - 2009-11-30 06:48:33
|
Wayne Watson wrote: > Eric Firing wrote: >>> >>> I'm pretty new to this stuff, so what belongs where is sometimes >>> unclear. I'll check out the sourceforge tip. I didn't write the >>> program. I'm just trying to add some features. Changing the import >>> for matplotlib got the graphics window up. >>> import matplotlib.pyplot as plt >>> >>> When I ran it, it was followed by this traceback: >>> ------------start >>> Exception in Tkinter callback >>> Traceback (most recent call last): >>> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ >>> return self.func(*args) >>> File >>> "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", >>> line 508, in ShowHistogram >>> plt.histogram(v, bins=linspace(0,256,nplt_bins+1), normed=1)# >>> matplotlib version (plot) >>> AttributeError: 'module' object has no attribute 'histogram' >>> ---------------end >>> 508 line is the histogram. Who's complaining? ShowHistogram? I don't >>> believe I should be using hist here instead of histogram. >> >> histogram is a numpy function, not a pyplot function. Pyplot has a >> hist which uses numpy.histogram to do the calculation, and then plots >> it. It does look like plt.hist is what was intended in your code. >> >> For tracking down such things, there is no substitute for working >> interactively with ipython. If you are not already familiar with it, >> taking a little time to get it running and learn the basics (like tab >> completion and appending ? or ?? to function names to get docstrings + >> origins, and source code, respectively) will pay big dividends. >> >> Eric > These dependencies sure are tricky. I changed it to plt:hist, and that > got me a histogram plot. I think some of my parameters need work, but > it's close to what I expected. When I closed the graph and finally the > program, the shell (IDLE) did not provide a >> prompt, nor did it > produce my print of "End of Histogram" that followed plt.hist. Closing > the shell revealed something was still running. I may have to go to the > console for execution to see what that's about. That is what ipython is for (among other things): it handles interactive plotting, which tends to be a problem with other shells and environments. It also gives nice access to the pdb debugger to help you figure out what actually went wrong when you get an exception. > > I've heard of ipython. It looks like I should give it a try. Examples > for matplotlib abound, but not much about how MATLAB concepts like > figure shows up anywhere. Is that all in pylab docs? > Yes. If you are coming from Matlab, you may find this useful for the numeric aspects: http://www.scipy.org/NumPy_for_Matlab_Users. Eric |
From: Wayne W. <sie...@sb...> - 2009-11-30 06:23:35
|
Eric Firing wrote: >> >> I'm pretty new to this stuff, so what belongs where is sometimes >> unclear. I'll check out the sourceforge tip. I didn't write the >> program. I'm just trying to add some features. Changing the import >> for matplotlib got the graphics window up. >> import matplotlib.pyplot as plt >> >> When I ran it, it was followed by this traceback: >> ------------start >> Exception in Tkinter callback >> Traceback (most recent call last): >> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ >> return self.func(*args) >> File >> "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", >> line 508, in ShowHistogram >> plt.histogram(v, bins=linspace(0,256,nplt_bins+1), normed=1)# >> matplotlib version (plot) >> AttributeError: 'module' object has no attribute 'histogram' >> ---------------end >> 508 line is the histogram. Who's complaining? ShowHistogram? I don't >> believe I should be using hist here instead of histogram. > > histogram is a numpy function, not a pyplot function. Pyplot has a > hist which uses numpy.histogram to do the calculation, and then plots > it. It does look like plt.hist is what was intended in your code. > > For tracking down such things, there is no substitute for working > interactively with ipython. If you are not already familiar with it, > taking a little time to get it running and learn the basics (like tab > completion and appending ? or ?? to function names to get docstrings + > origins, and source code, respectively) will pay big dividends. > > Eric These dependencies sure are tricky. I changed it to plt:hist, and that got me a histogram plot. I think some of my parameters need work, but it's close to what I expected. When I closed the graph and finally the program, the shell (IDLE) did not provide a >> prompt, nor did it produce my print of "End of Histogram" that followed plt.hist. Closing the shell revealed something was still running. I may have to go to the console for execution to see what that's about. I've heard of ipython. It looks like I should give it a try. Examples for matplotlib abound, but not much about how MATLAB concepts like figure shows up anywhere. Is that all in pylab docs? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Eric F. <ef...@ha...> - 2009-11-30 06:04:56
|
Wayne Watson wrote: > > Eric Firing wrote: >> Wayne Watson wrote: >>> I have a fairly large program that uses pylab and company. I want to >>> use the matplot histogram function. Here are the declarations at the >>> start. I added import matplotlib as mpl >>> ---------------------start >>> from Tkinter import * >>> from numpy import * >>> import numpy >>> import pylab >>> import Image >>> import ImageChops >>> import ImageTk >>> import time >>> import binascii >>> import tkMessageBox >>> import tkSimpleDialog >>> from pylab import plot, xlabel, ylabel, title, show, xticks, bar >>> import matplotlib as mpl <<<<---------- added >>> >>> from tkFileDialog import asksaveasfilename >>> from tkFileDialog import askopenfilename >>> >>> import MakeQTE >>> >>> import socket >>> >>> ... 500 lines of code >>> >>> I've added the follow code in a function >>> print "pltx_bins: ", pltx_bins >>> print "Off to pylab: ", plt_bins[0:nplt_bins] >>> fig = mpl.figure() >>> v = array(plt_bins) >>> print "v is: ",v >>> print "edges --", linspace(0,256,nplt_bins+1) >>> mpl.histogram(v, bins=linspace(0,256,nplt_bins+1), normed=1)# >>> matplotlib version (plot) >>> mpl.show() >>> print "end of histogram output" >>> # end of function >>> -------------------------end >>> The program dies at fig = figure() with: >>> Exception in Tkinter callback >>> Traceback (most recent call last): >>> File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ >>> return self.func(*args) >>> File >>> "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", >>> line 504, in ShowHistogram >>> fig = mpl.figure() >>> TypeError: 'module' object is not callable >>> >>> What's the problem here? >>> >>> >> figure(), show(), etc. are pylab (or matplotlib.pyplot) functions, not >> matplotlib functions. >> >> Especially for a long program, it is strongly recommended that you not >> use "from numpy import *". The recommended form is >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> It will help you keep a clear picture of where various types of >> functionality are coming from. See also >> http://matplotlib.sourceforge.net/faq/usage_faq.html >> and note that a primarily object-oriented approach is recommended for >> use in other than quick scripts and interactive plotting. >> >> Eric >> > Thanks. Well, that explains a lot! functions in the wrong place. > > I'm pretty new to this stuff, so what belongs where is sometimes > unclear. I'll check out the sourceforge tip. I didn't write the program. > I'm just trying to add some features. Changing the import for matplotlib > got the graphics window up. > import matplotlib.pyplot as plt > > When I ran it, it was followed by this traceback: > ------------start > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__ > return self.func(*args) > File > "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py", > line 508, in ShowHistogram > plt.histogram(v, bins=linspace(0,256,nplt_bins+1), normed=1)# > matplotlib version (plot) > AttributeError: 'module' object has no attribute 'histogram' > ---------------end > 508 line is the histogram. Who's complaining? ShowHistogram? I don't > believe I should be using hist here instead of histogram. histogram is a numpy function, not a pyplot function. Pyplot has a hist which uses numpy.histogram to do the calculation, and then plots it. It does look like plt.hist is what was intended in your code. For tracking down such things, there is no substitute for working interactively with ipython. If you are not already familiar with it, taking a little time to get it running and learn the basics (like tab completion and appending ? or ?? to function names to get docstrings + origins, and source code, respectively) will pay big dividends. Eric > > Off to sourceforge. > |
From: Scott S. <sco...@gm...> - 2009-11-30 05:50:57
|
---------- Forwarded message ---------- From: Scott Sinclair <sco...@gm...> Date: 2009/11/30 Subject: Re: [Matplotlib-users] A Simple Example of histogram Using Range? To: Wayne Watson <sie...@sb...> >2009/11/29 Wayne Watson <sie...@sb...>: > So far matplotlib pretty much leaves the user on his own. Yes, there are > plenty of examples, but there seem to be no explanations about matters > like figure or show. No tutor on any of this I guess. Hi Wayne, The main entry point to the Matplotlib documentation is here http://matplotlib.sourceforge.net/contents.html To get a better understanding on how everything fit together, the best place to start is with the pyplot tutorial http://matplotlib.sourceforge.net/users/pyplot_tutorial.html It's probably also a good idea to read this FAQ entry http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related Once you're comfortable with the concepts introduced in the above, you'll find histogram plotting much easier to follow. Cheers, Scott |