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

Showing results of 509

1 2 3 .. 21 > >> (Page 1 of 21)
From: Josh H. <jh...@vn...> - 2009年07月31日 22:42:21
Fernando Perez wrote:
> 
> Please! That example with the top labels looks great, and it's a very
> useful way of displaying the numerical key parts of the dataset.
> 
> Cheers,
> 
> f
> 
OK, here is a bloxplot example based on the one previously shown. I just
replaced my environmental data with some random data to make things easier
to run, and accordingly I had to make up some story around the data (testing
bootstrap resampling). Fee free to rework the code as you see fit, but
hopefully this is a helpful example.
http://www.nabble.com/file/p24764036/boxplotExampleForums.png 
--------------------------
boxplotdemo.py
--------------------------
import numpy as np
import matplotlib.pyplot as plt 
from matplotlib.patches import Polygon
#Generate some data from five different probability distributions, each with
#different characteristics. We want to play with how an IID bootstrap
resample
#of the data preserves the distributional properties of the original sample,
and
#a boxplot is one visual tool to make this assessment 
numDists = 5
randomDists = ['Normal(1,1)',' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)', 
 'Triangular(2,9,11)']
N = 500
norm = np.random.normal(1,1, N)
logn = np.random.lognormal(1,1, N)
expo = np.random.exponential(1, N)
gumb = np.random.gumbel(6, 4, N)
tria = np.random.triangular(2, 9, 11, N)
#Generate some random indices that we'll use to resample the original data 
#arrays. For code brevity, just use the same random indices for each array
bootstrapIndices = np.random.random_integers(0, N-1, N)
normBoot = norm[bootstrapIndices]
expoBoot = expo[bootstrapIndices]
gumbBoot = gumb[bootstrapIndices]
lognBoot = logn[bootstrapIndices]
triaBoot = tria[bootstrapIndices]
data = [norm, normBoot, logn, lognBoot, expo, expoBoot, gumb, gumbBoot,
 tria, triaBoot]
fig = plt.figure(figsize=(10,6))
fig.canvas.set_window_title('A Boxplot Example') 
ax1 = fig.add_subplot(111)
plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) 
bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5)
plt.setp(bp['boxes'], color='black')
plt.setp(bp['whiskers'], color='black')
plt.setp(bp['fliers'], color='red', marker='+')
#Add a horizontal grid to the plot, but make it very light in color so we
can 
#use it for reading data values but not be distracting
ax1.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', 
 alpha=0.5)
