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

Showing results of 339

<< < 1 2 3 4 5 .. 14 > >> (Page 3 of 14)
From: John H. <jd...@gm...> - 2008年05月27日 13:51:14
On Tue, May 27, 2008 at 2:50 AM, Florent Fayette <fa...@lp...> wrote:
> Maybe it comes from LaTeX, does Matplotlib rely on the LaTeX software or
> does it own his own version someh text.usetex : Trueow hardcoded.
It does both. If text.usetex is False, we use our own fonts and
text layout algorithms, which can look quite similar to latex because
we ship some of the computer modern fonts. If text.usetex is True, we
call out to latex and dvipng. If you post the output with the
--verbose-debug flag set, we would know better what is going on on
your system
> python simple_plot.py --verbose-debug > run.out
and post run.out.
JDH
From: Michael D. <md...@st...> - 2008年05月27日 12:47:35
I suspect this is another instance of this recently fixed bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1949982&group_id=80706&atid=560720
You can check out the SVN maintenance branch from here (which has this 
bugfix):
 svn co 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint 
matplotlib-0.91.x
Let us know how that works for you.
We should soon have a release fixing this bug.
Cheers,
Mike
telemeister wrote:
> Further to my original post...
> I forgot to note that I have specified Tkagg as the backend in the
> matplotlibrc file.
> I have Tkinter installed and it works OK in other apps independent of
> matplotlib.
>
>
> telemeister wrote:
> 
>> I've been using matplotlib successfully for some time on Win XP and think
>> it is great. I would like to use on my linux box (Slackware 12 +
>> python2.5)
>>
>> Either interactively, or in script, when the "show()" command is reached,
>> the plot seems to come up momentarily, but then vanishes and I get a
>> segmentation fault. This seems to be happen no matter what I am trying
>> to plot. It is always when it attempts to put the plot on the screen that
>> it fails.
>>
>> A possibly similar fault has been listed earlier in this forum:
>> http://www.nabble.com/segfault-with-TkAgg-and-any-GUI-in-2.5-td9700130.html#a9712842
>>
>> I have been working through some of the suggestions made in that case by
>> John Hunter:
>>
>> Firstly I did following:
>> rm -rf the site-packages/matplotlib and build subdirs and did a clean
>> install of matplotlib.
>>
>> I am upoading files with the outputs from the build and install. I can't
>> see any obvious errors in these but
>> perhaps someone can.
>>
>> http://www.nabble.com/file/p17470177/build.log build.log 
>> http://www.nabble.com/file/p17470177/install.log install.log 
>>
>> As suggested by John H. I Tried importing these packages individually,
>> with results as shown.
>>
>> import matplotlib._image (no problems)
>> import matplotlib._transforms (no problems)
>>
>> import matplotlib.backends._ns_backend_agg # for numpy (Failed: no
>> module named ns_backend_agg)
>>
>> (I'm using numpy)
>>
>> import matplotlib.backends._tkagg (no problems)
>> import matplotlib._agg (no problems)
>>
>>
>> Greatly appreciate any suggestions as to what I could try from here or
>> what other diagnostics I can provide.
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Johann Cohen-T. <co...@sl...> - 2008年05月27日 11:42:10
hello,
when histogramming a distribution in log scale, I have some empty bins, 
which drives the y axis to 1e-100 as a lower limit, completely squashing 
the histogram.... Bug or feature?
Johann
PS To be specific :
In [22]: entries, bins, patches = 
pl.hist(np.array(list1),bins=50,normed=1,log=True)
In [23]: entries
Out[23]:
array([ 1.18347753e+00, 4.10926113e-01, 2.53989507e-01,
 1.84039145e-01, 1.27510992e-01, 9.21486321e-02,
 7.45965117e-02, 5.08495253e-02, 4.23315845e-02,
 3.43298825e-02, 2.78768971e-02, 1.83264787e-02,
 1.62615233e-02, 1.23897320e-02, 1.26478515e-02,
 7.74358253e-03, 4.38803010e-03, 5.93674661e-03,
 3.61367185e-03, 4.38803010e-03, 2.58119418e-03,
 1.29059709e-03, 7.74358253e-04, 1.03247767e-03,
 1.54871651e-03, 2.32307476e-03, 5.16238835e-04,
 2.58119418e-04, 1.03247767e-03, 2.58119418e-04,
 5.16238835e-04, 0.00000000e+00, 2.58119418e-04,
 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
 2.58119418e-04, 2.58119418e-04, 2.58119418e-04,
 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
 0.00000000e+00, 2.58119418e-04])
In [24]: bins
Out[24]:
array([ 3.36150086e-09, 3.87417583e-01, 7.74835162e-01,
 1.16225274e+00, 1.54967032e+00, 1.93708790e+00,
 2.32450548e+00, 2.71192306e+00, 3.09934064e+00,
 3.48675822e+00, 3.87417580e+00, 4.26159338e+00,
 4.64901096e+00, 5.03642854e+00, 5.42384612e+00,
 5.81126370e+00, 6.19868128e+00, 6.58609885e+00,
 6.97351643e+00, 7.36093401e+00, 7.74835159e+00,
 8.13576917e+00, 8.52318675e+00, 8.91060433e+00,
 9.29802191e+00, 9.68543949e+00, 1.00728571e+01,
 1.04602746e+01, 1.08476922e+01, 1.12351098e+01,
 1.16225274e+01, 1.20099450e+01, 1.23973625e+01,
 1.27847801e+01, 1.31721977e+01, 1.35596153e+01,
 1.39470329e+01, 1.43344504e+01, 1.47218680e+01,
 1.51092856e+01, 1.54967032e+01, 1.58841208e+01,
 1.62715383e+01, 1.66589559e+01, 1.70463735e+01,
 1.74337911e+01, 1.78212087e+01, 1.82086262e+01,
 1.85960438e+01, 1.89834614e+01, 1.93708790e+01])
From: Florent F. <fa...@lp...> - 2008年05月27日 07:50:30
Hi,
Thanks for the help but I used the tricks you told me and it's not workign 
either, I removed matlpotlib and reinstalled it and I still have the same
different font. 
On the other hand on a different computer having the same distribution 
(fedora 8) BUT not up to date in the packages and things work just fine.
Maybe it comes from LaTeX, does Matplotlib rely on the LaTeX software or 
does it own his own version somehow hardcoded.
Thanks,
FF
On 2008年5月26日, John Hunter wrote:
> On Mon, May 26, 2008 at 8:32 AM, Florent Fayette <fa...@lp...> wrote:
> > Hello,
> >
> > I am using matplotlib under Fedora 8 and since an updaet I just realised
> > that the default font seems to be serif raher than the previously roman
> > font used in LaTeX, as some people observed it also ?
> >
> > How can I come back to the previous font using the simplest solution ?
> 
> I am not sure what font you used previously, but you can use the
> font.family setting in the matplotlibrc file (copy this file from
> site-packages/matplotlib/mpl-data/matplotlibrc you your home directory
> in the ~/.matplotlib directory and edit it. Eg.
> 
> font.family : sans-serif # for san serif
> 
> Since you mentioned latex, you can use latex to generate all the fonts
> in matplotlib by enabling usetex in matplotlibrc , provided you have
> latex and dvipng installed.
> 
> text.usetex : True
> 
> Finally, if you run your matplotlib test script with --verbose-debug
> you will get lots of extra information about what settings are used
> and what fonts are loaded.
> 
> JDH
> 
> 
From: John H. <jd...@gm...> - 2008年05月26日 17:14:32
On Mon, May 26, 2008 at 10:08 AM, John Hunter <jd...@gm...> wrote:
> On Mon, May 26, 2008 at 7:01 AM, New2Python <new...@li...> wrote:
>
>> I hope someone can give me a simple solution to my problem. I have a line
>> plotted and I need to be able to mark selected data points on the line. I am
>
> If you are frequently changing the zoom level, as it looks like you
> are, the copy background/restore region/blit idiom is probably not the
> right one for you, since the background is assumed fixed. You can
> simply force a draw at any time by doing fig.canvas.draw() w/o having
> to zoom out or resize to trigger a draw. So after doing the
> self.marker.set_data call, I would do fig.canvas.draw
I thought this would be a generally useful thing to do (maintain a
list of toggleable selected vertices) so I added some support. Here is
some example code to highlight the selected markers:
"""
The matplotlib.lines.VertexSelector maintains a list of selected line
vertices using the line picker property. If an unselected vertex is
clicked, it is selected, and if a selected vertex is clicked, it is
unselectedit.
Classes which inherit from the VertexSelector should override the
process_selected method to do something with the selected vertex. This
example just highlights them with red markers. If you don't have
access to svn, I can send you a free-standing example.
"""
The matplotlib.lines.VertexSelector maintains a list of selected line
vertices using the line picker property. If an unselected vertex is
clicked, it is selected, and if a selected vertex is clicked, it is
unselectedit.
Classes which inherit from the VertexSelector should override the
process_selected method to do something with the selected vertex. This
example just highlights them with red markers.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as lines
class HighlightSelected(lines.VertexSelector):
 """
 Highlight the selected vertices with a marker plot
 """
 def __init__(self, line, fmt='ro', **kwargs):
 """
 highlight the selected vertices of line with a marker plot.
 The plot format string are given by fmt and the kwargs are additional
 line properties
 """
 lines.VertexSelector.__init__(self, line)
 self.markers, = self.axes.plot([], [], fmt, **kwargs)
 def process_selected(self, ind, xs, ys):
 """
 ind are the indices of the selected vertices. xs and ys are
 the coordinates of the selected vertices.
 """
 self.markers.set_data(xs, ys)
 self.canvas.draw()
fig = plt.figure()
ax = fig.add_subplot(111)
x, y = np.random.rand(2, 30)
line, = ax.plot(x, y, 'bs-', picker=5)
selector = HighlightSelected(line)
plt.show()
From: John H. <jd...@gm...> - 2008年05月26日 15:15:06
On Mon, May 26, 2008 at 8:32 AM, Florent Fayette <fa...@lp...> wrote:
> Hello,
>
> I am using matplotlib under Fedora 8 and since an updaet I just realised
> that the default font seems to be serif raher than the previously roman
> font used in LaTeX, as some people observed it also ?
>
> How can I come back to the previous font using the simplest solution ?
I am not sure what font you used previously, but you can use the
font.family setting in the matplotlibrc file (copy this file from
site-packages/matplotlib/mpl-data/matplotlibrc you your home directory
in the ~/.matplotlib directory and edit it. Eg.
 font.family : sans-serif # for san serif
Since you mentioned latex, you can use latex to generate all the fonts
in matplotlib by enabling usetex in matplotlibrc , provided you have
latex and dvipng installed.
 text.usetex : True
Finally, if you run your matplotlib test script with --verbose-debug
you will get lots of extra information about what settings are used
and what fonts are loaded.
JDH
From: John H. <jd...@gm...> - 2008年05月26日 15:08:33
On Mon, May 26, 2008 at 7:01 AM, New2Python <new...@li...> wrote:
> I hope someone can give me a simple solution to my problem. I have a line
> plotted and I need to be able to mark selected data points on the line. I am
If you are frequently changing the zoom level, as it looks like you
are, the copy background/restore region/blit idiom is probably not the
right one for you, since the background is assumed fixed. You can
simply force a draw at any time by doing fig.canvas.draw() w/o having
to zoom out or resize to trigger a draw. So after doing the
self.marker.set_data call, I would do fig.canvas.draw
If you have a lot of data and only a little in the viewport and
efficiency is a concern, you can use a "clipped line" class, as in the
example http://matplotlib.sf.net/examples/clippedline.py
Let me know if this helps,
JDH
From: John H. <jd...@gm...> - 2008年05月26日 14:52:27
On Mon, May 26, 2008 at 7:26 AM, telemeister <st...@ve...> wrote:
>
> Further to my original post...
> I forgot to note that I have specified Tkagg as the backend in the
> matplotlibrc file.
> I have Tkinter installed and it works OK in other apps independent of
> matplotlib
Let's see if we can narrow tis down to a specific backend. Try
running http://matplotlib.sf.net/examples/simple_plot.py with
a few different backends:
> python simple_plot.py --verbose-debug -dAgg
> python simple_plot.py --verbose-debug -dPS
> python simple_plot.py --verbose-debug -dTkAgg
> python simple_plot.py --verbose-debug -dGTK
Do they all segfault, if not which ones do and post the debug output
for one that does.
JDH
From: Florent F. <fa...@lp...> - 2008年05月26日 14:10:49
Hello,
I am using matplotlib under Fedora 8 and since an updaet I just realised 
that the default font seems to be serif raher than the previously roman 
font used in LaTeX, as some people observed it also ?
How can I come back to the previous font using the simplest solution ?
Thanks in advance for your help,
FF
From: telemeister <st...@ve...> - 2008年05月26日 12:26:37
Further to my original post...
I forgot to note that I have specified Tkagg as the backend in the
matplotlibrc file.
I have Tkinter installed and it works OK in other apps independent of
matplotlib.
telemeister wrote:
> 
> I've been using matplotlib successfully for some time on Win XP and think
> it is great. I would like to use on my linux box (Slackware 12 +
> python2.5)
> 
> Either interactively, or in script, when the "show()" command is reached,
> the plot seems to come up momentarily, but then vanishes and I get a
> segmentation fault. This seems to be happen no matter what I am trying
> to plot. It is always when it attempts to put the plot on the screen that
> it fails.
> 
> A possibly similar fault has been listed earlier in this forum:
> http://www.nabble.com/segfault-with-TkAgg-and-any-GUI-in-2.5-td9700130.html#a9712842
> 
> I have been working through some of the suggestions made in that case by
> John Hunter:
> 
> Firstly I did following:
> rm -rf the site-packages/matplotlib and build subdirs and did a clean
> install of matplotlib.
> 
> I am upoading files with the outputs from the build and install. I can't
> see any obvious errors in these but
> perhaps someone can.
> 
> http://www.nabble.com/file/p17470177/build.log build.log 
> http://www.nabble.com/file/p17470177/install.log install.log 
> 
> As suggested by John H. I Tried importing these packages individually,
> with results as shown.
> 
> import matplotlib._image (no problems)
> import matplotlib._transforms (no problems)
> 
> import matplotlib.backends._ns_backend_agg # for numpy (Failed: no
> module named ns_backend_agg)
> 
> (I'm using numpy)
> 
> import matplotlib.backends._tkagg (no problems)
> import matplotlib._agg (no problems)
> 
> 
> Greatly appreciate any suggestions as to what I could try from here or
> what other diagnostics I can provide.
> 
-- 
View this message in context: http://www.nabble.com/linux%3A-seg-fault-on-show%28%29-tp17470177p17471022.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: New2Python <new...@li...> - 2008年05月26日 12:01:06
Hi All,
I hope someone can give me a simple solution to my problem. I have a line
plotted and I need to be able to mark selected data points on the line. I am
using the mpl_connect function to detect the mouseclick on the line and then
to place a marker at the selected datapoint. My data is 0.2s apart on a
1hour plot, so to click on a single data point i need to zoom into the
graph. Once I zoom in and select the data point, the marker doesn't appear
until the graph is resized or refreshed by the home button. Also, if I click
on an existing datapoint, is is removed in the array however when the graph
is redrawn or refreshed the marker is not deleted. Below is an exert of the
code. I am using embedded_wx4.py as a template. So the question is, how can
i show the marker at the zoomed level, it is apain to have to zoom out to
home view every time and why won't my redraw work. If there is any ambiguity
please let me know and I'll try to re-explain myself.
 def _on_addmarker(self, evt): #defined from toolbar button
 datamarker = self.canvas.mpl_connect('pick_event', self.onpick1)
 evt.Skip()
 
 def onpick1(self, event):
 self.background_marker=self.canvas.copy_from_bbox(self.axes.bbox)
 self.marker, = self.axes.plot(x,y, 'go',markersize=8)
 
 if isinstance(event.artist, Line2D):
 thisline=event.artist
 xdata = thisline.get_xdata()
 ydata = thisline.get_ydata()
 ind = event.ind
 tempx = xdata[ind]
 tempy = ydata[ind]
 print '------------'
 print 'onpick1 line X:' ,tempx
 print 'onpick1 line ind:' ,ind
 print 'onpick1 line Y:' ,tempy
 if xdata[ind] in x:
 x.remove(tempx)
 y.remove(tempy)
 print '------------'
 print 'you removed ' ,ind ,tempx ,tempy
 print 'X=' ,x
 print 'Y=' ,y
 print '------------'
 
 else:
 x.append(tempx)
 y.append(tempy)
 print 'you clicked ' ,x ,y
 print '------------'
 time.sleep(0.1) 
#----------------------------------------------------------------------------------------- 
 self.canvas.restore_region(self.background_marker) 
 self.marker.set_data(x,y) 
 self.axes.draw_artist(self.marker)
 self.canvas.blit(self.axes.bbox) 
and
class CanvasFrame(Frame):
 global line, background
 def __init__(self):
 Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))
 self.SetBackgroundColour(NamedColor("WHITE"))
 self.figure = Figure(figsize=(5,4), dpi=100)
 self.axes = self.figure.add_subplot(111)
 picker = 5
 self.line, = self.axes.plot(cx,cy,picker=picker, linewidth=1)
etc..etc...
-- 
View this message in context: http://www.nabble.com/Plotting-single-marker-point-at-zoomed-level-tp17470649p17470649.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: telemeister <st...@ve...> - 2008年05月26日 11:24:03
I've been using matplotlib successfully for some time on Win XP and think it
is great. I would like to use on my linux box (Slackware 12 + python2.5)
Either interactively, or in script, when the "show()" command is reached,
the plot seems to come up momentarily, but then vanishes and I get a
segmentation fault. This seems to be happen no matter what I am trying to
plot. It is always when it attempts to put the plot on the screen that it
fails.
A possibly similar fault has been listed earlier in this forum:
http://www.nabble.com/segfault-with-TkAgg-and-any-GUI-in-2.5-td9700130.html#a9712842
I have been working through some of the suggestions made in that case by
John Hunter:
Firstly I did following:
rm -rf the site-packages/matplotlib and build subdirs and did a clean
install of matplotlib.
I am upoading files with the outputs from the build and install. I can't see
any obvious errors in these but
perhaps someone can.
http://www.nabble.com/file/p17470177/build.log build.log 
http://www.nabble.com/file/p17470177/install.log install.log 
As suggested by John H. I Tried importing these packages individually, with
results as shown.
 import matplotlib._image (no problems)
 import matplotlib._transforms (no problems)
 import matplotlib.backends._ns_backend_agg # for numpy (Failed: no module
named ns_backend_agg)
(I'm using numpy)
 import matplotlib.backends._tkagg (no problems)
 import matplotlib._agg (no problems)
Greatly appreciate any suggestions as to what I could try from here or what
other diagnostics I can provide.
-- 
View this message in context: http://www.nabble.com/linux%3A-seg-fault-on-show%28%29-tp17470177p17470177.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2008年05月25日 13:09:00
On Sun, May 25, 2008 at 5:19 AM, Gregor Thalhammer
<gre...@gm...> wrote:
> matplotlib is _not_ a dedicated image manipulation package, so please
> don't blame it that you don't manage to easily use it as such one.
> However, matplotlib indeed offers high quality image scaling abilities
> (at the moment not for downscaling) due to the use of Agg.
While mpl it is not a general purporse image library as you say, it
would be nice if we exposed a minimal set of image functionality so
users could take advantage of agg's nice rescaling. Easy stuff should
be easy.... I did add support for PIL loading in imread, so if you
have it you will use it. Thus in svn you can do, if PIL is installed,
 X = imread('somefile.jpg') # or any other format supported by PIL
This will help reduce the boilerplate.
I would like to expose at least a resize and rotation from agg, with a
choice of interpolation schemes, exposed at the array level and not
just the display level. I think agg2.4 also added some new
interpolation schemes designed to support down-sampling which is
useful for large mega-pixel images, and these haven't been exposed
since I wrote the original interpolation options against agg2.3.
In testing this stuff, I found a bug bug in image handling on the
trunk -- if you zoom to part of an image with zoom-to-rect, the part
that you get zoomed to is not the part you select. This is most
apparent if you load an image with easily recognizable features, eg a
picture of a person. This problem is on the trunk but not the branch
-- here is some example code:
In [8]: fig = plt.figure()
In [9]: ax = fig.add_subplot(111)
In [10]: ax.set_aspect('auto')
In [11]: X = imread('/Users/jdhunter/Desktop/IMG_0907.JPG')
In [12]: ax.imshow(X, origin='lower', aspect='auto')
Out[12]: <matplotlib.image.AxesImage object at 0x112586b0>
In [13]: ax.figure.canvas.draw()
In [14]: ax.cla()
In [15]: ax.set_aspect('auto')
In [16]: ax.imshow(X, origin='upper', aspect='auto')
Out[16]: <matplotlib.image.AxesImage object at 0x11258690>
In [17]: fig.canvas.draw()
From: Wolfgang L. <wol...@pa...> - 2008年05月25日 12:08:09
thanks for your answer, i have come to understand that matplotlib is not 
dedicated to raster image manipulation. a nice person pointed out to me 
how to do that in cairo:
img = cairo.ImageSurface.create_from_png( 'c:/temp/tel-hotline.png' )
width = img.get_width()
height = img.get_height()
imgpat = cairo.SurfacePattern(img)
scaler = cairo.Matrix()
#1 = 100%; 2 = 50%;0.5 = 200%
scaler.scale(3,0.5)
imgpat.set_matrix(scaler)
#set resampling filter
imgpat.set_filter(cairo.FILTER_BEST)
canvas = cairo.ImageSurface(cairo.FORMAT_ARGB32,320,240)
ctx = cairo.Context(canvas)
ctx.set_source(imgpat)
ctx.paint()
canvas.write_to_png( 'c:/temp/helo-modified.png' )
that's a bit of code but i'm writing a wrapper `def scale_image()` 
anyhow. the data flow seems reasonable. alas, it only works for *.png, 
no *.jpg support. still i guess i'll go with cairo as it's seemingly 
used inside firefox3 and does impressively good scaling.
cheers & ~flow
Gregor Thalhammer wrote:
> > [had to delete an endless amount of stuff not related to matplotlib]
>
> matplotlib is _not_ a dedicated image manipulation package, so please 
> don't blame it that you don't manage to easily use it as such one. 
> However, matplotlib indeed offers high quality image scaling abilities 
> (at the moment not for downscaling) due to the use of Agg.
>
> If you want a simpler solution, try this:
>
> import wx
> img = wx.Image('your image.jpg')
> scale = 2
> img.Rescale(img.Width * scale, img.Height * scale, wx.IMAGE_QUALITY_HIGH)
> img.SaveFile('your scaled image.jpg')
>
> Gregor
>
>
From: Gregor T. <gre...@gm...> - 2008年05月25日 10:20:02
 > [had to delete an endless amount of stuff not related to matplotlib]
matplotlib is _not_ a dedicated image manipulation package, so please 
don't blame it that you don't manage to easily use it as such one. 
However, matplotlib indeed offers high quality image scaling abilities 
(at the moment not for downscaling) due to the use of Agg.
If you want a simpler solution, try this:
import wx
img = wx.Image('your image.jpg')
scale = 2
img.Rescale(img.Width * scale, img.Height * scale, wx.IMAGE_QUALITY_HIGH)
img.SaveFile('your scaled image.jpg')
Gregor
From: Bing <bin...@gm...> - 2008年05月25日 03:52:09
Hi John,
 Thanks for the hint. I am able to pass the rect returned by
Subplot.get_position().
Bing
On Sat, May 24, 2008 at 9:27 PM, John Hunter <jd...@gm...> wrote:
> On Sat, May 24, 2008 at 4:08 PM, Bing <bin...@gm...> wrote:
> > Hello,
> > Could anyone tell me how to use plot3D in a subplot?
> > I looked at the examples at
> > http://www.scipy.org/Cookbook/Matplotlib/mplot3D
> > But seems to me that matplotlib.axes3d.Axes3D can
> > be only constructed from a Figure instance but
> > not from a Subplot instance.
>
> You should be able to set the rect keyword argument of the Axes3D
> constructor:
>
> fig=p.figure()
> ax = pylab.Axes3D(fig, rect=[0.2, 0.6, 0.7, 0.3])
>
> where rect is [left, bottom, width, height] in fractions of the figure 0..1
>
> A subplot is just an axes with a rect set so that it lives on a regular
> grid.
>
> Note though that the 3D stuff is experimental, slow, somewhat buggy
> and not supported, so we won't be able to help much with real
> problems.
>
> JDH
>
From: John H. <jd...@gm...> - 2008年05月25日 01:27:14
On Sat, May 24, 2008 at 4:08 PM, Bing <bin...@gm...> wrote:
> Hello,
> Could anyone tell me how to use plot3D in a subplot?
> I looked at the examples at
> http://www.scipy.org/Cookbook/Matplotlib/mplot3D
> But seems to me that matplotlib.axes3d.Axes3D can
> be only constructed from a Figure instance but
> not from a Subplot instance.
You should be able to set the rect keyword argument of the Axes3D constructor:
 fig=p.figure()
 ax = pylab.Axes3D(fig, rect=[0.2, 0.6, 0.7, 0.3])
where rect is [left, bottom, width, height] in fractions of the figure 0..1
A subplot is just an axes with a rect set so that it lives on a regular grid.
Note though that the 3D stuff is experimental, slow, somewhat buggy
and not supported, so we won't be able to help much with real
problems.
JDH
From: Bing <bin...@gm...> - 2008年05月24日 21:08:17
Hello,
 Could anyone tell me how to use plot3D in a subplot?
I looked at the examples at
 http://www.scipy.org/Cookbook/Matplotlib/mplot3D
But seems to me that matplotlib.axes3d.Axes3D can
be only constructed from a Figure instance but
not from a Subplot instance.
Thanks,
Bing
Mike,
That fixes things for me - many thanks. Unrelated, but to build from SVN 
I had to go diving in setupext.py to say that the tk include files are in:
/usr/include/tcl8.4
... while the tcl install home is /usr/share/tcltk. The command "locate 
tk.h" was particularly useful.
Many thanks again,
Jon
Michael Droettboom wrote:
> I assume you're using the matplotlib 0.91.2 that's distributed with 
> Ubuntu 8.04.
> 
> There was a recent fix for segfaulting in the exact same place (outside 
> of any sort of freezing apparatus). Since it was related to the 
> interpretation of a pointer, it's possible that you would see this 
> inside of cx-freeze and not outside on the same machine, just because 
> things get loaded into different parts of memory. I would try that fix 
> first, and then look at problems related to freezing.
> 
> We should have a new release out shortly, but it's unclear how long that 
> will take to trickle down into Ubuntu repositories.
> 
> You can check out the SVN maintenance branch from here (which has this 
> bugfix):
> 
> svn co 
> https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint 
> matplotlib-0.91.x
> 
> Let us know how that works for you.
> 
> Cheers,
> Mike
> 
> Jonathan Wright wrote:
>> Hello,
>>
>> I am getting segmentation faults when I try to freeze a script which 
>> uses the TkAgg backend, on python2.5.2, gcc 4.2.3 (ubuntu 8.04, hardy 
>> heron). A trial script is:
>>
>> import matplotlib
>> matplotlib.use("TkAgg") # unless you have it in matplotlibrc
>> import matplotlib.backends.backend_tkagg # explicit for freezer
>> from matplotlib.pylab import plot, show
>> plot(range(10), range(10), "+")
>> show()
>>
>> Is anyone already familiar with the problem? Things seem to work with 
>> the GTkAgg backend, but sadly many years ago I decided to use Tk as I 
>> thought it'd be easier to distribute. In order to reproduce the 
>> problem with bbfreeze you should just need this freezing script:
>>
>> from bbfreeze import Freezer
>> f = Freezer("dist",
>> includes=("matplotlib",
>> "matplotlib.numerix.fft",
>> "matplotlib.numerix.linear_algebra",
>> "matplotlib.numerix.ma",
>> "matplotlib.numerix.mlab",
>> "matplotlib.numerix.random_array"))
>> f.addScript("t.py")
>> f()
>>
>> For reproducing the problem with cx-freeze you need to (a) install it 
>> by patching the cx-freeze setup.py [so that (2, 5) -> (2, 6)] and (b) 
>> add an import for numpy.linalg.lapack_lite and edit your 
>> numpy.__init__ to remove numpy.test.
>>
>> Thanks for any advice,
>>
>> Jon
>> ---
>>
>> PS: gdb says
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb7c806b0 (LWP 8158)]
>> 0xb6e145a0 in ?? () from 
>> /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so 
>>
>> (gdb) bt
>> #0 0xb6e145a0 in ?? () from 
>> /home/wright/testcx/build/exe.linux-i686-2.5/matplotlib.backends._tkagg.so 
>>
>> #1 0xb6badb6e in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
>> #2 0xb6baee56 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
>> #3 0xb6baf0db in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
>> #4 0xb6ef96c6 in ?? () from 
>> /home/wright/testcx/build/exe.linux-i686-2.5/_tkinter.so
>> #5 0x0827a0c8 in ?? ()
>> #6 0x00000005 in ?? ()
>> ...
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft Defy all challenges. 
>> Microsoft(R) Visual Studio 2008. 
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
> 
From: Neil C. <nei...@gm...> - 2008年05月24日 09:04:53
Thanks! I also found the description under the class
RegularPolyCollection in collections.py:
* sizes gives the area of the circle circumscribing the regular
polygon in points^2
Neil
Manuel wrote:
> Hi Neil,
>
> good eyes ;-) Have a look at the scatter documentation:
>
> "s is a size in points^2. It is a scalar
> or an array of the same length as x and y."
>
> Manuel
>
> Neil Crighton wrote:
>> I'd like to plot values where the area of a marker is proportional to
>> some value. How is the size value given in, say:
>>
>> scatter(x,y,'o',s=10)
>>
>> used to generate the markers? By eye it looks like the size value is
>> proportional to the area (i.e. proportional to the radius squared for
>> circle markers), but it would be nice to know for sure.
>
From: Eric F. <ef...@ha...> - 2008年05月24日 07:39:28
I added a function and a method to control the color cycle. See 
examples/api/color_cycle.py, and r5250.
Eric
Eric Firing wrote:
> John Hunter wrote:
>> On Mon, May 19, 2008 at 8:38 AM, Zoho Vignochi <zoh...@gm...> wrote:
>>> Hello:
>>>
>>> I want to plot a variable number of lines but I would like the colors to
>>> cycle through a set pattern defined by me.
>>> ...snip
>>> and it works great. But I need legends for each line so I can't use
>>> collections. I would like to choose the colors and loop over a list if
>>> the lines exceed the colors while using plot. Any ideas?
>> You can override the default color cycle:
>>
>> import matplotlib.axes
>>
>> matplotlib.axes._process_plot_var_args.defaultColors =
>> [k','y','m','c','b','g','r']
>>
>> We should remove the leading underscore in the _process_plot_var_args
>> since it indicates users should not be working with it, but
>> customizing the color cycle is perfectly legit.
> 
> True, but from the standpoint of user interface design this may not be a 
> good way to do it. At the very least, shouldn't there be a more concise 
> variable or function? _process_plot_var_args really deserves its 
> leading underscore. We could use something like an axes-level function, 
> "set_color_cycle(clist)" to encapsulate what you suggest above.
> 
> Eric
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft 
> Defy all challenges. Microsoft(R) Visual Studio 2008. 
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Wolfgang L. <wol...@pa...> - 2008年05月23日 19:10:19
matploblib communication problem, graphics question
==========================================
i've had a hard time today to drill down on some infos
about matplotlib of http://matplotlib.sourceforge.net/.
this is an sf.net-managed project, its mailing lists are
managed by <shudder/> gnu mailman in a pre-1994 version.
still there is a sf.net standard forum interface, which
however denies me to post. i've set up an account on
sourceforge---not an experience i need; boarding an
intercontinental flight is swift in comparison.
but having an account on sf.net is not enough to post to
a mailing list there, so i filled out a second longish
form to subscribe to the list thru the <horrors/>
mailman interface. i had to re-enter my email address.
now what is left to me is to try writing directly to
mat...@li... and then scoop
it up on 
http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users
as it is so incredibly hard to make oneself heard on
the matplotlib list, i realized that questions from
outsiders are maybe not welcome, so i do a cross-post
to reach more audience.
i need to do some raster-image scaling and i've been
hunting hi and lo for a python library that can do that.
so far choices are (in order of perceived aptness)::
imagemagick of old,
pythonware.com/products/pil,
antigrain.com,
matplotlib,
cairo of cairographics.org.
Cairo is definitely may favorite here. i know with
certainty that cairo is good at scaling images, as
firefox3 is using it to achieve a smoothness and
readability in scaled images that rivals the quality
of safari’s.
but i have been unable to uncover any information
about raster-image scaling in cairo---can’t be, right?
an open source project that becomes part of firefox3
and i can’t find out how to use their flagship
functionality?
so i went to matplotlib. i now have these methods to
open image files with matplotlib::
def get_image_jpg():
import Image
from pylab import *
import numpy
print dir( numpy )
from numpy import int8, uint8
# these lines are incredible -- just open that damn jpg. can be as 
simple as `load(route)` -- ALL the pertinent
# information well be in time derived from the route and the routed 
resource structure (the router, and the
# routee). pls someone giveme a `MATPLOBLIB.read()`, a 
`MATPLOBLIB.load()`, or a `MATPLOBLIB.get()` already.
image = Image.open( image_locator )
rgb = fromstring( image.tostring(), uint8 ).astype( float ) / 255.0
# rgb = resize( rgb,( image.size[ 1 ], image.size[ 0 ], 3 ) )
rgb = resize( rgb,( 100, 150, 3 ) )
imshow( rgb, interpolation = 'nearest' )
axis( 'off' ) # don’tdisplaytheimageaxis
show()
def get_image_png( image_locator ):
from pylab import imread as _read_png
from pylab import imshow as _show_image
from pylab import gray
from pylab import mean
a = imread( image_locator )
#generates a RGB image, so do
aa=mean(a,2) # to get a 2-D array
imshow(aa)
gray()
quite incredible, right? it can somehow be done, but
chances are you drown in an avalanche of boiler plate.
and sorry for the shoddy code, i copied it from their
website.
so they use pil to open an image file. pil’s image
scaling is 1994, and the package is hardly maintained
and not open. yuck. whenever you have a question
about imaging in python people say ‘pill’ like they
have swallowed one.
let’s face it, pil is a bad choice to do graphics.
here i did install pil, because matplotlib seemed to
be basically handling raster-images and image
transformations.
the matplotlib people have the nerve to put a short
doc to their root namespace items, as are, `axhspan`,
`cla`, `gcf`, and such more. this interface is
hardly usable. it shouldn’t be that hard to open an
image file in an image manipulation library. nobody
wants to maintain that kind of sphpaghetti.
i haven’t been succesful so far to find out how to
scale an image in cairo or matlotlib, or an other
alternative. please don’t sugggest doing it with
pil or imagemagick, i won’t answer.
is there any coherent python imaging interest group
out there? can i do it with pyglet maybe?
cheers & ~flow
From: Darren D. <dar...@co...> - 2008年05月23日 16:39:36
On Friday 23 May 2008 12:25:39 pm Friedrich Hagedorn wrote:
> On Fri, May 23, 2008 at 05:30:02PM +0200, Friedrich Hagedorn wrote:
> > The next problem is that the standard size of the mpl graphic (8, 6)
> > inches is too big for my latex document (0.5\linewidth). Therefore I must
> > scale the mpl graphic (\includegraphics[width=0.5\linewidth]{...}). But
> > with this scaling the font in the mpl graphic are also scaled and I have
> > no chance adapeting the two fonts (mpl, latex) without manual iterations.
> >
> > Ok, I could adjust the figsize but the last time I did it (long time ago)
> > there were other misplaced objects in the mpl graphic (I dont remember
> > exactly, sorry).
>
> I tried this now with (width = 7cm = 2.67in)
>
> In [1]: figure(figsize=(2.67,2))
> Out[1]: <matplotlib.figure.Figure object at 0x8c3b36c>
>
> In [2]: subplot(111)
> Out[2]: <matplotlib.axes.AxesSubplot object at 0x8c3b3ec>
>
> and the problem is that the remaining (abolute) space of the margin
> ist too small for the whole labeling (ticks and axis). But I dont
> want to adjust all the default values every time a what a plot in
> my latex document.
>
> On Fri, May 23, 2008 at 12:00:03PM -0400, Darren Dale wrote:
> > Wouldn't this cause some problems with how the text is layed out on
> > the canvas? The way it works now, a title can be centered over the axes
> > because the extents of the text are known. If you allow the fonts and
> > font sizes to be dictated by the latex document, they will end up being
> > positioned incorrectly.
>
> Shortly: Yes this is a problem but pgf could solve it.
>
> I dont know it exactly but if you do all the graphic stuff with pgf in
> latex so you can adjust the text boxes in a various way in respect to
> different points. E.g. baseline -left, -right, -center and so on. This is
> explaind in the pgfmanual in section 53.3.3.
>
> If I fly over the pgfmanual I get the impression that I could do
> everything with it :-) But to do this its a hard work (for beginners).
>
> Therefore I like to have the convinient pylab-interface to create pretty
> standard plots for latex.
I'll keep it in mind, but I have just committed myself to another mpl-related 
project for the summer, so I dont think I will have time to look into this 
for a while. But we love code submissions...
From: Friedrich H. <fri...@gm...> - 2008年05月23日 16:25:45
On Fri, May 23, 2008 at 05:30:02PM +0200, Friedrich Hagedorn wrote:
>
> The next problem is that the standard size of the mpl graphic (8, 6) inches
> is too big for my latex document (0.5\linewidth). Therefore I must scale
> the mpl graphic (\includegraphics[width=0.5\linewidth]{...}). But with this
> scaling the font in the mpl graphic are also scaled and I have no chance
> adapeting the two fonts (mpl, latex) without manual iterations.
> 
> Ok, I could adjust the figsize but the last time I did it (long time ago)
> there were other misplaced objects in the mpl graphic (I dont remember
> exactly, sorry).
I tried this now with (width = 7cm = 2.67in)
In [1]: figure(figsize=(2.67,2))
Out[1]: <matplotlib.figure.Figure object at 0x8c3b36c>
In [2]: subplot(111)
Out[2]: <matplotlib.axes.AxesSubplot object at 0x8c3b3ec>
and the problem is that the remaining (abolute) space of the margin
ist too small for the whole labeling (ticks and axis). But I dont
want to adjust all the default values every time a what a plot in
my latex document.
On Fri, May 23, 2008 at 12:00:03PM -0400, Darren Dale wrote:
>
> Wouldn't this cause some problems with how the text is layed out on
> the canvas? The way it works now, a title can be centered over the axes 
> because the extents of the text are known. If you allow the fonts and 
> font sizes to be dictated by the latex document, they will end up being 
> positioned incorrectly.
Shortly: Yes this is a problem but pgf could solve it.
I dont know it exactly but if you do all the graphic stuff with pgf in
latex so you can adjust the text boxes in a various way in respect to
different points. E.g. baseline -left, -right, -center and so on. This is
explaind in the pgfmanual in section 53.3.3.
If I fly over the pgfmanual I get the impression that I could do 
everything with it :-) But to do this its a hard work (for beginners).
Therefore I like to have the convinient pylab-interface to create pretty
standard plots for latex.
By, Friedrich
From: Manuel M. <mm...@as...> - 2008年05月23日 16:12:04
Neil Crighton wrote:
> I'd like to plot values where the area of a marker is proportional to
> some value. How is the size value given in, say:
> 
> scatter(x,y,'o',s=10)
> 
> used to generate the markers? By eye it looks like the size value is
> proportional to the area (i.e. proportional to the radius squared for
> circle markers), but it would be nice to know for sure.
Hi Neil,
good eyes ;-) Have a look at the scatter documentation:
"s is a size in points^2. It is a scalar
or an array of the same length as x and y."
Manuel
> Thanks,
> Neil
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
1 message has been excluded from this view by a project administrator.

Showing results of 339

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