SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





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






Showing 14 results of 14

From: Alan G I. <ai...@am...> - 2006年12月22日 20:43:56
> On Fri, Dec 22, 2006 at 02:15:42PM -0500, Alan G Isaac wrote: 
>> Just because the figure window is closed does not 
>> mean the figure is deleted. Chris apparently 
>> maintains a reference to the figure? 
On 2006年12月22日, ch...@se... apparently wrote:
> I just save a PNG on hard drive and load it when needed. I don't know 
> how to store a reference to PNG and/or if that would be a problem. 
All this is happening before your (final) save to the PNG 
file. Somehow you are telling Matplotlib to plot repeatedly
to the same figure even though you want it to plot to 
different figures, if I have understood you.
If all else fails as you search for how you are doing this, 
try explicitly naming each figure:
fig1 = pylab.figure(figsize=(figw,figh))
ax1 = fig.gca()
ax1.plot(x,y, 'k', label="My Title")
fig1.savefig(workdir+'\\'+file_name)
Cheers,
Alan Isaac
From: Alan G I. <ai...@am...> - 2006年12月22日 19:13:05
>> On 2006年12月22日, ch...@se... apparently wrote:=20
>>> 1st message in this thread has code to create each plot.=20
>>> Each one does a 'figure_ =3D pylab.figure()' already.=20
> Alan G Isaac wrote:=20
>> Sorry I missed the thread, but each call to pylab.figure()=20
>> will give you a new active figure. Everything you plot will=20
>> then be plotted to that figure. Previous plots will not be=20
>> erased until you explicitly remove them. You can also get=20
>> the axes for a particular figure and plot directly to the=20
>> axis.=20
>> Probably you are not creating new figures when you think you=20
>> are...=20
On 2006年12月22日, Eric Firing apparently wrote:=20
> I'm puzzled. The call to pylab.close() after the savefig should=20
> completely wipe out the current figure, shouldn't it?=20
Just because the figure window is closed does not
mean the figure is deleted. Chris apparently
maintains a reference to the figure?
> And even without the close (which certainly should be used anyway), each=
=20
> function starts with a call to pylab.figure() which should start a new=20
> figure.=20
Right! This my comment above.
Cheers,
Alan Isaac
From: Eric F. <ef...@ha...> - 2006年12月22日 18:54:52
Alan G Isaac wrote:
> On 2006年12月22日, ch...@se... apparently wrote: 
>> 1st message in this thread has code to create each plot. 
>> Each one does a 'figure_ = pylab.figure()' already. 
> 
> Sorry I missed the thread, but each call to pylab.figure() 
> will give you a new active figure. Everything you plot will 
> then be plotted to that figure. Previous plots will not be 
> erased until you explicitly remove them. You can also get 
> the axes for a particular figure and plot directly to the 
> axis.
> 
> Probably you are not creating new figures when you think you 
> are...
I'm puzzled. The call to pylab.close() after the savefig should 
completely wipe out the current figure, shouldn't it?
And even without the close (which certainly should be used anyway), each 
function starts with a call to pylab.figure() which should start a *new* 
figure.
I can't look into it now, though.
Eric
> 
> hth,
> Alan Isaac
From: Alan G I. <ai...@am...> - 2006年12月22日 18:22:43
On 2006年12月22日, ch...@se... apparently wrote:=20
> 1st message in this thread has code to create each plot. =20
> Each one does a 'figure_ =3D pylab.figure()' already.=20
Sorry I missed the thread, but each call to pylab.figure()=20
will give you a new active figure. Everything you plot will=20
then be plotted to that figure. Previous plots will not be=20
erased until you explicitly remove them. You can also get=20
the axes for a particular figure and plot directly to the=20
axis.
Probably you are not creating new figures when you think you=20
are...
hth,
Alan Isaac
On Fri, Dec 22, 2006 at 12:21:44PM -0500, Alan G Isaac wrote:
> On 2006年12月22日, ch...@se... apparently wrote:
> > I'm wondering if there is some way to tell Maplotlib to
> > create a DIFFERENT figure
>
> It looks like you are using pylab?
> How about pylab.figure()?
>
Thanks for email. Yes 1st message in this thread has code to create each
plot. Each one does a 'figure_ = pylab.figure()' already.
chris
From: Alan G I. <ai...@am...> - 2006年12月22日 17:19:11
On 2006年12月22日, ch...@se... apparently wrote:=20
> I'm wondering if there is some way to tell Maplotlib to=20
> create a DIFFERENT figure=20
It looks like you are using pylab?
How about pylab.figure()?
Cheers,
Alan Isaac
On Thu, Dec 21, 2006 at 10:16:25PM -1000, Eric Firing wrote:
> Try putting
>
> pylab.close()
>
> after each pylab.savefig()
Thanks for the email. That didn't fix it for some reason. Any else I'm
missing? I'm wondering if there is some way to tell Maplotlib to create a
DIFFERENT figure rather than mixing them all together.
Chris
From: Armando S. L. <ars...@gm...> - 2006年12月22日 16:04:17
Hello,
I would like to change the axes box by two arrows in the x and y direction,
something like this:
y
^
|
|
|
|
+------------>x
Can it be done in matplotlib?
From: Armando S. L. <ars...@gm...> - 2006年12月22日 15:58:53
Hello,
I have installed matplotlib 0.87.7 (with the standard windows exe). If I use
the provided matplotlibrc file I get errors complaining about the following
lines:
lines.markerfacecolor : blue
lines.markeredgecolor : black
Commenting them out stops the problem and matplotlib seems to run fine. Am I
the only one getting this errors? Is this already known? Should I worry
about it?
From: Eric F. <ef...@ha...> - 2006年12月22日 09:17:25
Try putting
pylab.close()
after each pylab.savefig()
Eric
ch...@se... wrote:
> Help! I'm trying to make multiple plots in a web app and old plots seem to
> stick around and show up on new plots!??!
> 
> Is there someway to "erase the canvas" or avoid this happening?
> 
> Sound familiar?
> 
> growth function below is the first plot that is ok.
> management function below is the one that has growth plot in it.
> 
> Chris
> 
> =====================================================================
> 
> import matplotlib
> matplotlib.use("Agg")
> import pylab
> 
> BACKGROUND_COLOR = "#ffffff"
> 
> def growth(company):
> """
> Plots Growth plot.
> """
> 
> # Generates figure_, plot_ and functions.
> 
> figure_ = pylab.figure()
> plot_ = pylab.subplot(111, axisbg=BACKGROUND_COLOR)
> years_plus_5 = company.years + range(max(company.years) + 1,
> max(company.years) + 6)
> five_percent = [1.05 ** (y - min(company.years))
> for y in years_plus_5]
> ten_percent = [1.10 ** (y - min(company.years))
> for y in years_plus_5]
> fifteen_percent = [1.15 ** (y - min(company.years))
> for y in years_plus_5]
> twenty_percent = [1.20 ** (y - min(company.years))
> for y in years_plus_5]
> twenty_five_percent = [1.25 ** (y - min(company.years))
> for y in years_plus_5]
> thirty_percent = [1.30 ** (y - min(company.years))
> for y in years_plus_5]
> scaled_sales = [50.0 * e / company.sales[-1]
> for e in company.sales]
> scaled_earnings = [30.0 * e / company.earnings[-1]
> for e in company.earnings]
> scaled_pretax_profit = [10.0 * e / company.pretax_profit[-1]
> for e in company.pretax_profit]
> scaled_low_price = [100.0 * e / company.high_price[-1]
> for e in company.low_price]
> scaled_high_price = [100.0 * e / company.high_price[-1]
> for e in company.high_price]
> functions = plot_.semilogy(company.years, scaled_sales,
> company.years, scaled_earnings,
> company.years, scaled_pretax_profit,
> years_plus_5, five_percent,
> years_plus_5, ten_percent,
> years_plus_5, fifteen_percent,
> years_plus_5, twenty_percent,
> years_plus_5, twenty_five_percent,
> years_plus_5, thirty_percent)
> 
> # Adds price bars and sets their thickness.
> 
> offset = 0.12
> for i, y in enumerate(company.years):
> plot_.semilogy((y, y),
> (scaled_low_price[i], scaled_high_price[i]),
> linewidth="2.2", color = "black", zorder = 1)
> plot_.semilogy((y - offset, y + offset),
> (scaled_low_price[i], scaled_low_price[i]),
> linewidth="2.2", color = "black", zorder = 1)
> plot_.semilogy((y - offset, y + offset),
> (scaled_high_price[i], scaled_high_price[i]),
> linewidth="2.2", color = "black", zorder = 1)
> 
> # Adds sales, earnings and pretax_profit points.
> 
> points = []
> points.append(pylab.scatter(company.years, scaled_sales, 200,
> c = BACKGROUND_COLOR))
> points.append(pylab.scatter(company.years, scaled_earnings, 200,
> c = BACKGROUND_COLOR))
> points.append(pylab.scatter(company.years, scaled_pretax_profit, 200,
> c = BACKGROUND_COLOR))
> 
> # Configures points.
> 
> pylab.setp(points[0], linewidth = "1.3", edgecolor = "g", zorder = 12)
> pylab.setp(points[1], linewidth = "1.3", edgecolor = "b", zorder = 11)
> pylab.setp(points[2], linewidth = "1.3", edgecolor = "r", zorder = 10)
> 
> # Configures earnings, sales and pretax_profit.
> 
> pylab.setp(functions[0], linewidth = "3.0", color = "g", zorder = 9)
> pylab.setp(functions[1], linewidth = "3.0", color = "b", zorder = 8)
> pylab.setp(functions[2], linewidth = "3.0", color = "r", zorder = 7)
> 
> # Configures percentage growth.
> 
> for f in functions[-6:]:
> pylab.setp(f, linewidth = "0.5", color = "k", zorder = 5)
> 
> # Configures grid.
> 
> plot_.grid(True)
> grid_ = plot_.get_xgridlines() + plot_.get_ygridlines()
> pylab.setp(grid_, linestyle = "-", color = "k", linewidth = "0.5",
> zorder = 5)
> plot_.set_axisbelow(True)
> 
> # Sets view range for both axes.
> 
> pylab.axis([min(company.years), max(company.years) + 5, 1, 200])
> 
> # Specifies tick values, color, size and boldness.
> 
> x_tick_values = years_plus_5
> x_tick_labels = len(x_tick_values) * [""]
> for i in range(1, len(x_tick_values), 2):
> x_tick_labels[i] = str(x_tick_values[i])
> pylab.xticks(x_tick_values, x_tick_labels,
> color = "k", fontsize = 15, fontweight = "bold")
> y_tick_values = range(1, 11, 1) + range(10, 110, 10) + [200]
> y_tick_labels = len(y_tick_values) * [""]
> for e in [1, 5, 10, 50, 100, 200]:
> y_tick_labels[y_tick_values.index(e)] = str(e)
> pylab.yticks(y_tick_values, y_tick_labels,
> color = "k", fontsize = 15, fontweight = "bold")
> 
> # Adds labels for percentage growth lines.
> 
> pylab.text(max(years_plus_5), 2.0, " 5%", fontsize = 15)
> pylab.text(max(years_plus_5), 3.8, " 10%", fontsize = 15)
> pylab.text(max(years_plus_5), 7.0, " 15%", fontsize = 15)
> pylab.text(max(years_plus_5), 13.0, " 20%", fontsize = 15)
> pylab.text(max(years_plus_5), 23.0, " 25%", fontsize = 15)
> pylab.text(max(years_plus_5), 40.0, " 30%", fontsize = 15)
> 
> # Adds labels for earnings, sales and pretax profit points.
> 
> for c in zip(company.years, scaled_sales):
> pylab.text(c[0], c[1], "S",
> horizontalalignment = 'center',
> verticalalignment = 'center',
> color = "g",
> clip_on = True,
> zorder = 12,
> fontweight = "bold",
> fontsize = 15)
> for c in zip(company.years, scaled_earnings):
> pylab.text(c[0], c[1], "E",
> horizontalalignment = 'center',
> verticalalignment = 'center',
> color = "b",
> clip_on = True,
> zorder = 11,
> fontweight = "bold",
> fontsize = 15)
> for c in zip(company.years, scaled_pretax_profit):
> pylab.text(c[0], c[1], "P",
> horizontalalignment = 'center',
> verticalalignment = 'center',
> color = "r",
> clip_on = True,
> zorder = 10,
> fontweight = "bold",
> fontsize = 15)
> 
> # Sets background of figure to be transparent.
> 
> figure_.figurePatch.set_alpha(0.0)
> 
> # Creates a PNG file.
> 
> pylab.savefig("gnustocks/static/images/growth_plot.png", dpi = (100))
> 
> def management(company):
> figure_ = pylab.figure()
> 
> t = pylab.arange(0.0, 2.0, 0.01)
> import math
> s = pylab.sin(2*math.pi*t)
> pylab.plot(t, s, linewidth=1.0)
> 
> pylab.xlabel('time (s)')
> pylab.ylabel('voltage (mV)')
> pylab.title('About as simple as it gets, folks')
> pylab.grid(True)
> pylab.savefig("gnustocks/static/images/management.png", dpi = (100))
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2006年12月22日 08:21:29
The solution is to uninstall the deb package and install an up-to-date 
matplotlib. Whether there is a deb package somewhere that will work on 
debian stable, I don't know, but installing from the tarball is easy if 
you have the necessary devel packages installed.
Eric
Thierry Dumont wrote:
> I have a problem on my debian stable installation.
> 
> I use the packages of altervista:
> deb http://anakonda.altervista.org/debian packages/
> deb-src http://anakonda.altervista.org/debian sources/
> 
> subplot is ok with the syntax subplot(212) for example, but not with
> subplot(2,1,2) (and I need this syntax).
> 
> In the second case, all the plots appears at the same place.
> To see this, simply change the subblot commands in zorder_demo.py for
> example.
> 
> With an Ubuntu installation (6.10) (in this case matplotlib is packaged
> in the distribution), it seems ok.
> 
> any solution?
> 
> t.d.
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Thierry D. <td...@ma...> - 2006年12月22日 07:57:25
Attachments: tdumont.vcf
I have a problem on my debian stable installation.
I use the packages of altervista:
deb http://anakonda.altervista.org/debian packages/
deb-src http://anakonda.altervista.org/debian sources/
subplot is ok with the syntax subplot(212) for example, but not with
subplot(2,1,2) (and I need this syntax).
In the second case, all the plots appears at the same place.
To see this, simply change the subblot commands in zorder_demo.py for
example.
With an Ubuntu installation (6.10) (in this case matplotlib is packaged
in the distribution), it seems ok.
any solution?
t.d.
-- 
Thierry Dumont. Institut Camille Jordan -- Mathematiques--
Univ. Lyon I,43 Bd du 11 Novembre 1918, 69622
 - Villeurbanne Cedex - France.