#Hide these grid behind plot objects
ax1.set_axisbelow(True) 
ax1.set_title('Comparison of IID Bootstrap Resampling Across Five
Distributions')
ax1.set_xlabel('Distribution') 
ax1.set_ylabel('Value')
#Now fill the boxes with desired colors
boxColors = ['darkkhaki','royalblue']
numBoxes = numDists*2
medians = range(numBoxes)
for i in range(numBoxes):
 box = bp['boxes'][i]
 boxX = []
 boxY = []
 for j in range(5):
 boxX.append(box.get_xdata()[j])
 boxY.append(box.get_ydata()[j])
 boxCoords = zip(boxX,boxY)
 #Alternate between Dark Khaki and Royal Blue
 k = i % 2
 boxPolygon = Polygon(boxCoords, facecolor=boxColors[k])
 ax1.add_patch(boxPolygon)
 #Now draw the median lines back over what we just filled in
 med = bp['medians'][i]
 medianX = []
 medianY = []
 for j in range(2):
 medianX.append(med.get_xdata()[j])
 medianY.append(med.get_ydata()[j])
 plt.plot(medianX, medianY, 'k')
 medians[i] = medianY[0]
 #Finally, overplot the sample averages, with horixzontal alignment in the 
 #center of each box
 plt.plot([np.average(med.get_xdata().data)], [np.average(data[i])], 
 color='w', marker='*', markeredgecolor='k')
#Set the axes ranges and axes labels
ax1.set_xlim(0.5, numBoxes+0.5) 
top = 40
bottom = -5
ax1.set_ylim(bottom, top) 
xtickNames = plt.setp(ax1, xticklabels=np.repeat(randomDists, 2))
plt.setp(xtickNames, rotation=45, fontsize=8)
#Due to the Y-axis scale being different across samples, it can be hard to 
#compare differences in medians across the samples. Add upper X-axis tick
labels
#with the sample medians to aid in comparison (just use two decimal places
of
#precision)
pos = np.arange(numBoxes)+1
upperLabels = [str(np.round(s, 2)) for s in medians]
weights = ['bold', 'semibold']
for tick,label in zip(range(numBoxes),ax1.get_xticklabels()):
 k = tick % 2
 ax1.text(pos[tick], top-(top*0.05), upperLabels[tick], 
 horizontalalignment='center', size='x-small', weight=weights[k],
 color=boxColors[k])
#Finally, add a basic legend 
plt.figtext(0.80, 0.08, str(N) + ' Random Numbers' , 
 backgroundcolor=boxColors[0], color='black', weight='roman', 
 size='x-small')
plt.figtext(0.80, 0.045, 'IID Bootstrap Resample',
backgroundcolor=boxColors[1],
 color='white', weight='roman', size='x-small')
plt.figtext(0.80, 0.015, '*', color='white', backgroundcolor='silver', 
 weight='roman', size='medium') 
plt.figtext(0.815, 0.013, ' Average Value', color='black', weight='roman', 
 size='x-small')
plt.show()
-----
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jh...@vn... | P 720.407.4214 | F 720.407.4199 
-- 
View this message in context: http://www.nabble.com/Radar---Spider-Chars-tp17876254p24764036.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Lukas H. <Lu...@gm...> - 2009年07月31日 20:07:19
Hello,
I have y values in the range of -100 to 100.
I want that the negative values are shown as positive (the minus gets removed 
from the output).
I tried a for loop over all self.ax.get_yticklabels() and call 
label.set_text("...") on each item but it didn't work - nothing got changed.
If I print the label in the loop they seem to be empty:
Text(0,0,'') 
Text(0,0,'') 
Text(0,0,'') 
......
Is there anything I do wrong?
Thanks,
Lukas
From: Bas v. L. <le...@gm...> - 2009年07月31日 19:45:11
Hello,
I tried to implement a solution for this issue. Basically I want to
give the x and y position in datacoords and the width + height in
pixels.
However, when using the following code:
 im = Image.open("../Icons/Program Icon.png")
 limx = self.mainAxes.get_xlim()
 limy = self.mainAxes.get_ylim()
 [x0, y0], [x1, y1] = self.mainAxes.bbox.get_points()
 datawidth = limx[1] - limx[0]
 dataheight = limy[1] - limy[0]
 pixelwidth = x1 - x0
 pixelheight = y1 - y0
 adaptedwidth = im.size[0] * (datawidth/pixelwidth)
 adaptedheight = im.size[1] * (dataheight/pixelheight)
 for peak in Blocks.peaks(self.quote.Close,
self.peakSpanSlider.value()):
 self.mainAxes.imshow(im, origin = 'lower', extent =
(date2num(peak.datetime), date2num(peak.datetime) + 100 , 400, 425)) #
left right bottom top
 self.mainAxes.set_xlim(limx)
 self.mainAxes.set_ylim(limy)
There is no visible result. When zooming in to a place where an image
should be present I encounter the following error every time I move
the mouse.
Traceback (most recent call last):
 File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4.py",
line 135, in mouseReleaseEvent
 FigureCanvasBase.button_release_event( self, x, y, button )
 File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
line 1198, in button_release_event
 self.callbacks.process(s, event)
 File "C:\Python25\lib\site-packages\matplotlib\cbook.py", line 155, in process
 func(*args, **kwargs)
 File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
line 2048, in release_zoom
 self.draw()
 File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
line 2070, in draw
 self.canvas.draw()
 File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4agg.py",
line 133, in draw
 FigureCanvasAgg.draw(self)
 File "C:\Python25\lib\site-packages\matplotlib\backends\backend_agg.py",
line 279, in draw
 self.figure.draw(self.renderer)
 File "C:\Python25\lib\site-packages\matplotlib\figure.py", line 772, in draw
 for a in self.axes: a.draw(renderer)
 File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1545, in draw
 im.draw(renderer)
 File "C:\Python25\lib\site-packages\matplotlib\image.py", line 233, in draw
 im = self.make_image(renderer.get_image_magnification())
 File "C:\Python25\lib\site-packages\matplotlib\image.py", line 220,
in make_image
 rx = widthDisplay / numcols
ZeroDivisionError: float division
Any idea what might cause this issue? Did I do something wrong? I know
it's not pretty, but it should work right?
Cheers!
Bas
2009年7月30日 Bas van Leeuwen <le...@gm...>:
> Hi JJ,
>
> Thank you for your kind and speedy reply, I completely glanced over
> the extent parameter.
> Datacoords are actually what I need so this is perfect for me.
>
> To clarify what I want, I want to mark certain parts of a graph with
> an icon representing the reason it's interesting. Icons are for peaks,
> trends, correlation, etc.
>
> Thank you very much!
>
> Bas
>
>
> 2009年7月30日 Jae-Joon Lee <lee...@gm...>:
>> The location of the image can be set by specifying the "extent"
>> keyword, however, this is set in data coordinate.
>> figimage may be close to what you want.
>>
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage
>>
>> As far as I know, there is no direct support in matplotlib to place an
>> image with arbitrary transformation. But it may not be difficult to
>> implement. However, "annotate a plot with icons" is not enough to
>> figure out what you really want.
>> Maybe some screenshots from other plotting tool will be helpful. Or,
>> please elaborate how you want to position your image.
>>
>> -JJ
>>
>>
>> On Thu, Jul 30, 2009 at 12:11 PM, Bas van Leeuwen<le...@gm...> wrote:
>>> Hi all,
>>>
>>> Is there any way to annotate a plot with icons?
>>> The only way to include an image that I've found is using imshow, but
>>> imshow does not accept (x,y) coordinates.
>>>
>>> There probably is an easy solution, but I have not been able to find
>>> any. Please be patient :-)
>>>
>>> Thank you in advance for your reply,
>>> Bas van Leeuwen
>>>
>>> PS, I'm sorry if this mail arrives multiple times, I didn't see the
>>> previous one in the archive.
>>>
>>> ------------------------------------------------------------------------------
>>> 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: John H. <jd...@gm...> - 2009年07月31日 17:45:00
We have a test release candidate rc1 of the impending
matplotlib-0.99.0 release, including lots of great new stuff like the
axes grid and mplot3d toolkits,
 http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/index.html
 http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html
We have uploaded tarballs, eggs and binary installers for win32 and
OSX, and would love to have some testers. You can grab the release
candidates from:
 http://drop.io/xortel1#
If you have any bugfixes or patches, feel free to post them here, but
please also post to the tracker
 https://sourceforge.net/tracker/?group_id=80706&atid=560720
Thanks to Michael Droettboom with help setting up the release branch,
Christoph Gohlke for the python2.6 win32 binaries, and William Stein
for providing a remote OSX box for building and testing OSX binaries.
Those of you with svn access can grab the release branch from::
 svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint
mpl99
and post patches against svn for any bugs you discover and fix::
 http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch
Thanks to all the developers who contributed in this cycle -- more
details to follow on the official release announcement next week.
JDH
From: Tony S Yu <to...@MI...> - 2009年07月31日 14:56:24
On Jul 30, 2009, at 5:16 PM, Gewton Jhames wrote:
> Anyone?
>
> On Tue, Jul 28, 2009 at 3:23 PM, Gewton Jhames <gj...@gm...> 
> wrote:
> Guys, there is the code.
> On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames <gj...@gm...> 
> wrote:
> Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work 
> too.
>
>
> On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee <lee...@gm...> 
> wrote:
[Snip]
> On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames<gj...@gm...> 
> wrote:
> On the other hand, there is some crude support for trimming, i.e.,
> reducing the figure size while the axes area fixed.
>
> savefig("file.png", bbox_inches="tight")
>
> Note that the figure size of the saved output is only affected. This
> does not change the figure displayed on the screen.
>
> Regards,
>
> -JJ
>
Jae-Joon's suggestion worked for me (using your code). Since this 
feature is pretty new, it may depend on the version you're using (I'm 
using the latest from svn).
I couldn't get `autoscale_view` to work either. However, 
`subplots_adjust` should work with a little tweaking. Instead of the 
dimensions John gave, try plt.subplots_adjust(left=0.07, right=0.99). 
These dimensions may show up differently on your system, so try 
tweaking these values.
Best,
-T
From: Michael D. <md...@st...> - 2009年07月31日 14:10:00
That is by design -- it's a performance vs. accuracy tradeoff. Markers 
are drawn only once and then stamped to the nearest pixel boundaries. 
What you're seeing is the result of this rounding. And since each 
marker is rounded in isolation, you don't see smooth stepping as a 
classical line drawing algorithm (such as Breshenham's) would give. We 
could make this behavior optional, but it would require a significantly 
different code path in the Agg backend. The Agg backend is generally 
optimized for interactive performance, not accuracy. For accuracy, one 
can use any of the vector output formats.
Cheers,
Mike
João Luís Silva wrote:
> The positioning of markers seems a bit off, especially when a line is 
> moved around with the pan and zoom tool. They don't follow the line they 
> are in, and seem to follow a much lower resolution line. Try the 
> following example, and use the pan and zoom tool to move the lines around.
>
> mpl svn rev 7310 / Ubuntu 9.04 / GTKAgg
>
> Regards,
> João Silva
>
> ---------------------------------------------------------------------
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> delta = 0.2
> x = np.arange(-5,5,0.05)
> plt.plot(x,x,marker="o")
> plt.plot(x,x+delta,"g",lw=1.5)
> plt.plot(x,x-delta,"g",lw=1.5)
> ax = plt.gca()
> ax.set_xlim((-4.25,4.7))
> ax.set_ylim((-5.5,5.1))
> plt.show()
>
> ---------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> 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
From: João L. S. <js...@fc...> - 2009年07月31日 01:05:22
The positioning of markers seems a bit off, especially when a line is 
moved around with the pan and zoom tool. They don't follow the line they 
are in, and seem to follow a much lower resolution line. Try the 
following example, and use the pan and zoom tool to move the lines around.
mpl svn rev 7310 / Ubuntu 9.04 / GTKAgg
Regards,
João Silva
---------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
delta = 0.2
x = np.arange(-5,5,0.05)
plt.plot(x,x,marker="o")
plt.plot(x,x+delta,"g",lw=1.5)
plt.plot(x,x-delta,"g",lw=1.5)
ax = plt.gca()
ax.set_xlim((-4.25,4.7))
ax.set_ylim((-5.5,5.1))
plt.show()
---------------------------------------------------------------------
From: Dong, H. <don...@gm...> - 2009年07月30日 22:33:24
I also use matplotlib-0.98.5.3.win32-py2.6.exe. It was built without
gtk. You have to build your own binaries with gtk support. Or find
compiled package (by Christoph Gohlke) with gtk support here:
http://www.lfd.uci.edu/~gohlke/#pythonlibs
and original information is here:
http://www.nabble.com/matplotlib-0.98.5.3.win32-py2.6.exe-td24299490.html
Personally I suggest use TkAgg. It dosen't matter if the figure window
is smaller than the canvas. If you don't resize the window (i.e. you
have checked the figure is ok and replotted the figure), it is ok to
just save it by clicking save icon in the toolbar.
On Thu, Jul 30, 2009 at 8:34 PM, Sebastian Pająk<spc...@gm...> wrote:
> Hello
> I don't know why, but after switching from python2.5 to python2.6 I
> cannot even launch matplotlib (matplotlib-0.98.5.3.win32-py2.6.exe).
> This is what I get:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "D:\msys\opt\python\lib\site-packages\pylab.py", line 1, in <module>
>  from matplotlib.pylab import *
> File "D:\msys\opt\python\lib\site-packages\matplotlib\pylab.py",
> line 253, in <module>
>  from matplotlib.pyplot import *
> File "D:\msys\opt\python\lib\site-packages\matplotlib\pyplot.py",
> line 75, in <module>
>  new_figure_manager, draw_if_interactive, show = pylab_setup()
> File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\__init__.py",
> line 25, in pylab_setup
>  globals(),locals(),[backend_name])
> File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gtkagg.py",
> line 10, in <module>
>  from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
> FigureCanvasGTK,\
> File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gtk.py",
> line 25, in <module>
>  from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
> File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gdk.py",
> line 29, in <module>
>  from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
> ImportError: No module named _backend_gdk
>
>
> I have PyGTK installed. What can be the problem?
> win xp sp3
>
> ------------------------------------------------------------------------------
> 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: Gewton J. <gj...@gm...> - 2009年07月30日 21:17:37
Anyone?
On Tue, Jul 28, 2009 at 3:23 PM, Gewton Jhames <gj...@gm...> wrote:
> Guys, there is the code.
> On Tue, Jul 28, 2009 at 3:13 PM, Gewton Jhames <gj...@gm...> wrote:
>
>> Jae-Joon Lee, savefig("file.png", bbox_inches="tight") doesn't work too.
>>
>> On Mon, Jul 27, 2009 at 7:00 PM, Jae-Joon Lee <lee...@gm...>wrote:
>>
>>> On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames<gj...@gm...> wrote:
>>> > How to "trim the canvas" of the image generated? It's transparent, but
>>> still
>>> > have a "padding", if it would be cropped, I can safe almost 200px!. I
>>> have
>>> > attached a file to this email to show it, the background of the graph
>>> was
>>> > set to red only to you see the padding.
>>>
>>> As John suggested, you can adjust the subplot params. This adjusts the
>>> area occupied by the axes, while the figure size (canvas size) is
>>> fixed.
>>>
>>> The subplot params can be automatically adjusted.
>>>
>>>
>>> http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels
>>>
>>>
>>> On the other hand, there is some crude support for trimming, i.e.,
>>> reducing the figure size while the axes area fixed.
>>>
>>> savefig("file.png", bbox_inches="tight")
>>>
>>> Note that the figure size of the saved output is only affected. This
>>> does not change the figure displayed on the screen.
>>>
>>> Regards,
>>>
>>> -JJ
>>>
>>
>>
>
From: Bas v. L. <le...@gm...> - 2009年07月30日 20:08:35
Hi JJ,
Thank you for your kind and speedy reply, I completely glanced over
the extent parameter.
Datacoords are actually what I need so this is perfect for me.
To clarify what I want, I want to mark certain parts of a graph with
an icon representing the reason it's interesting. Icons are for peaks,
trends, correlation, etc.
Thank you very much!
Bas
2009年7月30日 Jae-Joon Lee <lee...@gm...>:
> The location of the image can be set by specifying the "extent"
> keyword, however, this is set in data coordinate.
> figimage may be close to what you want.
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage
>
> As far as I know, there is no direct support in matplotlib to place an
> image with arbitrary transformation. But it may not be difficult to
> implement. However, "annotate a plot with icons" is not enough to
> figure out what you really want.
> Maybe some screenshots from other plotting tool will be helpful. Or,
> please elaborate how you want to position your image.
>
> -JJ
>
>
> On Thu, Jul 30, 2009 at 12:11 PM, Bas van Leeuwen<le...@gm...> wrote:
>> Hi all,
>>
>> Is there any way to annotate a plot with icons?
>> The only way to include an image that I've found is using imshow, but
>> imshow does not accept (x,y) coordinates.
>>
>> There probably is an easy solution, but I have not been able to find
>> any. Please be patient :-)
>>
>> Thank you in advance for your reply,
>> Bas van Leeuwen
>>
>> PS, I'm sorry if this mail arrives multiple times, I didn't see the
>> previous one in the archive.
>>
>> ------------------------------------------------------------------------------
>> 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: Eric F. <ef...@ha...> - 2009年07月30日 19:41:57
Jae-Joon Lee wrote:
> I don't think there is any user-visible support for registering a
> custom colormap.
Now there is: svn r7309. Its use is illustrated via a modification of 
examples/pylab_examples/custom_cmap.py.
With just a little more work, we could make it so that anything taking a 
"cmap" kwarg will accept either a Colormap instance or the name of a 
registered instance (including builtins). Maybe I will do that later today.
Eric
> However, it seems to me that adding the colormap to
> matplotlib.cm.datad distionary is enough.
> Note that the value need to be a dictionary of RGB specification, not
> the actual colormap instance.
> 
> for example,
> 
> mycolormap = {'blue': ((0.0, 0.40000000000000002, 0.40000000000000002),
> (1.0, 0.40000000000000002, 0.40000000000000002)),
> 'green': ((0.0, 0.5, 0.5), (1.0, 1.0, 1.0)),
> 'red': ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))}
> 
> matplotlib.cm.datad["mycolormap"] = mycolormap
> rcParams["image.cmap"]="mycolormap"
> 
> Having a function (like jet in pylab) would not be also difficult.
> Take a look at the definition of "jet" function (for example) in the
> pylab.py.
> 
> We may be better to have a proper way to register a custom colormap.
> I'll try to take a more look later, but any patch will be appreciated.
> 
> Regards,
> 
> -JJ
> 
> 
> 
> On Thu, Jul 30, 2009 at 3:48 AM, Philipp
> Lies<phi...@go...> wrote:
>> Does no one have an idea? If not, this is a severe usability bug!
>>
>> Philipp Lies wrote:
>>> Hi,
>>>
>>> I just created a hsv-like color map with gray levels only, now I'd like to
>>> use this as default color map. But how? Calling it like hsv() does not
>>> work and I did not find a hint in the documentation how to set a user
>>> defined color map interactively as default color map.
>>>
>>> Cheers
>>>
>>> Philipp
>>>
>> --
>> View this message in context: http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
> 
> ------------------------------------------------------------------------------
> 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: Sebastian P. <spc...@gm...> - 2009年07月30日 18:35:00
Hello
I don't know why, but after switching from python2.5 to python2.6 I
cannot even launch matplotlib (matplotlib-0.98.5.3.win32-py2.6.exe).
This is what I get:
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "D:\msys\opt\python\lib\site-packages\pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "D:\msys\opt\python\lib\site-packages\matplotlib\pylab.py",
line 253, in <module>
 from matplotlib.pyplot import *
 File "D:\msys\opt\python\lib\site-packages\matplotlib\pyplot.py",
line 75, in <module>
 new_figure_manager, draw_if_interactive, show = pylab_setup()
 File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\__init__.py",
line 25, in pylab_setup
 globals(),locals(),[backend_name])
 File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gtkagg.py",
line 10, in <module>
 from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
FigureCanvasGTK,\
 File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gtk.py",
line 25, in <module>
 from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
 File "D:\msys\opt\python\lib\site-packages\matplotlib\backends\backend_gdk.py",
line 29, in <module>
 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _backend_gdk
I have PyGTK installed. What can be the problem?
win xp sp3
From: Eric F. <ef...@ha...> - 2009年07月30日 17:59:54
Jae-Joon Lee wrote:
> I don't think there is any user-visible support for registering a
> custom colormap.
I have it almost done; I will commit it shortly.
Eric
> However, it seems to me that adding the colormap to
> matplotlib.cm.datad distionary is enough.
> Note that the value need to be a dictionary of RGB specification, not
> the actual colormap instance.
(I will have a more general solution than this.)
> 
> for example,
> 
> mycolormap = {'blue': ((0.0, 0.40000000000000002, 0.40000000000000002),
> (1.0, 0.40000000000000002, 0.40000000000000002)),
> 'green': ((0.0, 0.5, 0.5), (1.0, 1.0, 1.0)),
> 'red': ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))}
> 
> matplotlib.cm.datad["mycolormap"] = mycolormap
> rcParams["image.cmap"]="mycolormap"
> 
> Having a function (like jet in pylab) would not be also difficult.
> Take a look at the definition of "jet" function (for example) in the
> pylab.py.
> 
> We may be better to have a proper way to register a custom colormap.
> I'll try to take a more look later, but any patch will be appreciated.
> 
> Regards,
> 
> -JJ
> 
> 
> 
> On Thu, Jul 30, 2009 at 3:48 AM, Philipp
> Lies<phi...@go...> wrote:
>> Does no one have an idea? If not, this is a severe usability bug!
>>
>> Philipp Lies wrote:
>>> Hi,
>>>
>>> I just created a hsv-like color map with gray levels only, now I'd like to
>>> use this as default color map. But how? Calling it like hsv() does not
>>> work and I did not find a hint in the documentation how to set a user
>>> defined color map interactively as default color map.
>>>
>>> Cheers
>>>
>>> Philipp
>>>
>> --
>> View this message in context: http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
> 
> ------------------------------------------------------------------------------
> 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: Jae-Joon L. <lee...@gm...> - 2009年07月30日 17:37:44
I don't think there is any user-visible support for registering a
custom colormap.
However, it seems to me that adding the colormap to
matplotlib.cm.datad distionary is enough.
Note that the value need to be a dictionary of RGB specification, not
the actual colormap instance.
for example,
mycolormap = {'blue': ((0.0, 0.40000000000000002, 0.40000000000000002),
 (1.0, 0.40000000000000002, 0.40000000000000002)),
 'green': ((0.0, 0.5, 0.5), (1.0, 1.0, 1.0)),
 'red': ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))}
matplotlib.cm.datad["mycolormap"] = mycolormap
rcParams["image.cmap"]="mycolormap"
Having a function (like jet in pylab) would not be also difficult.
Take a look at the definition of "jet" function (for example) in the
pylab.py.
We may be better to have a proper way to register a custom colormap.
I'll try to take a more look later, but any patch will be appreciated.
Regards,
-JJ
On Thu, Jul 30, 2009 at 3:48 AM, Philipp
Lies<phi...@go...> wrote:
>
> Does no one have an idea? If not, this is a severe usability bug!
>
> Philipp Lies wrote:
>>
>> Hi,
>>
>> I just created a hsv-like color map with gray levels only, now I'd like to
>> use this as default color map. But how? Calling it like hsv() does not
>> work and I did not find a hint in the documentation how to set a user
>> defined color map interactively as default color map.
>>
>> Cheers
>>
>> Philipp
>>
>
> --
> View this message in context: http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> 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: Jae-Joon L. <lee...@gm...> - 2009年07月30日 16:49:37
The location of the image can be set by specifying the "extent"
keyword, however, this is set in data coordinate.
figimage may be close to what you want.
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage
As far as I know, there is no direct support in matplotlib to place an
image with arbitrary transformation. But it may not be difficult to
implement. However, "annotate a plot with icons" is not enough to
figure out what you really want.
Maybe some screenshots from other plotting tool will be helpful. Or,
please elaborate how you want to position your image.
-JJ
On Thu, Jul 30, 2009 at 12:11 PM, Bas van Leeuwen<le...@gm...> wrote:
> Hi all,
>
> Is there any way to annotate a plot with icons?
> The only way to include an image that I've found is using imshow, but
> imshow does not accept (x,y) coordinates.
>
> There probably is an easy solution, but I have not been able to find
> any. Please be patient :-)
>
> Thank you in advance for your reply,
> Bas van Leeuwen
>
> PS, I'm sorry if this mail arrives multiple times, I didn't see the
> previous one in the archive.
>
> ------------------------------------------------------------------------------
> 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: Bas v. L. <le...@gm...> - 2009年07月30日 16:11:51
Hi all,
Is there any way to annotate a plot with icons?
The only way to include an image that I've found is using imshow, but
imshow does not accept (x,y) coordinates.
There probably is an easy solution, but I have not been able to find
any. Please be patient :-)
Thank you in advance for your reply,
Bas van Leeuwen
PS, I'm sorry if this mail arrives multiple times, I didn't see the
previous one in the archive.
From: Michael D. <md...@st...> - 2009年07月30日 14:11:08
axes_grid is only available in the SVN version. It has not been 
released yet, so therefore is not part of packages like Python(X, Y).
Mike
Sahar wrote:
> Hi all,
> 
> I try to run an example with the line: /from mpl_toolkits.axes_grid 
> import Divider/
> and I get the massage: /No module named axes_grid/
> It is possible to import mpl_toolkits but this module and others are 
> missing.
> 
> I work with Python(X,Y) so maybe it is some versions\installation 
> problem...
> 
> Thanks,
> Sahar
>
>
> *******************************************************************************************************
> This e-mail message may contain confidential,and privileged 
> information or data that constitute proprietary information of CMT 
> Medical Ltd. Any review or distribution by others is strictly 
> prohibited. If you are not the intended recipient you are hereby 
> notified that any use of this information or data by any other person 
> is absolutely prohibited. If you are not the intended recipient, 
> please delete all copies. Thank You. http://www.cmt.co.il
> ********************************************************************************************************
>
>
>
>
> ************************************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & 
> computer viruses.
> ************************************************************************************
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> 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
From: Sahar <sa...@cm...> - 2009年07月30日 14:08:27
Hi all,
I try to run an example with the line: from mpl_toolkits.axes_grid import
Divider
and I get the massage: No module named axes_grid
It is possible to import mpl_toolkits but this module and others are
missing.
I work with Python(X,Y) so maybe it is some versions\installation problem...
Thanks,
 Sahar
*******************************************************************************************************
This e-mail message may contain confidential,and privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il
********************************************************************************************************
 
 
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************
From: Bas v. L. <le...@gm...> - 2009年07月30日 13:46:01
Hi all,
Is there any way to annotate a plot with icons?
The only way to include an image that I've found is using imshow, but
imshow does not accept (x,y) coordinates.
There probably is an easy solution, but I have not been able to find
any. Please be patient :-)
Thank you in advance for your reply,
Bas van Leeuwen
From: Bas v. L. <le...@gm...> - 2009年07月30日 09:33:31
Hi all,
Is there any way to annotate a plot with icons?
The only way to include an image that I've found is using imshow, but
imshow does not accept (x,y) coordinates.
There probably is an easy solution, but I have not been able to find
any. Please be patient :-)
Thank you in advance for your reply,
Bas van Leeuwen
From: Philipp L. <phi...@go...> - 2009年07月30日 07:48:23
Does no one have an idea? If not, this is a severe usability bug!
Philipp Lies wrote:
> 
> Hi,
> 
> I just created a hsv-like color map with gray levels only, now I'd like to
> use this as default color map. But how? Calling it like hsv() does not
> work and I did not find a hint in the documentation how to set a user
> defined color map interactively as default color map.
> 
> Cheers
> 
> Philipp
> 
-- 
View this message in context: http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Uri L. <las...@mi...> - 2009年07月30日 05:35:19
The first suggestion failed with the same error, while the same suggestion
worked up through the last step (make installers) which fails with the same
error.
I decided to try Tommy's suggestion of just figuring out how to compile
libpng as a universal binary. The way I did it was to run the configuration
script as:
./configure --disable-dependency-tracking
and then to manually edit the Makefile. To CPPFLAGS and LDFLAGS I added
-arch i386 -arch ppc
Running make and sudo make install successfully built a universal library
for me.
After deleting my old MPL egg, I import matplotlib successfully and the
version number is as expected (0.98.6svn).
However, when I try to import pyplot, I get the following exception
traceback. Any suggestions on how to fix this?
Thanks again!
In [4]: import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/usr/local/lib/<ipython console> in <module>()
/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/pyplot.py
in <module>()
 4 from matplotlib import _pylab_helpers, interactive
 5 from matplotlib.cbook import dedent, silent_list, is_string_like,
