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
(8) |
2
(14) |
3
(22) |
4
(13) |
5
(11) |
6
(12) |
7
(4) |
|
8
(6) |
9
(19) |
10
(14) |
11
(16) |
12
(6) |
13
(15) |
14
(6) |
|
15
(8) |
16
(22) |
17
(17) |
18
(8) |
19
(16) |
20
(19) |
21
(3) |
|
22
(6) |
23
(18) |
24
(26) |
25
(17) |
26
(13) |
27
(18) |
28
(8) |
|
29
|
30
(14) |
31
(30) |
|
|
|
|
|
From: Eric F. <ef...@ha...> - 2009-03-20 23:11:13
|
Mike Bauer wrote:
> Eric,
>
> Thanks for the reply. I'm trying to show the relative 2d distribuion
> between 2 sets of data. I thought the normalization would ease the
> comparison. Fixing the ' doesn't help.
>
> So are you saying I need an instance of something.normalize rather than
> just passing norm='normalize'?
It sounds like you are misunderstanding the norm kwarg; it is for
controlling the mapping of an arbitrary range of numbers to the 0-1
range that is used in color mapping. The default is a linear mapping;
one can use a log mapping instead ("norm=colors.LogNorm()"), or make
your own mapping function, etc. The norm kwarg takes an instance of a
Normalize class or subclass. See colors.py to find out what Normalize
subclasses are available. But, you may not need to specify one at all,
depending on what it is you are trying to do.
I still don't understand what it is that you wanted to "normalize".
What was the undesirable characteristic of the plot you had before you
put in the norm kwarg?
Eric
>
> Mike
>
> Sent from my iPhone
>
> On Mar 20, 2009, at 5:15 PM, Eric Firing <ef...@ha...> wrote:
>
>> Mike Bauer wrote:
>>> Hello,
>>> Quick note. I'm making plots with hexbin and everything works
>>> correctly until I try to use the norm='Normalize' option at which
>>> point I get:
>>> Traceback (most recent call last):
>>> File "diff_engine_v2tmp.py", line 731, in <module>
>>> kept_and_discards)
>>> File "diff_engine_v2tmp.py", line 605, in main
>>> plt.hexbin(xdat,ydat,cmap=cm.jet,gridsize=25,norm=Normalize' )
>>
>> What is that single quote mark doing after Normalize? If we ignore
>> it, then it looks like you are passing a class, not a class instance
>> as the kwarg needs.
>>
>>> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
>>> lib/python2.5/site-packages/matplotlib/pyplot.py", line 1920, in hexbin
>>> ret = gca().hexbin(*args, **kwargs)
>>> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
>>> lib/python2.5/site-packages/matplotlib/axes.py", line 5452, in hexbin
>>> collection.autoscale_None()
>>> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
>>> lib/python2.5/site-packages/matplotlib/cm.py", line 148, in
>>> autoscale_None
>>> self.norm.autoscale_None(self._A)
>>> AttributeError: 'int' object has no attribute 'autoscale_None'
>>
>> This part of the traceback is also a little puzzling; I'm not sure why
>> self.norm is an int at this point.
>>
>>> I assume this a bug of some sort.
>>
>> No, I think the problem is that you are passing a class instead of an
>> instance of a class as the norm kwarg to hexbin. (It is not
>> completely clear to me from the traceback, however--there is that
>> strange single quote mark.) What kind of normalization are you trying
>> to to? In other words, what are you trying to accomplish by
>> specifying the norm kwarg?
>>
>> Eric
>>
>>
>>> Thanks for any ideas.
>>> Mike
>>> Using:
>>> os-x 10.5.6
>>> python 2.5.4 from macports
>>> matplotlib 0.98.5.2 from macports
>>> ------------------------------------------------------------------------------
>>>
>>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
>>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
>>> easily build your RIAs with Flex Builder, the Eclipse(TM)based
>>> development
>>> software that enables intelligent coding and step-through debugging.
>>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
|
|
From: Eric F. <ef...@ha...> - 2009-03-20 21:15:43
|
Mike Bauer wrote: > Hello, > > Quick note. I'm making plots with hexbin and everything works > correctly until I try to use the norm='Normalize' option at which > point I get: > > Traceback (most recent call last): > File "diff_engine_v2tmp.py", line 731, in <module> > kept_and_discards) > File "diff_engine_v2tmp.py", line 605, in main > plt.hexbin(xdat,ydat,cmap=cm.jet,gridsize=25,norm=Normalize' ) What is that single quote mark doing after Normalize? If we ignore it, then it looks like you are passing a class, not a class instance as the kwarg needs. > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/site-packages/matplotlib/pyplot.py", line 1920, in hexbin > ret = gca().hexbin(*args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/site-packages/matplotlib/axes.py", line 5452, in hexbin > collection.autoscale_None() > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/ > lib/python2.5/site-packages/matplotlib/cm.py", line 148, in > autoscale_None > self.norm.autoscale_None(self._A) > AttributeError: 'int' object has no attribute 'autoscale_None' This part of the traceback is also a little puzzling; I'm not sure why self.norm is an int at this point. > > I assume this a bug of some sort. No, I think the problem is that you are passing a class instead of an instance of a class as the norm kwarg to hexbin. (It is not completely clear to me from the traceback, however--there is that strange single quote mark.) What kind of normalization are you trying to to? In other words, what are you trying to accomplish by specifying the norm kwarg? Eric > > Thanks for any ideas. > > Mike > > Using: > os-x 10.5.6 > python 2.5.4 from macports > matplotlib 0.98.5.2 from macports > > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Mike B. <oht...@ma...> - 2009-03-20 20:37:14
|
Hello,
Quick note. I'm making plots with hexbin and everything works
correctly until I try to use the norm='Normalize' option at which
point I get:
Traceback (most recent call last):
File "diff_engine_v2tmp.py", line 731, in <module>
kept_and_discards)
File "diff_engine_v2tmp.py", line 605, in main
plt.hexbin(xdat,ydat,cmap=cm.jet,gridsize=25,norm=Normalize' )
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/matplotlib/pyplot.py", line 1920, in hexbin
ret = gca().hexbin(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/matplotlib/axes.py", line 5452, in hexbin
collection.autoscale_None()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/
lib/python2.5/site-packages/matplotlib/cm.py", line 148, in
autoscale_None
self.norm.autoscale_None(self._A)
AttributeError: 'int' object has no attribute 'autoscale_None'
I assume this a bug of some sort.
Thanks for any ideas.
Mike
Using:
os-x 10.5.6
python 2.5.4 from macports
matplotlib 0.98.5.2 from macports
|
|
From: Stano P. <sta...@gm...> - 2009-03-20 20:13:34
|
Now it works like charm. Thank you for quick answer.
Stano.
On Fri, Mar 20, 2009 at 7:10 PM, Eric Firing <ef...@ha...> wrote:
> Stano Paška wrote:
>>
>> Hi,
>> I am using matplotlib first time and I am wonder how to free resources
>>
>> I have this script
>>
>> # coding: utf-8
>>
>> import matplotlib
>> matplotlib.use('Agg')
>>
>> import pylab
>>
>> class Graph:
>>
>> def __init__(self):
>> # sirka stlpcov
>> self.width = 0.5
>> self.font = {'fontname':'Tahoma', 'fontsize':10}
>>
>> def setTitle(self, title):
>> """Nastavi nadpis grafu
>> """
>> self.title = title
>>
>> def setXLabel(self, label):
>> self.x_label = label
>>
>> def setYLabel(self, label):
>> self.y_label = label
>>
>> def setYValues(self, values):
>> """Nastavi y-ove hodnoty
>> """
>> self.y_values = values
>> # vypocitame lave spodne rohy stlpcov
>> self.x_values = [x + self.width / 2 for x in
>> range(len(self.y_values))]
>> # vypocitame stred stlpcov (znacky na x-ovej osi)
>> self.x_ticks = [x + self.width for x in range(len(self.y_values))]
>>
>> def setXTickLabels(self, labels):
>> """Nastavi popisky pre ciarky na x-ovej osi
>> """
>> self.x_ticksLabels = labels
>>
>> def makeGraph(self):
>> self.fig = pylab.figure()
>> self.fig.set_dpi(72)
>> self.fig.set_figheight(3)
>> self.fig.set_figwidth(5)
>>
>> self.fig.subplots_adjust(bottom=0.15)
>>
>> self.ax = self.fig.add_subplot(111)
>>
>> self.ax.bar(left=self.x_values, height=self.y_values,
>> width=self.width, color='#f00000')
>> self.ax.set_xticks(self.x_ticks)
>> self.ax.set_xticklabels(self.x_ticksLabels)
>>
>> self.ax.set_xlabel(self.x_label, **self.font)
>> self.ax.set_ylabel(self.y_label, **self.font)
>> self.ax.set_title(self.title, **self.font)
>>
>> def saveGraph(self, path):
>> self.fig.savefig(path, format='png')
>>
>> def __del__(self):
>> self.fig.delaxes(self.ax)
>> del self.fig
>> del self.ax
>>
>> if __name__ == '__main__':
>> import random
>> import gc
>> for i in range(5000):
>> g = Graph()
>> g.setTitle(u'Spotreba za rok 2008 podľa ATC skupín')
>> g.setXLabel(u'ATC skupiny')
>> g.setYLabel(u'Spotreba v EUR')
>> g.setYValues([random.randint(0, x) for x in range(20)])
>> g.setXTickLabels([chr(random.randint(65, 90)) for x in range(20)])
>> g.makeGraph()
>> g.saveGraph('grafy/' + str(i) + '.png')
>> del g
>> print gc.get_count()
>> gc.collect()
>> print gc.get_count()
>>
>> When I used TkAgg, it crashes after 190 images (Fail to create pixmap
>> with Tk_GetPixmap in ImgPhotoInstanceSetSize. tried to delete photo
>> image when instances still exist).
>> When I switch to WX, it crashes after 400 images.
>> And Agg crashes when pagefile reaches 1.5x ram (cca 2000 images).
>>
>> It is possible somehow free resources in matplotlib?
>
> You need to close the figure. Try putting
> pylab.close(self.fig) at the start of your __del__ method. In fact, I doubt
> you need to explicitly del anything in that method--you just need to close
> the figure so that pylab will release its references related to that figure.
>
> There may be more things you need to change, but closing the figure is
> certainly going to be a big one.
>
> Eric
>
>>
>> I use python 2.5.4, wx 2.8.9.2, numpy 1.3.0b1 on win XP
>>
>> Thanks for answers.
>>
>> Stano.
>>
>>
>> ------------------------------------------------------------------------------
>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
>> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
>> software that enables intelligent coding and step-through debugging.
>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Michael D. <md...@st...> - 2009-03-20 18:50:53
|
Thanks for sharing this -- I'm curious about how you've dealt with some
of these issues and see if any of them can be brought into the core.
Overlapping text has long been something I've wanted to address, but
it's difficult to solve and maintain as much flexibility as we currently
have.
Running your script, I get this traceback:
Traceback (most recent call last):
File "AutoscaledText.py", line 236, in <module>
1024, 768, 'UseOffset_ON', 'ScientificNotation_ON')
File "AutoscaledText.py", line 171, in HistogramPlot
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataName, 'Frequency', useOffsetIfNeeded, scientificNotation, False,
0.0, 0.0, 1.0, 1.0)
File "AutoscaledText.py", line 75, in CommonPlottingCode
x_label._fontproperties._size = x_label._fontproperties._size *
heightRatioForTextSize
TypeError: can't multiply sequence by non-int of type 'float'
> /wonkabar/data1/scraps/AutoscaledText.py(75)CommonPlottingCode()
-> x_label._fontproperties._size = x_label._fontproperties._size *
heightRatioForTextSize
_fontproperties._size can be a CSS size name, such as "medium" or
"large", so this line of code won't work. I replaced this with:
x_label.set_size(x_label.get_size() * heightRatioForTextSize)
y_label.set_size(y_label.get_size() * widthRatioForTextSize)
which also has the advantage of avoiding private APIs that may change in
the future. This seems to work for me, but I don't know if it matches
your results.
Mike
James Phillips wrote:
> All,
>
> Attached, and below, is public domain code for making
> variable-sized plots with autoscaled text that exactly fits the
> available visual plot space, useful for web sites where users choose
> output files with different sizes. Examples are at the bottom of the
> file.
>
> James R. Phillips
> 2548 Vera Cruz Drive
> Birmingham, AL 35235 USA
> email: zu...@zu... <mailto:zu...@zu...>
> http://zunzun.com
>
>
>
> # Entered into the public domain 20 March 2009
> # James R. Phillips
> # 2548 Vera Cruz Drive
> # Birmingham, AL 35235 USA
> # email: zu...@zu... <mailto:zu...@zu...>
> # http://zunzun.com
>
> import numpy as np
> import math, matplotlib
> matplotlib.use('Agg') # must be used prior to the next two statements
> import matplotlib.pyplot as plt
> import matplotlib.mlab as mlab
>
>
> def DetermineOnOrOffFromString(in_String):
> tempString = in_String.split('_')[-1:][0].upper() # allows any
> amount of prefacing text
> if tempString == 'ON':
> return True
> return False
>
>
> def DetermineScientificNotationFromString(inData, in_String):
> tempString = in_String.split('_')[-1:][0].upper() # allows any
> amount of prefacing text
> if tempString == 'ON':
> return True
> elif tempString == 'OFF':
> return False
> else: # must be AUTO
> minVal = np.abs(np.min(inData))
> maxVal = np.abs(np.max(inData))
> deltaVal = np.abs(maxVal - minVal)
>
> scientificNotation = False
> if (maxVal > 100.0) or (minVal < -100.0) or (deltaVal < .05):
> scientificNotation = True
> return scientificNotation
>
>
> def CommonPlottingCode(in_WidthInPixels, in_HeightInPixels, in_XName,
> in_YName, in_UseOffsetIfNeeded, in_X_UseScientificNotationIfNeeded,
> in_Y_UseScientificNotationIfNeeded, in_Left, in_Bottom, in_Right,
> in_Top): # default to lots of room around graph
>
> # a litle more room between x axis and tick mark labels, so not
> text overlap at the bottom left corner - set this before other calls
> matplotlib.rcParams['xtick.major.pad'] = 5+
> (float(in_HeightInPixels) / 100.0) # minimum + some scaled
>
> fig = plt.figure(figsize=(float(in_WidthInPixels ) / 100.0,
> float(in_HeightInPixels ) / 100.0), dpi=100)
> fig.subplotpars.update(in_Left, in_Bottom, in_Right, in_Top)
> ax = fig.add_subplot(111, frameon=True)
>
> # white background, almost no border space
> fig.set_facecolor('w')
>
> xFormatter = fig.gca().xaxis.get_major_formatter()
> xFormatter._useOffset = in_UseOffsetIfNeeded
> xFormatter.set_scientific(in_X_UseScientificNotationIfNeeded)
> fig.gca().xaxis.set_major_formatter(xFormatter)
>
> yFormatter = fig.gca().yaxis.get_major_formatter()
> yFormatter._useOffset = in_UseOffsetIfNeeded
> yFormatter.set_scientific(in_Y_UseScientificNotationIfNeeded)
> fig.gca().yaxis.set_major_formatter(yFormatter)
>
> # Scale text to imagesize. Text sizes originally determined at
> image size of 500 x 400
> widthRatioForTextSize = float(in_WidthInPixels) / 500.0
> heightRatioForTextSize = float(in_HeightInPixels) / 400.0
> for xlabel_i in ax.get_xticklabels():
> xlabel_i.set_fontsize(xlabel_i.get_fontsize() *
> heightRatioForTextSize)
> xOffsetText = fig.gca().xaxis.get_offset_text()
> xOffsetText.set_fontsize(xOffsetText.get_fontsize() *
> heightRatioForTextSize * 0.9)
> for ylabel_i in ax.get_yticklabels():
> ylabel_i.set_fontsize(ylabel_i.get_fontsize() *
> widthRatioForTextSize)
> yOffsetText = fig.gca().yaxis.get_offset_text()
> yOffsetText.set_fontsize(yOffsetText.get_fontsize() *
> heightRatioForTextSize * 0.9)
>
> x_label = ax.set_xlabel(in_XName)
> y_label = ax.set_ylabel(in_YName)
> x_label._fontproperties._size = x_label._fontproperties._size *
> heightRatioForTextSize
> y_label._fontproperties._size = y_label._fontproperties._size *
> widthRatioForTextSize
>
> plt.grid(True) # call this just before returning
>
> return fig, ax
>
>
> def YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax,
> in_WidthInPixels, in_HeightInPixels, in_OffsetUsed):
> # draw everything so items can be measured for size
> canvas = plt.get_current_fig_manager().canvas
> canvas.draw()
>
> # some preliminary info
> xLabelPoints =
> ax.set_xlabel(ax.get_xlabel()).get_window_extent().get_points() # [
> [x,y], [x,y] ]
> yLabelPoints =
> ax.set_ylabel(ax.get_ylabel()).get_window_extent().get_points() # [
> [x,y], [x,y] ], rotated 90 degrees
> xTickZeroPoints =
> ax.get_xticklabels()[0].get_window_extent().get_points()
> yTickZeroPoints =
> ax.get_yticklabels()[0].get_window_extent().get_points()
> xTickIndexPoints =
> ax.get_xticklabels()[len(ax.get_xticklabels())-1].get_window_extent().get_points()
> yTickIndexPoints =
> ax.get_yticklabels()[len(ax.get_yticklabels())-1].get_window_extent().get_points()
> currentPoints = ax.bbox.get_points()
> maxLeft = currentPoints[0][0]
> maxBottom = currentPoints[0][1]
> maxRight = currentPoints[1][0]
> maxTop = currentPoints[1][1]
>
> # find the most left-ward location
> if xTickZeroPoints[0][0] < maxLeft:
> maxLeft = xTickZeroPoints[0][0]
> if yTickZeroPoints[0][0] < maxLeft:
> maxLeft = yTickZeroPoints[0][0]
> if yTickIndexPoints[0][0] < maxLeft:
> maxLeft = yTickIndexPoints[0][0]
> if xLabelPoints[0][0] < maxLeft:
> maxLeft = xLabelPoints[0][0]
> if yLabelPoints[0][0] < maxLeft: # 90 degrees
> maxLeft = yLabelPoints[0][0]
>
> # find the most right-ward location
> if xTickIndexPoints[1][0] > maxRight:
> maxRight = xTickIndexPoints[1][0]
> if xLabelPoints[1][0] > maxRight:
> maxRight = xLabelPoints[1][0]
>
> # find the most bottom-ward location
> if xTickZeroPoints[0][1] < maxBottom:
> maxBottom = xTickZeroPoints[0][1]
> if xLabelPoints[0][1] < maxBottom:
> maxBottom = xLabelPoints[0][1]
> if yLabelPoints[0][1] < maxBottom:
> maxBottom = yLabelPoints[0][1]
>
> # find the most top-ward location
> if yTickIndexPoints[1][1] > maxTop:
> maxTop = yTickIndexPoints[1][1]
> if True == in_OffsetUsed: # could not find a better way to get this
> yp = ax.get_yticklabels()[0].get_window_extent().get_points()
> maxTop += yp[1][1] - yp[0][1]
>
> newLeft = ax.bbox._bbox.get_points()[0][0] - (float(maxLeft) /
> float(in_WidthInPixels)) + 0.01
> newBottom = ax.bbox._bbox.get_points()[0][1] - (float(maxBottom) /
> float(in_HeightInPixels)) + 0.01
> newRight = ax.bbox._bbox.get_points()[1][0] + (1.0 -
> (float(maxRight) / float(in_WidthInPixels))) - 0.01
> newTop = ax.bbox._bbox.get_points()[1][1] + (1.0 - (float(maxTop)
> / float(in_HeightInPixels))) - 0.01
>
> # now redraw and check number of X tick marks
> canvas.draw()
>
> # Calculate major number of X tick marks based on label size
> totalWidth = 0.0
> maxWidth = 0.0
> numberOfMajor_X_TickMarks = len(ax.get_xticklabels())
> for xlabel_i in ax.get_xticklabels():
> w = xlabel_i.get_window_extent().get_points() # the drawn text
> bounding box corners as numpy array of [x,y], [x,y]
> width = w[1][0] - w[0][0]
> totalWidth += width
> if width > maxWidth:
> maxWidth = width
> if totalWidth > (0.95 * ((newRight - newLeft) *
> float(in_WidthInPixels))): # 0.95 for some spacing between tick labels
> numberOfMajor_X_TickMarks = int(math.floor((0.95 * ((newRight
> - newLeft) * float(in_WidthInPixels))) / maxWidth))
>
> return (newLeft, newBottom, newRight, newTop,
> numberOfMajor_X_TickMarks,)
>
>
> def HistogramPlot(in_DataToPlot, in_FileNameAndPath, in_DataName,
> in_FillColor, in_WidthInPixels, in_HeightInPixels,
> in_UseOffsetIfNeeded, in_UseScientificNotationIfNeeded):
>
> # decode ends of strings ('XYZ_ON', 'XYZ_OFF', 'XYZ_AUTO', etc.)
> to boolean values
> scientificNotation =
> DetermineScientificNotationFromString(in_DataToPlot,
> in_UseScientificNotationIfNeeded)
> useOffsetIfNeeded = DetermineOnOrOffFromString(in_UseOffsetIfNeeded)
>
> numberOfBins = len(in_DataToPlot) / 2
> if numberOfBins > 25:
> numberOfBins = 25
> if numberOfBins < 5:
> numberOfBins = 5
>
> # first with 0, 0, 1, 1
> fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
> in_DataName, 'Frequency', useOffsetIfNeeded, scientificNotation,
> False, 0.0, 0.0, 1.0, 1.0)
>
> # histogram of data
> n, bins, patches = ax.hist(in_DataToPlot, numberOfBins,
> facecolor=in_FillColor)
>
> # some axis space at the top of the graph
> ylim = ax.get_ylim()
> if ylim[1] == max(n):
> ax.set_ylim(0.0, ylim[1] + 1)
>
> newLeft, newBottom, newRight, newTop, numberOfMajor_X_TickMarks =
> YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
> in_HeightInPixels, False)
>
> # now with scaled
> fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
> in_DataName, 'Frequency', useOffsetIfNeeded, scientificNotation,
> False, newLeft, newBottom, newRight, newTop)
>
> # histogram of data
> n, bins, patches = ax.hist(in_DataToPlot, numberOfBins,
> facecolor=in_FillColor)
>
> # some axis space at the top of the graph
> ylim = ax.get_ylim()
> if ylim[1] == max(n):
> ax.set_ylim(0.0, ylim[1] + 1)
>
> if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
>
> ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
>
> fig.savefig(in_FileNameAndPath, format = 'png', dpi=100)
>
>
> def ScatterPlot(in_DataToPlot, in_FileNameAndPath, in_DataNameX,
> in_DataNameY, in_WidthInPixels, in_HeightInPixels,
> in_UseOffsetIfNeeded, in_ReverseXY,
> in_X_UseScientificNotationIfNeeded, in_Y_UseScientificNotationIfNeeded):
>
> # decode ends of strings ('XYZ_ON', 'XYZ_OFF', 'XYZ_AUTO', etc.)
> to boolean values
> scientificNotationX =
> DetermineScientificNotationFromString(in_DataToPlot[0],
> in_X_UseScientificNotationIfNeeded)
> scientificNotationY =
> DetermineScientificNotationFromString(in_DataToPlot[1],
> in_Y_UseScientificNotationIfNeeded)
> useOffsetIfNeeded = DetermineOnOrOffFromString(in_UseOffsetIfNeeded)
> reverseXY = DetermineOnOrOffFromString(in_ReverseXY)
>
> if reverseXY:
> fig, ax = CommonPlottingCode(in_WidthInPixels,
> in_HeightInPixels, in_DataNameY, in_DataNameX, useOffsetIfNeeded,
> scientificNotationX, scientificNotationY, 0.0, 0.0, 1.0, 1.0)
> ax.plot(np.array([min(in_DataToPlot[1]),
> max(in_DataToPlot[1])]), np.array([min(in_DataToPlot[0]),
> max(in_DataToPlot[0])]), 'o') # first ax.plot() is only with extents
> newLeft, newBottom, newRight, newTop,
> numberOfMajor_X_TickMarks =
> YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
> in_HeightInPixels, scientificNotationY or useOffsetIfNeeded)
> fig, ax = CommonPlottingCode(in_WidthInPixels,
> in_HeightInPixels, in_DataNameY, in_DataNameX, useOffsetIfNeeded,
> scientificNotationX, scientificNotationY, newLeft, newBottom,
> newRight, newTop)
> if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
>
> ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
> ax.plot(in_DataToPlot[1], in_DataToPlot[0], 'o') # now that
> autoscaling is done, use all data for second ax.plot()
> else:
> fig, ax = CommonPlottingCode(in_WidthInPixels,
> in_HeightInPixels, in_DataNameX, in_DataNameY, useOffsetIfNeeded,
> scientificNotationY, scientificNotationX, 0.0, 0.0, 1.0, 1.0)
> ax.plot(np.array([min(in_DataToPlot[0]),
> max(in_DataToPlot[0])]), np.array([min(in_DataToPlot[1]),
> max(in_DataToPlot[1])]), 'o') # first ax.plot() is only with extents
> newLeft, newBottom, newRight, newTop,
> numberOfMajor_X_TickMarks =
> YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
> in_HeightInPixels, scientificNotationY or useOffsetIfNeeded)
> fig, ax = CommonPlottingCode(in_WidthInPixels,
> in_HeightInPixels, in_DataNameX, in_DataNameY, useOffsetIfNeeded,
> scientificNotationY, scientificNotationX, newLeft, newBottom,
> newRight, newTop)
> if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
>
> ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
> ax.plot(in_DataToPlot[0], in_DataToPlot[1], 'o') # now that
> autoscaling is done, use all data for second ax.plot()
>
> fig.savefig(in_FileNameAndPath, format = 'png', dpi=100)
>
>
> if __name__ in ('main', '__main__'):
>
> testData1D = 12345678901.5 + np.random.randn(100)
> testData2D = [testData1D, 1000.0 * testData1D + 1500 + 200.0 *
> np.random.randn(100)]
>
> # note file names
> HistogramPlot(testData1D, 'test_histogram_large.png', 'Test Data
> Name', 'lightgrey',
> 1024, 768, 'UseOffset_ON', 'ScientificNotation_ON')
>
> HistogramPlot(testData1D, 'test_histogram_small.png', 'Test Data
> Name', 'lightgrey',
> 320, 240, 'UseOffset_ON', 'ScientificNotation_ON')
>
> ScatterPlot(testData2D, 'test_scatterplot_small.png', 'Test Data X
> Name', 'Test Data Y Name',
> 320, 240, 'UseOffset_ON', 'ReverseXY_OFF',
> 'ScientificNotation_X_OFF', 'ScientificNotation_Y_OFF')
>
> ScatterPlot(testData2D, 'test_scatterplot_large.png', 'Test Data X
> Name', 'Test Data Y Name',
> 1024, 768, 'UseOffset_ON', 'ReverseXY_ON',
> 'ScientificNotation_X_OFF', 'ScientificNotation_Y_ON')
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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: Michael H. <mh...@us...> - 2009-03-20 18:31:40
|
Trying your suggestion did not work. However, doing this: export CPP=/usr/bin/g++ python setup.py build did work. Go figure. --Mike Michael Droettboom wrote: > Hmm... the selection of the compiler command is actually deep within > distutils -- matplotlib doesn't address it. I'm surprised the CXX > environment variable isn't getting picked up. I use that all the time > to test different compilers. > > Did you try: > > export CXX=/usr/bin/g++ > python setup.py build > > If that doesn't work, I'm at a loss -- you could start investigating > on distutils and/or gcc lists. > > Cheers, > Mike > > > > Michael Hearne wrote: >> I tried setting CXX=/usr/bin/g++ in my .bashrc, but I still get the >> same error. Is there some file in the matplotlib distribution that I >> need to edit with this information? >> >> --Mike >> >> Michael Hearne wrote: >>> I can't using gcc, but I can using g++, which is installed. I guess >>> I'll just set the CXX variable to the path for g++. >>> >>> I don't know enough about gcc to understand why the two aren't >>> linked together... >>> >>> Thanks for the help, >>> >>> Mike >>> Michael Droettboom wrote: >>> >>>> Michael Hearne wrote: >>>> >>>>> Two questions: >>>>> 1) I'm trying to upgrade an installation of matplotlib I have on a >>>>> RHEL5 system. When trying: >>>>> >>>>> /usr/local/bin/python setup.py build >>>>> >>>>> I get the error message: >>>>> "gcc: src/ft2font.cpp: C++ compiler not installed on this system >>>>> error: command 'gcc' failed with exit status 1" >>>>> >>>>> I do in fact have a C++ compiler on the system, in the form of >>>>> g++. Is there a place where I can configure the C++ compiler to use? >>>>> >>>> distutils will use the CXX environment variable if it is set. >>>> Though you should be able to compile C++ with gcc as well, if the >>>> C++ backend is installed -- that's why the error message is >>>> surprising to me if you're certain you have g++ installed. Can you >>>> compile a simple C++ file with gcc directly from the commandline? >>>> >>>> Cheers, >>>> Mike >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly >>> and >>> easily build your RIAs with Flex Builder, the Eclipse(TM)based >>> development >>> software that enables intelligent coding and step-through debugging. >>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> > |
|
From: Michael D. <md...@st...> - 2009-03-20 18:12:22
|
Hmm... the selection of the compiler command is actually deep within distutils -- matplotlib doesn't address it. I'm surprised the CXX environment variable isn't getting picked up. I use that all the time to test different compilers. Did you try: export CXX=/usr/bin/g++ python setup.py build If that doesn't work, I'm at a loss -- you could start investigating on distutils and/or gcc lists. Cheers, Mike Michael Hearne wrote: > I tried setting CXX=/usr/bin/g++ in my .bashrc, but I still get the > same error. Is there some file in the matplotlib distribution that I > need to edit with this information? > > --Mike > > Michael Hearne wrote: >> I can't using gcc, but I can using g++, which is installed. I guess >> I'll just set the CXX variable to the path for g++. >> >> I don't know enough about gcc to understand why the two aren't linked >> together... >> >> Thanks for the help, >> >> Mike >> Michael Droettboom wrote: >> >>> Michael Hearne wrote: >>> >>>> Two questions: >>>> 1) I'm trying to upgrade an installation of matplotlib I have on a >>>> RHEL5 system. When trying: >>>> >>>> /usr/local/bin/python setup.py build >>>> >>>> I get the error message: >>>> "gcc: src/ft2font.cpp: C++ compiler not installed on this system >>>> error: command 'gcc' failed with exit status 1" >>>> >>>> I do in fact have a C++ compiler on the system, in the form of >>>> g++. Is there a place where I can configure the C++ compiler to use? >>>> >>> distutils will use the CXX environment variable if it is set. >>> Though you should be able to compile C++ with gcc as well, if the >>> C++ backend is installed -- that's why the error message is >>> surprising to me if you're certain you have g++ installed. Can you >>> compile a simple C++ file with gcc directly from the commandline? >>> >>> Cheers, >>> Mike >>> >>> >> >> >> ------------------------------------------------------------------------------ >> >> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are >> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and >> easily build your RIAs with Flex Builder, the Eclipse(TM)based >> development >> software that enables intelligent coding and step-through debugging. >> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >> _______________________________________________ >> 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: Eric F. <ef...@ha...> - 2009-03-20 18:11:37
|
Stano Paška wrote:
> Hi,
> I am using matplotlib first time and I am wonder how to free resources
>
> I have this script
>
> # coding: utf-8
>
> import matplotlib
> matplotlib.use('Agg')
>
> import pylab
>
> class Graph:
>
> def __init__(self):
> # sirka stlpcov
> self.width = 0.5
> self.font = {'fontname':'Tahoma', 'fontsize':10}
>
> def setTitle(self, title):
> """Nastavi nadpis grafu
> """
> self.title = title
>
> def setXLabel(self, label):
> self.x_label = label
>
> def setYLabel(self, label):
> self.y_label = label
>
> def setYValues(self, values):
> """Nastavi y-ove hodnoty
> """
> self.y_values = values
> # vypocitame lave spodne rohy stlpcov
> self.x_values = [x + self.width / 2 for x in range(len(self.y_values))]
> # vypocitame stred stlpcov (znacky na x-ovej osi)
> self.x_ticks = [x + self.width for x in range(len(self.y_values))]
>
> def setXTickLabels(self, labels):
> """Nastavi popisky pre ciarky na x-ovej osi
> """
> self.x_ticksLabels = labels
>
> def makeGraph(self):
> self.fig = pylab.figure()
> self.fig.set_dpi(72)
> self.fig.set_figheight(3)
> self.fig.set_figwidth(5)
>
> self.fig.subplots_adjust(bottom=0.15)
>
> self.ax = self.fig.add_subplot(111)
>
> self.ax.bar(left=self.x_values, height=self.y_values,
> width=self.width, color='#f00000')
> self.ax.set_xticks(self.x_ticks)
> self.ax.set_xticklabels(self.x_ticksLabels)
>
> self.ax.set_xlabel(self.x_label, **self.font)
> self.ax.set_ylabel(self.y_label, **self.font)
> self.ax.set_title(self.title, **self.font)
>
> def saveGraph(self, path):
> self.fig.savefig(path, format='png')
>
> def __del__(self):
> self.fig.delaxes(self.ax)
> del self.fig
> del self.ax
>
> if __name__ == '__main__':
> import random
> import gc
> for i in range(5000):
> g = Graph()
> g.setTitle(u'Spotreba za rok 2008 podľa ATC skupín')
> g.setXLabel(u'ATC skupiny')
> g.setYLabel(u'Spotreba v EUR')
> g.setYValues([random.randint(0, x) for x in range(20)])
> g.setXTickLabels([chr(random.randint(65, 90)) for x in range(20)])
> g.makeGraph()
> g.saveGraph('grafy/' + str(i) + '.png')
> del g
> print gc.get_count()
> gc.collect()
> print gc.get_count()
>
> When I used TkAgg, it crashes after 190 images (Fail to create pixmap
> with Tk_GetPixmap in ImgPhotoInstanceSetSize. tried to delete photo
> image when instances still exist).
> When I switch to WX, it crashes after 400 images.
> And Agg crashes when pagefile reaches 1.5x ram (cca 2000 images).
>
> It is possible somehow free resources in matplotlib?
You need to close the figure. Try putting
pylab.close(self.fig) at the start of your __del__ method. In fact, I
doubt you need to explicitly del anything in that method--you just need
to close the figure so that pylab will release its references related to
that figure.
There may be more things you need to change, but closing the figure is
certainly going to be a big one.
Eric
>
> I use python 2.5.4, wx 2.8.9.2, numpy 1.3.0b1 on win XP
>
> Thanks for answers.
>
> Stano.
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Michael H. <mh...@us...> - 2009-03-20 18:05:12
|
I tried setting CXX=/usr/bin/g++ in my .bashrc, but I still get the same error. Is there some file in the matplotlib distribution that I need to edit with this information? --Mike Michael Hearne wrote: > I can't using gcc, but I can using g++, which is installed. I guess > I'll just set the CXX variable to the path for g++. > > I don't know enough about gcc to understand why the two aren't linked > together... > > Thanks for the help, > > Mike > Michael Droettboom wrote: > >> Michael Hearne wrote: >> >>> Two questions: >>> 1) I'm trying to upgrade an installation of matplotlib I have on a >>> RHEL5 system. When trying: >>> >>> /usr/local/bin/python setup.py build >>> >>> I get the error message: >>> "gcc: src/ft2font.cpp: C++ compiler not installed on this system >>> error: command 'gcc' failed with exit status 1" >>> >>> I do in fact have a C++ compiler on the system, in the form of g++. >>> Is there a place where I can configure the C++ compiler to use? >>> >>> >> distutils will use the CXX environment variable if it is set. Though >> you should be able to compile C++ with gcc as well, if the C++ backend >> is installed -- that's why the error message is surprising to me if >> you're certain you have g++ installed. Can you compile a simple C++ >> file with gcc directly from the commandline? >> >> Cheers, >> Mike >> >> > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Michael H. <mh...@us...> - 2009-03-20 17:49:36
|
I can't using gcc, but I can using g++, which is installed. I guess I'll just set the CXX variable to the path for g++. I don't know enough about gcc to understand why the two aren't linked together... Thanks for the help, Mike Michael Droettboom wrote: > Michael Hearne wrote: >> Two questions: >> 1) I'm trying to upgrade an installation of matplotlib I have on a >> RHEL5 system. When trying: >> >> /usr/local/bin/python setup.py build >> >> I get the error message: >> "gcc: src/ft2font.cpp: C++ compiler not installed on this system >> error: command 'gcc' failed with exit status 1" >> >> I do in fact have a C++ compiler on the system, in the form of g++. >> Is there a place where I can configure the C++ compiler to use? >> > distutils will use the CXX environment variable if it is set. Though > you should be able to compile C++ with gcc as well, if the C++ backend > is installed -- that's why the error message is surprising to me if > you're certain you have g++ installed. Can you compile a simple C++ > file with gcc directly from the commandline? > > Cheers, > Mike > |
|
From: Eric F. <ef...@ha...> - 2009-03-20 17:42:34
|
Michael Droettboom wrote:
> Unfortunately, the EMF backend is no longer maintained. We had
> discussed removing it well over a year ago, and I actually thought it
> had been removed, but obviously it wasn't.
>
> It needs someone to port it to the new backend API introduced in 0.98.x
> and to maintain that code. When quite some time ago, there really
> wasn't much interest in doing that. I would be happy to help someone
> with the details involved, but don't have the time myself at the moment.
>
> Sorry for the confusion -- what do other developers think? Should we
> remove the backend and document the change, at least for the time being?
Mike,
Yes, like you I thought we had included it on the to-be-removed list,
but evidently I remembered incorrectly.
Here is the history of the file:
10 months jdh2358 removed pre py2.4 compatability code and some
other dead code
10 months mdboom Merged revisions 5106-5108 via svnmerge from
18 months mdboom Refactoring of FigureCanvas*.print_figure so that
each backend does
19 months efiring Use pickle to cache entire fontManager instance.
21 months nnemec remove trailing spaces
2 years cmoad added rotation arg to draw_arc method everywhere it was
missing
2 years jdh2358 added custom figure class hook
2 years jdh2358 fixed figimage bug
3 years jdh2358 added Aarre linestyle fix for emf backend
3 years dsdale added **kwargs to all backend_*.print_figure
3 years jdh2358 made the rc warnings a bit more readable
3 years jdh2358 added pyemf
I think it should be removed now. If someone comes forward with a
strong commitment to update and maintain it, it can be reinstated
easily--after that person has done the updating required to make it work
in the trunk.
Eric
>
> Mike
>
> Torsten Bronger wrote:
>> Hallöchen!
>>
>> I use pyemf 2.0 and Matplotlib 0.98.5. If I try to save a trivial
>> plot into an EMF file, I get
>>
>> Traceback (most recent call last):
>> File "./make_plots.py", line 23, in <module>
>> figure.savefig(sample_name + "_pds.emf")
>> File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 990, in savefig
>> self.canvas.print_figure(*args, **kwargs)
>> File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 1419, in print_figure
>> **kwargs)
>> File "/usr/lib/python2.5/[...]/matplotlib/backends/backend_emf.py", line 604, in print_emf
>> self.figure.draw(renderer)
>> File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 738, in draw
>> if self.frameon: self.patch.draw(renderer)
>> File "/usr/lib/python2.5/[...]/matplotlib/patches.py", line 301, in draw
>> renderer.draw_path(gc, tpath, affine, rgbFace)
>> File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 74, in draw_path
>> raise NotImplementedError
>> NotImplementedError
>>
>> Is this a bug or a mal-configuration? The Python code was
>>
>> figure = pyplot.figure()
>> axes = figure.add_subplot(111)
>> x, y = numpy.loadtxt("data.dat", comments="#", usecols=(0, 1), unpack=True)
>> axes.semilogy(x, y)
>> figure.savefig("test.emf")
>>
>> Tschö,
>> Torsten.
>>
>>
>
|
|
From: Stano P. <sta...@gm...> - 2009-03-20 17:30:26
|
Hi,
I am using matplotlib first time and I am wonder how to free resources
I have this script
# coding: utf-8
import matplotlib
matplotlib.use('Agg')
import pylab
class Graph:
def __init__(self):
# sirka stlpcov
self.width = 0.5
self.font = {'fontname':'Tahoma', 'fontsize':10}
def setTitle(self, title):
"""Nastavi nadpis grafu
"""
self.title = title
def setXLabel(self, label):
self.x_label = label
def setYLabel(self, label):
self.y_label = label
def setYValues(self, values):
"""Nastavi y-ove hodnoty
"""
self.y_values = values
# vypocitame lave spodne rohy stlpcov
self.x_values = [x + self.width / 2 for x in range(len(self.y_values))]
# vypocitame stred stlpcov (znacky na x-ovej osi)
self.x_ticks = [x + self.width for x in range(len(self.y_values))]
def setXTickLabels(self, labels):
"""Nastavi popisky pre ciarky na x-ovej osi
"""
self.x_ticksLabels = labels
def makeGraph(self):
self.fig = pylab.figure()
self.fig.set_dpi(72)
self.fig.set_figheight(3)
self.fig.set_figwidth(5)
self.fig.subplots_adjust(bottom=0.15)
self.ax = self.fig.add_subplot(111)
self.ax.bar(left=self.x_values, height=self.y_values,
width=self.width, color='#f00000')
self.ax.set_xticks(self.x_ticks)
self.ax.set_xticklabels(self.x_ticksLabels)
self.ax.set_xlabel(self.x_label, **self.font)
self.ax.set_ylabel(self.y_label, **self.font)
self.ax.set_title(self.title, **self.font)
def saveGraph(self, path):
self.fig.savefig(path, format='png')
def __del__(self):
self.fig.delaxes(self.ax)
del self.fig
del self.ax
if __name__ == '__main__':
import random
import gc
for i in range(5000):
g = Graph()
g.setTitle(u'Spotreba za rok 2008 podľa ATC skupín')
g.setXLabel(u'ATC skupiny')
g.setYLabel(u'Spotreba v EUR')
g.setYValues([random.randint(0, x) for x in range(20)])
g.setXTickLabels([chr(random.randint(65, 90)) for x in range(20)])
g.makeGraph()
g.saveGraph('grafy/' + str(i) + '.png')
del g
print gc.get_count()
gc.collect()
print gc.get_count()
When I used TkAgg, it crashes after 190 images (Fail to create pixmap
with Tk_GetPixmap in ImgPhotoInstanceSetSize. tried to delete photo
image when instances still exist).
When I switch to WX, it crashes after 400 images.
And Agg crashes when pagefile reaches 1.5x ram (cca 2000 images).
It is possible somehow free resources in matplotlib?
I use python 2.5.4, wx 2.8.9.2, numpy 1.3.0b1 on win XP
Thanks for answers.
Stano.
|
|
From: Michael D. <md...@st...> - 2009-03-20 17:11:45
|
Michael Hearne wrote: > Two questions: > 1) I'm trying to upgrade an installation of matplotlib I have on a RHEL5 > system. When trying: > > /usr/local/bin/python setup.py build > > I get the error message: > "gcc: src/ft2font.cpp: C++ compiler not installed on this system > error: command 'gcc' failed with exit status 1" > > I do in fact have a C++ compiler on the system, in the form of g++. Is > there a place where I can configure the C++ compiler to use? > distutils will use the CXX environment variable if it is set. Though you should be able to compile C++ with gcc as well, if the C++ backend is installed -- that's why the error message is surprising to me if you're certain you have g++ installed. Can you compile a simple C++ file with gcc directly from the commandline? Cheers, Mike -- 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-03-20 17:06:22
|
Michael Hearne wrote: > 2) So that I don't have to bother the list with things like this, how > can I _search_ the mailing list for keywords? I usually search mailing lists through gmane.org, for this particular list the link is: http://dir.gmane.org/gmane.comp.python.matplotlib.general JLS |
|
From: Michael H. <mh...@us...> - 2009-03-20 16:48:35
|
Two questions: 1) I'm trying to upgrade an installation of matplotlib I have on a RHEL5 system. When trying: /usr/local/bin/python setup.py build I get the error message: "gcc: src/ft2font.cpp: C++ compiler not installed on this system error: command 'gcc' failed with exit status 1" I do in fact have a C++ compiler on the system, in the form of g++. Is there a place where I can configure the C++ compiler to use? 2) So that I don't have to bother the list with things like this, how can I _search_ the mailing list for keywords? If I go here: http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users I don't see any way to search the archives, other than manually paging through them. |
|
From: Michael D. <md...@st...> - 2009-03-20 16:38:22
|
Unfortunately, the EMF backend is no longer maintained. We had
discussed removing it well over a year ago, and I actually thought it
had been removed, but obviously it wasn't.
It needs someone to port it to the new backend API introduced in 0.98.x
and to maintain that code. When quite some time ago, there really
wasn't much interest in doing that. I would be happy to help someone
with the details involved, but don't have the time myself at the moment.
Sorry for the confusion -- what do other developers think? Should we
remove the backend and document the change, at least for the time being?
Mike
Torsten Bronger wrote:
> Hallöchen!
>
> I use pyemf 2.0 and Matplotlib 0.98.5. If I try to save a trivial
> plot into an EMF file, I get
>
> Traceback (most recent call last):
> File "./make_plots.py", line 23, in <module>
> figure.savefig(sample_name + "_pds.emf")
> File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 990, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 1419, in print_figure
> **kwargs)
> File "/usr/lib/python2.5/[...]/matplotlib/backends/backend_emf.py", line 604, in print_emf
> self.figure.draw(renderer)
> File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 738, in draw
> if self.frameon: self.patch.draw(renderer)
> File "/usr/lib/python2.5/[...]/matplotlib/patches.py", line 301, in draw
> renderer.draw_path(gc, tpath, affine, rgbFace)
> File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 74, in draw_path
> raise NotImplementedError
> NotImplementedError
>
> Is this a bug or a mal-configuration? The Python code was
>
> figure = pyplot.figure()
> axes = figure.add_subplot(111)
> x, y = numpy.loadtxt("data.dat", comments="#", usecols=(0, 1), unpack=True)
> axes.semilogy(x, y)
> figure.savefig("test.emf")
>
> Tschö,
> Torsten.
>
>
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
|
|
From: James P. <zu...@zu...> - 2009-03-20 12:23:23
|
All,
Attached, and below, is public domain code for making variable-sized
plots with autoscaled text that exactly fits the available visual plot
space, useful for web sites where users choose output files with different
sizes. Examples are at the bottom of the file.
James R. Phillips
2548 Vera Cruz Drive
Birmingham, AL 35235 USA
email: zu...@zu...
http://zunzun.com
# Entered into the public domain 20 March 2009
# James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
# email: zu...@zu...
# http://zunzun.com
import numpy as np
import math, matplotlib
matplotlib.use('Agg') # must be used prior to the next two statements
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
def DetermineOnOrOffFromString(in_String):
tempString = in_String.split('_')[-1:][0].upper() # allows any amount of
prefacing text
if tempString == 'ON':
return True
return False
def DetermineScientificNotationFromString(inData, in_String):
tempString = in_String.split('_')[-1:][0].upper() # allows any amount of
prefacing text
if tempString == 'ON':
return True
elif tempString == 'OFF':
return False
else: # must be AUTO
minVal = np.abs(np.min(inData))
maxVal = np.abs(np.max(inData))
deltaVal = np.abs(maxVal - minVal)
scientificNotation = False
if (maxVal > 100.0) or (minVal < -100.0) or (deltaVal < .05):
scientificNotation = True
return scientificNotation
def CommonPlottingCode(in_WidthInPixels, in_HeightInPixels, in_XName,
in_YName, in_UseOffsetIfNeeded, in_X_UseScientificNotationIfNeeded,
in_Y_UseScientificNotationIfNeeded, in_Left, in_Bottom, in_Right, in_Top): #
default to lots of room around graph
# a litle more room between x axis and tick mark labels, so not text
overlap at the bottom left corner - set this before other calls
matplotlib.rcParams['xtick.major.pad'] = 5+ (float(in_HeightInPixels) /
100.0) # minimum + some scaled
fig = plt.figure(figsize=(float(in_WidthInPixels ) / 100.0,
float(in_HeightInPixels ) / 100.0), dpi=100)
fig.subplotpars.update(in_Left, in_Bottom, in_Right, in_Top)
ax = fig.add_subplot(111, frameon=True)
# white background, almost no border space
fig.set_facecolor('w')
xFormatter = fig.gca().xaxis.get_major_formatter()
xFormatter._useOffset = in_UseOffsetIfNeeded
xFormatter.set_scientific(in_X_UseScientificNotationIfNeeded)
fig.gca().xaxis.set_major_formatter(xFormatter)
yFormatter = fig.gca().yaxis.get_major_formatter()
yFormatter._useOffset = in_UseOffsetIfNeeded
yFormatter.set_scientific(in_Y_UseScientificNotationIfNeeded)
fig.gca().yaxis.set_major_formatter(yFormatter)
# Scale text to imagesize. Text sizes originally determined at image
size of 500 x 400
widthRatioForTextSize = float(in_WidthInPixels) / 500.0
heightRatioForTextSize = float(in_HeightInPixels) / 400.0
for xlabel_i in ax.get_xticklabels():
xlabel_i.set_fontsize(xlabel_i.get_fontsize() *
heightRatioForTextSize)
xOffsetText = fig.gca().xaxis.get_offset_text()
xOffsetText.set_fontsize(xOffsetText.get_fontsize() *
heightRatioForTextSize * 0.9)
for ylabel_i in ax.get_yticklabels():
ylabel_i.set_fontsize(ylabel_i.get_fontsize() *
widthRatioForTextSize)
yOffsetText = fig.gca().yaxis.get_offset_text()
yOffsetText.set_fontsize(yOffsetText.get_fontsize() *
heightRatioForTextSize * 0.9)
x_label = ax.set_xlabel(in_XName)
y_label = ax.set_ylabel(in_YName)
x_label._fontproperties._size = x_label._fontproperties._size *
heightRatioForTextSize
y_label._fontproperties._size = y_label._fontproperties._size *
widthRatioForTextSize
plt.grid(True) # call this just before returning
return fig, ax
def YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
in_HeightInPixels, in_OffsetUsed):
# draw everything so items can be measured for size
canvas = plt.get_current_fig_manager().canvas
canvas.draw()
# some preliminary info
xLabelPoints =
ax.set_xlabel(ax.get_xlabel()).get_window_extent().get_points() # [ [x,y],
[x,y] ]
yLabelPoints =
ax.set_ylabel(ax.get_ylabel()).get_window_extent().get_points() # [ [x,y],
[x,y] ], rotated 90 degrees
xTickZeroPoints =
ax.get_xticklabels()[0].get_window_extent().get_points()
yTickZeroPoints =
ax.get_yticklabels()[0].get_window_extent().get_points()
xTickIndexPoints =
ax.get_xticklabels()[len(ax.get_xticklabels())-1].get_window_extent().get_points()
yTickIndexPoints =
ax.get_yticklabels()[len(ax.get_yticklabels())-1].get_window_extent().get_points()
currentPoints = ax.bbox.get_points()
maxLeft = currentPoints[0][0]
maxBottom = currentPoints[0][1]
maxRight = currentPoints[1][0]
maxTop = currentPoints[1][1]
# find the most left-ward location
if xTickZeroPoints[0][0] < maxLeft:
maxLeft = xTickZeroPoints[0][0]
if yTickZeroPoints[0][0] < maxLeft:
maxLeft = yTickZeroPoints[0][0]
if yTickIndexPoints[0][0] < maxLeft:
maxLeft = yTickIndexPoints[0][0]
if xLabelPoints[0][0] < maxLeft:
maxLeft = xLabelPoints[0][0]
if yLabelPoints[0][0] < maxLeft: # 90 degrees
maxLeft = yLabelPoints[0][0]
# find the most right-ward location
if xTickIndexPoints[1][0] > maxRight:
maxRight = xTickIndexPoints[1][0]
if xLabelPoints[1][0] > maxRight:
maxRight = xLabelPoints[1][0]
# find the most bottom-ward location
if xTickZeroPoints[0][1] < maxBottom:
maxBottom = xTickZeroPoints[0][1]
if xLabelPoints[0][1] < maxBottom:
maxBottom = xLabelPoints[0][1]
if yLabelPoints[0][1] < maxBottom:
maxBottom = yLabelPoints[0][1]
# find the most top-ward location
if yTickIndexPoints[1][1] > maxTop:
maxTop = yTickIndexPoints[1][1]
if True == in_OffsetUsed: # could not find a better way to get this
yp = ax.get_yticklabels()[0].get_window_extent().get_points()
maxTop += yp[1][1] - yp[0][1]
newLeft = ax.bbox._bbox.get_points()[0][0] - (float(maxLeft) /
float(in_WidthInPixels)) + 0.01
newBottom = ax.bbox._bbox.get_points()[0][1] - (float(maxBottom) /
float(in_HeightInPixels)) + 0.01
newRight = ax.bbox._bbox.get_points()[1][0] + (1.0 - (float(maxRight) /
float(in_WidthInPixels))) - 0.01
newTop = ax.bbox._bbox.get_points()[1][1] + (1.0 - (float(maxTop) /
float(in_HeightInPixels))) - 0.01
# now redraw and check number of X tick marks
canvas.draw()
# Calculate major number of X tick marks based on label size
totalWidth = 0.0
maxWidth = 0.0
numberOfMajor_X_TickMarks = len(ax.get_xticklabels())
for xlabel_i in ax.get_xticklabels():
w = xlabel_i.get_window_extent().get_points() # the drawn text
bounding box corners as numpy array of [x,y], [x,y]
width = w[1][0] - w[0][0]
totalWidth += width
if width > maxWidth:
maxWidth = width
if totalWidth > (0.95 * ((newRight - newLeft) *
float(in_WidthInPixels))): # 0.95 for some spacing between tick labels
numberOfMajor_X_TickMarks = int(math.floor((0.95 * ((newRight -
newLeft) * float(in_WidthInPixels))) / maxWidth))
return (newLeft, newBottom, newRight, newTop,
numberOfMajor_X_TickMarks,)
def HistogramPlot(in_DataToPlot, in_FileNameAndPath, in_DataName,
in_FillColor, in_WidthInPixels, in_HeightInPixels, in_UseOffsetIfNeeded,
in_UseScientificNotationIfNeeded):
# decode ends of strings ('XYZ_ON', 'XYZ_OFF', 'XYZ_AUTO', etc.) to
boolean values
scientificNotation =
DetermineScientificNotationFromString(in_DataToPlot,
in_UseScientificNotationIfNeeded)
useOffsetIfNeeded = DetermineOnOrOffFromString(in_UseOffsetIfNeeded)
numberOfBins = len(in_DataToPlot) / 2
if numberOfBins > 25:
numberOfBins = 25
if numberOfBins < 5:
numberOfBins = 5
# first with 0, 0, 1, 1
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataName, 'Frequency', useOffsetIfNeeded, scientificNotation, False, 0.0,
0.0, 1.0, 1.0)
# histogram of data
n, bins, patches = ax.hist(in_DataToPlot, numberOfBins,
facecolor=in_FillColor)
# some axis space at the top of the graph
ylim = ax.get_ylim()
if ylim[1] == max(n):
ax.set_ylim(0.0, ylim[1] + 1)
newLeft, newBottom, newRight, newTop, numberOfMajor_X_TickMarks =
YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
in_HeightInPixels, False)
# now with scaled
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataName, 'Frequency', useOffsetIfNeeded, scientificNotation, False,
newLeft, newBottom, newRight, newTop)
# histogram of data
n, bins, patches = ax.hist(in_DataToPlot, numberOfBins,
facecolor=in_FillColor)
# some axis space at the top of the graph
ylim = ax.get_ylim()
if ylim[1] == max(n):
ax.set_ylim(0.0, ylim[1] + 1)
if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
fig.savefig(in_FileNameAndPath, format = 'png', dpi=100)
def ScatterPlot(in_DataToPlot, in_FileNameAndPath, in_DataNameX,
in_DataNameY, in_WidthInPixels, in_HeightInPixels,
in_UseOffsetIfNeeded, in_ReverseXY,
in_X_UseScientificNotationIfNeeded, in_Y_UseScientificNotationIfNeeded):
# decode ends of strings ('XYZ_ON', 'XYZ_OFF', 'XYZ_AUTO', etc.) to
boolean values
scientificNotationX =
DetermineScientificNotationFromString(in_DataToPlot[0],
in_X_UseScientificNotationIfNeeded)
scientificNotationY =
DetermineScientificNotationFromString(in_DataToPlot[1],
in_Y_UseScientificNotationIfNeeded)
useOffsetIfNeeded = DetermineOnOrOffFromString(in_UseOffsetIfNeeded)
reverseXY = DetermineOnOrOffFromString(in_ReverseXY)
if reverseXY:
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataNameY, in_DataNameX, useOffsetIfNeeded, scientificNotationX,
scientificNotationY, 0.0, 0.0, 1.0, 1.0)
ax.plot(np.array([min(in_DataToPlot[1]), max(in_DataToPlot[1])]),
np.array([min(in_DataToPlot[0]), max(in_DataToPlot[0])]), 'o') # first
ax.plot() is only with extents
newLeft, newBottom, newRight, newTop, numberOfMajor_X_TickMarks =
YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
in_HeightInPixels, scientificNotationY or useOffsetIfNeeded)
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataNameY, in_DataNameX, useOffsetIfNeeded, scientificNotationX,
scientificNotationY, newLeft, newBottom, newRight, newTop)
if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
ax.plot(in_DataToPlot[1], in_DataToPlot[0], 'o') # now that
autoscaling is done, use all data for second ax.plot()
else:
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataNameX, in_DataNameY, useOffsetIfNeeded, scientificNotationY,
scientificNotationX, 0.0, 0.0, 1.0, 1.0)
ax.plot(np.array([min(in_DataToPlot[0]), max(in_DataToPlot[0])]),
np.array([min(in_DataToPlot[1]), max(in_DataToPlot[1])]), 'o') # first
ax.plot() is only with extents
newLeft, newBottom, newRight, newTop, numberOfMajor_X_TickMarks =
YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels,
in_HeightInPixels, scientificNotationY or useOffsetIfNeeded)
fig, ax = CommonPlottingCode(in_WidthInPixels, in_HeightInPixels,
in_DataNameX, in_DataNameY, useOffsetIfNeeded, scientificNotationY,
scientificNotationX, newLeft, newBottom, newRight, newTop)
if len(ax.get_xticklabels()) > numberOfMajor_X_TickMarks:
ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(numberOfMajor_X_TickMarks))
ax.plot(in_DataToPlot[0], in_DataToPlot[1], 'o') # now that
autoscaling is done, use all data for second ax.plot()
fig.savefig(in_FileNameAndPath, format = 'png', dpi=100)
if __name__ in ('main', '__main__'):
testData1D = 12345678901.5 + np.random.randn(100)
testData2D = [testData1D, 1000.0 * testData1D + 1500 + 200.0 *
np.random.randn(100)]
# note file names
HistogramPlot(testData1D, 'test_histogram_large.png', 'Test Data Name',
'lightgrey',
1024, 768, 'UseOffset_ON', 'ScientificNotation_ON')
HistogramPlot(testData1D, 'test_histogram_small.png', 'Test Data Name',
'lightgrey',
320, 240, 'UseOffset_ON', 'ScientificNotation_ON')
ScatterPlot(testData2D, 'test_scatterplot_small.png', 'Test Data X
Name', 'Test Data Y Name',
320, 240, 'UseOffset_ON', 'ReverseXY_OFF',
'ScientificNotation_X_OFF', 'ScientificNotation_Y_OFF')
ScatterPlot(testData2D, 'test_scatterplot_large.png', 'Test Data X
Name', 'Test Data Y Name',
1024, 768, 'UseOffset_ON', 'ReverseXY_ON',
'ScientificNotation_X_OFF', 'ScientificNotation_Y_ON')
|
|
From: Torsten B. <br...@ph...> - 2009-03-20 11:52:50
|
Hallöchen!
I use pyemf 2.0 and Matplotlib 0.98.5. If I try to save a trivial
plot into an EMF file, I get
Traceback (most recent call last):
File "./make_plots.py", line 23, in <module>
figure.savefig(sample_name + "_pds.emf")
File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 990, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 1419, in print_figure
**kwargs)
File "/usr/lib/python2.5/[...]/matplotlib/backends/backend_emf.py", line 604, in print_emf
self.figure.draw(renderer)
File "/usr/lib/python2.5/[...]/matplotlib/figure.py", line 738, in draw
if self.frameon: self.patch.draw(renderer)
File "/usr/lib/python2.5/[...]/matplotlib/patches.py", line 301, in draw
renderer.draw_path(gc, tpath, affine, rgbFace)
File "/usr/lib/python2.5/[...]/matplotlib/backend_bases.py", line 74, in draw_path
raise NotImplementedError
NotImplementedError
Is this a bug or a mal-configuration? The Python code was
figure = pyplot.figure()
axes = figure.add_subplot(111)
x, y = numpy.loadtxt("data.dat", comments="#", usecols=(0, 1), unpack=True)
axes.semilogy(x, y)
figure.savefig("test.emf")
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: tor...@ja...
|
|
From: Vito De T. <zak...@li...> - 2009-03-20 09:10:06
|
Hi!
I'm a newbie of matplotlib, and I'm trying to plot a set of data... but I
got blocked...
$ cat matplotliberr.py
#!/usr/bin/env python
# dummy data to plot
from datetime import date, timedelta
from random import randint
x = [ date.today() + timedelta(i) for i in range(10) ]
y = [ randint(0, i) for i in range(10) ]
from matplotlib import pyplot
pyplot.fill(x, y) # no problem using pyplot.plot(x, y)
pyplot.show()
$ ./matplotliberr.py
/usr/lib/python2.6/site-packages/pytz/tzinfo.py:5: DeprecationWarning: the
sets module is deprecated
from sets import Set
Traceback (most recent call last):
File "./matplotliberr.py", line 10, in <module>
pyplot.fill(x, y)
File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 1876,
in fill
ret = gca().fill(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 5558, in
fill
for poly in self._get_patches_for_fill(*args, **kwargs):
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 394, in
_grab_next_args
for seg in self._plot_2_args(remaining, **kwargs):
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 331, in
_plot_2_args
func(x, y)
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 314, in
makefill
(x[:,np.newaxis],y[:,np.newaxis])),
TypeError: list indices must be integers, not tuple
$ rpm -q python-matplotlib
python-matplotlib-0.98.5.2-1.3
--
By ZeD
|