td...@ma... web: http://math.univ-lyon1.fr/~tdumont
Help! I'm trying to make multiple plots in a web app and old plots seem to
stick around and show up on new plots!??!
Is there someway to "erase the canvas" or avoid this happening?
Sound familiar?
growth function below is the first plot that is ok.
management function below is the one that has growth plot in it.
Chris
=====================================================================
import matplotlib
matplotlib.use("Agg")
import pylab
BACKGROUND_COLOR = "#ffffff"
def growth(company):
 """
 Plots Growth plot.
 """
 # Generates figure_, plot_ and functions.
 figure_ = pylab.figure()
 plot_ = pylab.subplot(111, axisbg=BACKGROUND_COLOR)
 years_plus_5 = company.years + range(max(company.years) + 1,
 max(company.years) + 6)
 five_percent = [1.05 ** (y - min(company.years))
 for y in years_plus_5]
 ten_percent = [1.10 ** (y - min(company.years))
 for y in years_plus_5]
 fifteen_percent = [1.15 ** (y - min(company.years))
 for y in years_plus_5]
 twenty_percent = [1.20 ** (y - min(company.years))
 for y in years_plus_5]
 twenty_five_percent = [1.25 ** (y - min(company.years))
 for y in years_plus_5]
 thirty_percent = [1.30 ** (y - min(company.years))
 for y in years_plus_5]
 scaled_sales = [50.0 * e / company.sales[-1]
 for e in company.sales]
 scaled_earnings = [30.0 * e / company.earnings[-1]
 for e in company.earnings]
 scaled_pretax_profit = [10.0 * e / company.pretax_profit[-1]
 for e in company.pretax_profit]
 scaled_low_price = [100.0 * e / company.high_price[-1]
 for e in company.low_price]
 scaled_high_price = [100.0 * e / company.high_price[-1]
 for e in company.high_price]
 functions = plot_.semilogy(company.years, scaled_sales,
 company.years, scaled_earnings,
 company.years, scaled_pretax_profit,
 years_plus_5, five_percent,
 years_plus_5, ten_percent,
 years_plus_5, fifteen_percent,
 years_plus_5, twenty_percent,
 years_plus_5, twenty_five_percent,
 years_plus_5, thirty_percent)
 # Adds price bars and sets their thickness.
 offset = 0.12
 for i, y in enumerate(company.years):
 plot_.semilogy((y, y),
 (scaled_low_price[i], scaled_high_price[i]),
 linewidth="2.2", color = "black", zorder = 1)
 plot_.semilogy((y - offset, y + offset),
 (scaled_low_price[i], scaled_low_price[i]),
 linewidth="2.2", color = "black", zorder = 1)
 plot_.semilogy((y - offset, y + offset),
 (scaled_high_price[i], scaled_high_price[i]),
 linewidth="2.2", color = "black", zorder = 1)
 # Adds sales, earnings and pretax_profit points.
 points = []
 points.append(pylab.scatter(company.years, scaled_sales, 200,
 c = BACKGROUND_COLOR))
 points.append(pylab.scatter(company.years, scaled_earnings, 200,
 c = BACKGROUND_COLOR))
 points.append(pylab.scatter(company.years, scaled_pretax_profit, 200,
 c = BACKGROUND_COLOR))
 # Configures points.
 pylab.setp(points[0], linewidth = "1.3", edgecolor = "g", zorder = 12)
 pylab.setp(points[1], linewidth = "1.3", edgecolor = "b", zorder = 11)
 pylab.setp(points[2], linewidth = "1.3", edgecolor = "r", zorder = 10)
 # Configures earnings, sales and pretax_profit.
 pylab.setp(functions[0], linewidth = "3.0", color = "g", zorder = 9)
 pylab.setp(functions[1], linewidth = "3.0", color = "b", zorder = 8)
 pylab.setp(functions[2], linewidth = "3.0", color = "r", zorder = 7)
 # Configures percentage growth.
 for f in functions[-6:]:
 pylab.setp(f, linewidth = "0.5", color = "k", zorder = 5)
 # Configures grid.
 plot_.grid(True)
 grid_ = plot_.get_xgridlines() + plot_.get_ygridlines()
 pylab.setp(grid_, linestyle = "-", color = "k", linewidth = "0.5",
 zorder = 5)
 plot_.set_axisbelow(True)
 # Sets view range for both axes.
 pylab.axis([min(company.years), max(company.years) + 5, 1, 200])
 # Specifies tick values, color, size and boldness.
 x_tick_values = years_plus_5
 x_tick_labels = len(x_tick_values) * [""]
 for i in range(1, len(x_tick_values), 2):
 x_tick_labels[i] = str(x_tick_values[i])
 pylab.xticks(x_tick_values, x_tick_labels,
 color = "k", fontsize = 15, fontweight = "bold")
 y_tick_values = range(1, 11, 1) + range(10, 110, 10) + [200]
 y_tick_labels = len(y_tick_values) * [""]
 for e in [1, 5, 10, 50, 100, 200]:
 y_tick_labels[y_tick_values.index(e)] = str(e)
 pylab.yticks(y_tick_values, y_tick_labels,
 color = "k", fontsize = 15, fontweight = "bold")
 # Adds labels for percentage growth lines.
 pylab.text(max(years_plus_5), 2.0, " 5%", fontsize = 15)
 pylab.text(max(years_plus_5), 3.8, " 10%", fontsize = 15)
 pylab.text(max(years_plus_5), 7.0, " 15%", fontsize = 15)
 pylab.text(max(years_plus_5), 13.0, " 20%", fontsize = 15)
 pylab.text(max(years_plus_5), 23.0, " 25%", fontsize = 15)
 pylab.text(max(years_plus_5), 40.0, " 30%", fontsize = 15)
 # Adds labels for earnings, sales and pretax profit points.
 for c in zip(company.years, scaled_sales):
 pylab.text(c[0], c[1], "S",
 horizontalalignment = 'center',
 verticalalignment = 'center',
 color = "g",
 clip_on = True,
 zorder = 12,
 fontweight = "bold",
 fontsize = 15)
 for c in zip(company.years, scaled_earnings):
 pylab.text(c[0], c[1], "E",
 horizontalalignment = 'center',
 verticalalignment = 'center',
 color = "b",
 clip_on = True,
 zorder = 11,
 fontweight = "bold",
 fontsize = 15)
 for c in zip(company.years, scaled_pretax_profit):
 pylab.text(c[0], c[1], "P",
 horizontalalignment = 'center',
 verticalalignment = 'center',
 color = "r",
 clip_on = True,
 zorder = 10,
 fontweight = "bold",
 fontsize = 15)
 # Sets background of figure to be transparent.
 figure_.figurePatch.set_alpha(0.0)
 # Creates a PNG file.
 pylab.savefig("gnustocks/static/images/growth_plot.png", dpi = (100))