is_numlike
----> 6 from matplotlib.figure import Figure, figaspect
 7 from matplotlib.backend_bases import FigureCanvasBase
 8 from matplotlib.image import imread as _imread
/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/figure.py
in <module>()
 17 import artist
 18 from artist import Artist, allow_rasterization
---> 19 from axes import Axes, SubplotBase, subplot_class_factory
 20 from cbook import flatten, allequal, Stack, iterable, dedent
 21 import _image
/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/axes.py
in <module>()
 17 import matplotlib.dates as mdates
 18 import matplotlib.font_manager as font_manager
---> 19 import matplotlib.image as mimage
 20 import matplotlib.legend as mlegend
 21 import matplotlib.lines as mlines
/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/image.py
in <module>()
 19 # For clarity, names from _image are given explicitly in this
module:
 20 import matplotlib._image as _image
---> 21 import matplotlib._png as _png
 22
 23 # For user convenience, the names from _image are also imported into
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/_png.so,
2): Symbol not found: _png_create_info_struct
 Referenced from:
/Library/Frameworks/Python.framework/Versions/4.0.30002/lib/python2.5/site-packages/matplotlib/_png.so
 Expected in: /usr/local/lib/libpng12.0.dylib
On Wed, Jul 29, 2009 at 21:46, John Hunter <jd...@gm...> wrote:
> On Wed, Jul 29, 2009 at 4:34 PM, Uri Laserson<las...@mi...> wrote:
> > Hi everyone,
> >
> > I am trying to build the latest svn trunk version of MPL on OS X 10.5. I
> am
> > getting the following error:
>
> Try
>
> make build_osx105
> python setup.py install --prefix=~/somewhere
>
> If that doesn't work, try
>
> cd release/osx
>
> read the readme there and follow the instructions. This will build
> mpl the way we do when making a release: fetch the dependencies (zlip,
> png and freetype) and build them with the right flags, and then build
> mpl explcitly linking to these libs.
>
> JDH
>
-- 
Uri Laserson
PhD Candidate, Biomedical Engineering
Harvard Medical School (Genetics)
Massachusetts Institute of Technology (Mathematics)
phone +1 917 742 8019
las...@mi...
From: Art <gre...@gm...> - 2009年07月30日 04:58:06
On Wed, Jul 29, 2009 at 6:09 PM, John Hunter <jd...@gm...> wrote:
> On Wed, Jul 29, 2009 at 6:50 PM, Art<gre...@gm...> wrote:
>
> > My bottleneck now is actually saving the pngs for mencoder to make into
> an
> > avi (as with the movie_demo example on your site) using savefig. Do you
> also
> > know of an alternative way of generating an avi of the animation? My
> > animation has about 9000 frames.
>
> No, I can't imagine there is much fat to trim in that part of the
> code. We're using libpng to write the png, so no speedups there
> unless you can make the pngs smaller. It looks like we are using a
> memory pointer to get the rgba data from agg over to png, so no
> speedups there either. Perhaps Michael has some input. Some code
> that we could run and test might help produce some further
> optimizations.
>
> JDH
>
Below is some sample code that creates the directory ~/tmp/blit_test,
outputs 50 pngs, and creates a mov.avi using /usr/local/bin/mencoder.
Apologies in advance for the code:
import os
import numpy as np
import matplotlib.pyplot as plt
import subprocess
movdir = os.path.join(os.path.expanduser('~'), 'tmp', 'blit_test')
try: os.mkdirs(movdir)
except: pass
mencoder = '/usr/local/bin/mencoder'
ax = []
im = []
vl = []
fig = plt.figure()
ax.append(fig.add_subplot(2,2,1))
im.append(ax[-1].imshow(np.random.randn(100,100)))
ax[-1].set_xticks([])
ax[-1].set_yticks([])
ax.append(fig.add_subplot(2,2,2))
im.append(ax[-1].imshow(np.random.randn(32,32)))
ax[-1].set_xticks([])
ax[-1].set_yticks([])
ax.append(fig.add_subplot(2, 1, 2))
r = np.abs(np.random.normal(0,0.1,1000))
for i in range(100):
 ras = np.nonzero(np.random.poisson(r))[0]
 ax[-1].scatter(ras, np.ones(len(ras)) * (i+1), s=1, alpha=0.5)
vl.append(ax[-1].axvline(-1, color='r', alpha=0.9, linewidth=2.))
ax[-1].set_xlim([0,1000])
ax[-1].set_ylim([0,100])
plt.draw()
canvas = fig.canvas
background = canvas.copy_from_bbox(fig.bbox)
for i in range(50):
 canvas.restore_region(background)
 im[0].set_data(np.random.randn(100,100))
 ax[0].draw_artist(im[0])
 im[1].set_data(np.random.randn(32,32))
 ax[1].draw_artist(im[1])
 vl[0].set_xdata([i,i])
 ax[2].draw_artist(vl[0])
 canvas.blit()
 plt.savefig(os.path.join(movdir, '%03d' % (i+1)))
fps = 10
command = (mencoder,
 'mf://%s/*.png' % (movdir),
 #'-vf', 'scale=800:-10',
 '-mf', 'fps=%d' % fps,
 '-ovc', 'lavc',
 '-lavcopts', 'vcodec=mpeg4',
 '-o', os.path.join(movdir, 'mov.avi'))
subprocess.check_call(command)
# output in ~/tmp/blit_test/mov.avi
From: Eric F. <ef...@ha...> - 2009年07月30日 04:05:14
John Hunter wrote:
> On Wed, Jul 29, 2009 at 6:50 PM, Art<gre...@gm...> wrote:
> 
>> My bottleneck now is actually saving the pngs for mencoder to make into an
>> avi (as with the movie_demo example on your site) using savefig. Do you also
>> know of an alternative way of generating an avi of the animation? My
>> animation has about 9000 frames.
> 
> No, I can't imagine there is much fat to trim in that part of the
> code. We're using libpng to write the png, so no speedups there
> unless you can make the pngs smaller. It looks like we are using a
> memory pointer to get the rgba data from agg over to png, so no
> speedups there either. Perhaps Michael has some input. Some code
> that we could run and test might help produce some further
> optimizations.
> 
> JDH
Can libpng be told to write one of the smaller png variants, using a 
color palette, for example, especially if antialiasing is turned off? 
For animation I suspect the reduced quality would not hurt much, and the 
smaller file size would be welcome, potentially yielding a smaller 
animation file as well.
Eric
> 
> ------------------------------------------------------------------------------
> 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: John H. <jd...@gm...> - 2009年07月30日 02:10:57
On Wed, Jul 29, 2009 at 9:05 PM, Christian Lerrahn<li...@pe...> wrote:
>> Why not::
>>
>>  import matplotlib
>>  matplotlib.use('Agg')
>>
>> Then you have a full featured mpl backend w/ no GUI or X requirements.
>
> Thanks for that! I had overlooked that backend. It seems to do the
> trick perfectly. :)
Great -- take a look at
 http://matplotlib.sourceforge.net/faq/installing_faq.html#backends
which will explain the situation in much more detail. Also, the FAQ
 http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server
is useful even if you are not writing a webapp server, since the
issues of working in a non-X environment are similar to your case.
JDH
9 messages has been excluded from this view by a project administrator.

Showing results of 509

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