def management(company):
 figure_ = pylab.figure()
 t = pylab.arange(0.0, 2.0, 0.01)
 import math
 s = pylab.sin(2*math.pi*t)
 pylab.plot(t, s, linewidth=1.0)
 pylab.xlabel('time (s)')
 pylab.ylabel('voltage (mV)')
 pylab.title('About as simple as it gets, folks')
 pylab.grid(True)
 pylab.savefig("gnustocks/static/images/management.png", dpi = (100))
From: Paul N. <pn...@ui...> - 2006年12月22日 02:03:33
Adding the line numeric: numpy to my matplotlibrc file fixed the problem.
Thanks,
Paul
Darren Dale wrote:
> On Thursday 21 December 2006 13:43, Jeff Whitaker wrote:
>> Paul Novak wrote:
>>> I have a problem that arose when I tried to run the gridding irregularly
>>> spaced data demo on the wiki
>>> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>>>
>>> When I run the attached script, which sets one value of an array to
>>> nan, masks the array where there are nan, and tries to plot it using
>>> contour(), I get the following errors:
>>>
>>> /usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning:
>>> Cannot automatically convert masked array to numeric because data
>>> is masked in one or more locations.
>>> warnings.warn("Cannot automatically convert masked array to "\
>>> Traceback (most recent call last):
>>> File "masked_nan.py", line 18, in ?
>>> contour(x, y, z)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
>>> 1754, in contour
>>> ret = gca().contour(*args, **kwargs)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
>>> 4092, in contour
>>> return ContourSet(self, *args, **kwargs)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
>>> 429, in __init__
>>> x, y, z = self._contour_args(*args) # also sets self.levels,
>>> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
>>> 614, in _contour_args
>>> lev = self._autolev(z, 7)
>>> File "/usr/lib/python2.4/site-packages/matplotlib/contour.py", line
>>> 517, in _autolev
>>> zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
>>> TypeError: unsupported operand type(s) for -: 'str' and 'str'
>>>
>>> I am using
>>>
>>>>>> numpy.__version__
>>> '1.0'
>>>
>>>>>> matplotlib.__version__
>>> '0.87.7'
>>>
>>> Is there a way to use contour() and plot arrays whose elements may be
>>> nan?
>>>
>>> Thanks,
>>> Paul
>> Paul: Your test script works for me (numpy 1.0, matplotlib 0.87.7,
>> python2.5 on macos x).
> 
> It worked fine for me too. Do you happen to have numerix : Numeric in your 
> matplotlibrc file?
> 
> Darren
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 

Showing 14 results of 14

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /