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 .. 7 8 9 10 11 .. 21 > >> (Page 9 of 21)
From: Ala Al-S. <sha...@ym...> - 2009年07月20日 16:11:14
Hello everyone.
A users on the networkx mailing list posted this example which is a modification of the matplotlib-pyqt4 implementation which plots a networkx graph.
The problem I am facing with it is that two plot windows open instead of one, one is empty and the other contains the graph.
I can't really put my finger as to why two windows open rather than just one pyqt window with the plot. Any suggestions would be appreciated.
Screenshot of the two plot windows:
http://img259.imageshack.us/img259/8722/picture1ahr.jpg
Code:
#!/usr/bin/env python
# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
# 2006 Darren Dale
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified versions
# may be distributed without limitation.
import sys, os, random
from PyQt4 import QtGui, QtCore
from numpy import arange, sin, pi
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import networkx as nx
progname = os.path.basename(sys.argv[0])
progversion = "0.1"
class MyMplCanvas(FigureCanvas):
 """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
 def __init__(self, parent=None, width=5, height=4, dpi=100):
 fig = Figure(figsize=(width, height), dpi=dpi)
 self.axes = fig.add_subplot(111)
 # We want the axes cleared every time plot() is called
 self.axes.hold(False)
 self.compute_initial_figure()
 #
 FigureCanvas.__init__(self, fig)
 self.setParent(parent)
 FigureCanvas.setSizePolicy(self,
 QtGui.QSizePolicy.Expanding,
 QtGui.QSizePolicy.Expanding)
 FigureCanvas.updateGeometry(self)
 def compute_initial_figure(self):
 pass
class MyStaticMplCanvas(MyMplCanvas):
 """Simple canvas with a sine plot."""
 def compute_initial_figure(self):
 G=nx.path_graph(10)
 pos=nx.spring_layout(G)
 nx.draw(G,pos,ax=self.axes)
class ApplicationWindow(QtGui.QMainWindow):
 def __init__(self):
 QtGui.QMainWindow.__init__(self)
 self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
 self.setWindowTitle("application main window")
 self.file_menu = QtGui.QMenu('&File', self)
 self.file_menu.addAction('&Quit', self.fileQuit,
 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
 self.menuBar().addMenu(self.file_menu)
 self.help_menu = QtGui.QMenu('&Help', self)
 self.menuBar().addSeparator()
 self.help_menu.addAction('&About', self.about)
 self.menuBar().addMenu(self.help_menu)
 self.main_widget = QtGui.QWidget(self)
 l = QtGui.QVBoxLayout(self.main_widget)
 sc = MyStaticMplCanvas(self.main_widget, width=5, height=4, dpi=100)
 l.addWidget(sc)
 self.main_widget.setFocus()
 self.setCentralWidget(self.main_widget)
 self.statusBar().showMessage("All hail matplotlib!", 2000)
 def fileQuit(self):
 self.close()
 def closeEvent(self, ce):
 self.fileQuit()
 def about(self):
 QtGui.QMessageBox.about(self, "About %s" % progname,
u"""%(prog)s version %(version)s
Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon, 2006 Darren Dale
This program is a simple example of a Qt4 application embedding matplotlib
canvases.
It may be used and modified with no restriction; raw copies as well as
modified versions may be distributed without limitation."""
% {"prog": progname, "version": progversion})
qApp = QtGui.QApplication(sys.argv)
aw = ApplicationWindow()
aw.setWindowTitle("%s" % progname)
aw.show()
sys.exit(qApp.exec_())
#qApp.exec_()
 
From: davide l. <las...@gm...> - 2009年07月20日 16:09:07
Hello everybody,
this is my first post in this list. 
I'm plotting a spectrogram with
Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)
and i want to add a colorbar with
colorbar()
The problem is that the color scale seems to be wrong with respect to
the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
i have tick values spanning from -20 to -180. What is the problem??
Thanks in advance!
Davide
From: Darren D. <dsd...@gm...> - 2009年07月20日 16:08:42
Attachments: mpl_test.py
Hi Alexander,
2009年7月20日 Alexander Bruy <vo...@ua...>:
> Sorry, some troubles with my email service. With attachment now
>
>
> 20091707 Darren Dale <dsd...@gm...> wrote:
>>
>> Please post a short, complete, self-contained script demonstrating the
>> problem.
>>
>
> I create a small example, see attachment. There is a simple dialog with QWidget, at which
> matplotlib plot is drawn. When dialog resized the plot don't change it's size.
> I'm would be grateful for an indication of my errors and working example.
You need to add a layout to your widgetPlot, and then add your canvas
to that layout. See attached.
Darren
From: Matthias M. <Mat...@gm...> - 2009年07月20日 16:01:04
Hi Marco,
you can set the yrange for the axes after the historgram was plotted, e.g. :
hist(arange(30)%3)
ylim(0, 15)
best regards Matthias
On Monday 20 July 2009 11:26:27 marcog wrote:
> Hi
>
> Is it possible to set the yrange of a histogram plot? I have a number of
> histograms on separate plots that I would like to have the same yrange to
> make them easier to compare.
>
> Thanks
> Marco
From: John [H2O] <was...@gm...> - 2009年07月20日 15:48:16
I am trying simply to shrink the font size and rotate xaxis labels:
fig1 = plt.figure()
ax1 = fig1.add_subplot(211)
ax2 = fig1.add_subplot(212)
ax1.plot_date(x,y,'r')
ax1.set_xticklabels(plt.gca().get_xmajorticklabels(), 
 size=6,rotation=30) 
ax2.plot_date(o_X['time'],o_X['CO'],'y') 
ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30) 
I end up with labels as: ("Text(0,0"Text(0,0,"")")
????
-- 
View this message in context: http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: davide l. <las...@gm...> - 2009年07月20日 14:05:17
Hello everybody,
this is my first post in this list. 
I'm plotting a spectrogram with
Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000)
and i want to add a colorbar with
colorbar()
The problem is that the color scale seems to be wrong with respect to
the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar
i have tick values spanning from -20 to -180. What is the problem??
Thanks in advance!
Davide
From: Astronomical P. <ast...@gm...> - 2009年07月20日 13:38:42
We are pleased to announce the release of APLpy 0.9.3, which includes
bug fixes, improvements, and new features.
APLpy is a python module that makes it easy to interactively produce
publication-quality plots of astronomical images in FITS format. More
details are available at http://aplpy.sourceforge.net/
One of the main additions in this release is the ability to produce RGB
images starting from FITS files with different projections. More
information on the changes in this release is available in the release
notes available from the APLpy homepage.
>From the front page you can sign up to the mailing list and/or the
Twitter feed to be kept up-to-date on future releases.
Cheers,
Eli Bressert and Thomas Robitaille
From: Alexander B. <vo...@ua...> - 2009年07月20日 10:31:38
Attachments: mpl_resize.zip
Sorry, some troubles with my email service. With attachment now
20091707 Darren Dale <dsd...@gm...> wrote:
> 
> Please post a short, complete, self-contained script demonstrating the
> problem.
> 
I create a small example, see attachment. There is a simple dialog with QWidget, at which
matplotlib plot is drawn. When dialog resized the plot don't change it's size.
I'm would be grateful for an indication of my errors and working example.
Regards,
 Alexander Bruy
-- реклама -----------------------------------------------------------
http://FREEhost.com.ua - еще больше места и возможностей.
При заказе хостинга - домен бесплатно.
From: marcog <ma...@ga...> - 2009年07月20日 09:26:34
Hi
Is it possible to set the yrange of a histogram plot? I have a number of
histograms on separate plots that I would like to have the same yrange to
make them easier to compare.
Thanks
Marco
-- 
View this message in context: http://www.nabble.com/Set-Histogram-yrange-tp24566489p24566489.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年07月19日 19:45:23
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=legend#matplotlib.pyplot.legend
numpoints=1 is what you want.
For font size and etc, check the similar question posted a few days ago.
http://www.nabble.com/formatting-help-with-legend-for-stacked-bar-graph-with-many-categories-td24526118.html#a24537195
-JJ
On Fri, Jul 17, 2009 at 6:12 PM, per freem<per...@gm...> wrote:
> hi all,
>
> i am plotting two distinct lines, one of the format '-o' the other of the
> format '-s' -- i.e. one line with circular markers the other with a square
> marker. when i add a legend to the figure, it gives a legend that looks like
> this:
>
> o---o label of circular marker line
> s---s label of square marker line
>
> however, in these types of plots, it's standard for the line in the legend
> to only have *one* marker. meaning the legend should look like this:
>
> --o-- label of circular marker line
> --s-- label of square marker line
>
> is there a way to get this modified legend appearance?
>
> second question: how can i make the legend altogether smaller? or at least
> make the label text font smaller?
>
> thanks.
>
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to 100,000ドル in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: John H. <jd...@gm...> - 2009年07月19日 13:43:22
On Fri, Jul 17, 2009 at 5:15 PM, Paul Ray<Pau...@nr...> wrote:
>
>
> Ryan Krauss-2 wrote:
>>
>> RTFM:
>>
>> plot(t,y, drawstyle='steps-post')
>>
>>
>
> Actually, 'steps-pre' (which is the default) and 'steps-post' seem to have
> swapped definitions.
> Here is what the docs say:
>  *where*: [ 'pre' | 'post' | 'mid' ]
>   If 'pre', the interval from x[i] to x[i+1] has level y[i]
>   If 'post', that interval has level y[i+1]
>   If 'mid', the jumps in *y* occur half-way between the
>   *x*-values.
>
> In fact both the default behavior and what you get with steps-pre are what
> SHOULD happen with steps-post. And steps-post (as you point out) does what
> should be the default behavior and that of steps-pre.
>
> I have filed a bug report on this, since it is very important that this work
> as expected. As the original poster pointed out, this used to work
> correctly but recently seems to have gotten broken.
I am looking first at the behavior of plot with the drawstyle property
set -- let's make sure this is correct before turning to the steps
command, which just uses plot with the drawstyle set -- here is my
test code
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
a = np.array([1,2,3,4,5])
styles = 'default' , 'steps' , 'steps-pre' , 'steps-mid' , 'steps-post'
styles = 'steps' , 'steps-pre'
for ls in styles:
 ax.plot(a, ls=ls, label=ls, lw=2)
ax.legend(loc='upper left')
plt.show()
pre causes the step to rise on the x[i], post causes it to rise on
x[i+1] and mid in the middle. This seems like the correct behavior.
So it does look like the docstring for 'step' is incorrect, and I've
changed it to read
 *where*: [ 'pre' | 'post' | 'mid' ]
 If 'pre', the interval from x[i] to x[i+1] has level y[i+1]
 If 'post', that interval has level y[i]
 If 'mid', the jumps in *y* occur half-way between the
JDH
From: John H. <jd...@gm...> - 2009年07月19日 12:45:03
On Sun, Jul 19, 2009 at 7:03 AM, willemmerson<wil...@gm...> wrote:
>
> This is such a noob question but I can't seem to find the answer anywhere. I
> have a certain amount of something per month which I want to display on the
> y axis, I want the x axis to show years and months, i.e. it runs from 2003
> to 2009. I have no problem with the python side, just the plotting side. How
> do I do it?
matplotlib can plot native datetime objects, so if dates is a list of
datetimes, and vals is a list of values, you can:
 ax.plot(dates, vals)
See also these code examples:
 http://matplotlib.sourceforge.net/search.html?q=codex+DateFormatter
and the dates API documentation:
 http://matplotlib.sourceforge.net/api/dates_api.html
JDH
From: willemmerson <wil...@gm...> - 2009年07月19日 12:03:44
This is such a noob question but I can't seem to find the answer anywhere. I
have a certain amount of something per month which I want to display on the
y axis, I want the x axis to show years and months, i.e. it runs from 2003
to 2009. I have no problem with the python side, just the plotting side. How
do I do it?
-- 
View this message in context: http://www.nabble.com/plotting-years-and-months-tp24556407p24556407.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sandro T. <mat...@gm...> - 2009年07月19日 11:08:58
2009年7月19日 Alexander Bruy <vo...@ua...>:
>
> I create a small example, see attachment.
no attachment :)
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
From: Lukas H. <Lu...@gm...> - 2009年07月19日 10:59:02
Hello,
I've tried to resize the QTabWidget, I've searched for examples on the 
internet, added a QTabWidget and used this as the Mainwindows central widget - 
but exactly the same happened.
It works if I replace the FigureCanvas with a Qt Widget - for example a text 
edit or a QWebView.
Am Sonntag 19 Juli 2009 11:54:12 schrieb projetmbc:
> Lukas Hetzenecker a écrit :
> > I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
> > But at the first start of my script - the main.py in the attatched
> > example - the widget in the Tab is incorrectly sized.
> > If I embed the FigureCanvas in a QTabWidget the widget is to big, but if
> > I put it in a QWidget it is shown correctly.
>
> I'm not sure that is a pure MatPlotLib issue. Have you try with a big
> standard widget instead of the FigureCanvas ?
>
> Christophe
From: projetmbc <pro...@cl...> - 2009年07月19日 09:54:58
Lukas Hetzenecker a écrit :
> I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
> But at the first start of my script - the main.py in the attatched example - 
> the widget in the Tab is incorrectly sized.
> If I embed the FigureCanvas in a QTabWidget the widget is to big, but if I put 
> it in a QWidget it is shown correctly.
> 
I'm not sure that is a pure MatPlotLib issue. Have you try with a big 
standard widget instead of the FigureCanvas ?
Christophe
From: Alexander B. <vo...@ua...> - 2009年07月19日 07:37:59
20091707 Darren Dale <dsd...@gm...> wrote:
> 
> Please post a short, complete, self-contained script demonstrating the
> problem.
> 
I create a small example, see attachment. There is a simple dialog with QWidget, at which
matplotlib plot is drawn. When dialog resized the plot don't change it's size.
I'm would be grateful for an indication of my errors and working example.
Regards,
 Alexander Bruy
-- реклама -----------------------------------------------------------
Создай свой сайт бесплатно! www.hostpro.ua
From: Alexander B. <vo...@ua...> - 2009年07月19日 07:29:59
> I'm not an expert on this issue, and I never used Russian language.
> But here is my experience with unicode in matplotlib.
> 
Many thanks for your answer, Jae-Joon Lee!
It's work great. Thanks in advance! 
Regards,
 Alexander Bruy
-- реклама -----------------------------------------------------------
Создай свой сайт бесплатно! www.hostpro.ua
From: Lukas H. <Lu...@gm...> - 2009年07月19日 00:27:25
Attachments: PyQt4_MPL.tar.bz2
Hello,
I tried to embed a Matplotlib FigureCanvas into a QTabWidget.
But at the first start of my script - the main.py in the attatched example - 
the widget in the Tab is incorrectly sized.
If I embed the FigureCanvas in a QTabWidget the widget is to big, but if I put 
it in a QWidget it is shown correctly.
Sorry, but this is my first try of Matplotlib and I don't know what I could 
have done wrong - maybe this is just because it's nearly 3 o'clock in the 
night and I'm to tired to find this mistake. ;-)
Thanks for help,
Lukas
From: jan_strube <cur...@gm...> - 2009年07月18日 09:51:50
Hi Jouni,
Jouni K. Seppänen wrote:
> 
> jan_strube <cur...@gm...> writes:
> 
> Do you mean that saving as pdf from the qt4agg backend causes the same
> error, or is there a different error raised from that particular
> backend? When you save as pdf, you (usually) invoke the pdf backend, no
> matter what interactive backend you use.
> 
Yes, same error.
> Thank you for the report and the example! I think I have fixed this for
> the svg and pdf backends, but the PostScript backend still needs work.
> 
The pdf example seems to somewhat work, both on mac os x and on linux. The
hatch lines are really faint, but I can probably play with the matplotlibrc
settings to fix that.
The svg works on linux, but not quite on mac osx.
Safari complains:
This page contains the following errors:
error on line 354 at column 2372: Extra content at the end of the document
Below is a rendering of the page up to the first error.
Thanks for the fix.
Cheers,
 Jan
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
-- 
View this message in context: http://www.nabble.com/plotting-problems-in-qt4agg-backend-on-Mac-OS-X-tp24499919p24546274.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John [H2O] <was...@gm...> - 2009年07月18日 09:28:08
Below is what I am trying to do, perhaps I am doing something wrong
somewhere?
John Hunter-4 wrote:
> 
> 
> or explicitly reuse the same fig by giving a figure number and clearing
> it:
> 
> for i in range(1000):
> fig = plt.figure(1)
> # plot something
> fig.cla()
> 
> JDH
> 
My Program is below. NOTE: The kwargs bit is before I realized how much
easier it is just to assign defaults in the definition... (haven't changed
it yet). 
The main thing I am using is FIGURE, which is a list containing the figure,
basemap instance, and the axes. I 'pass' these around trying to reuse them
as you show above.
In the main loop of the program I pass the FIGURE list to three calls to
plot_track. I try to reuse all the instances (I found creating the basemap
instance to be very slow). At the end of each loop in the mainloop I call:
FIGURE[2].cla() 
Which I understand to clear the axes. Maybe I should also be calling:
FIGURE[0].cla()
??
Thank you in advance!
def plot_track(lon,lat,**kwargs):
 """ Plot an longitude,latitude course over a basemap """
 if 'region' in kwargs.keys():
 region = kwargs['region']
 else:
 region = 1
 if 'figname' in kwargs.keys():
 figname = kwargs['figname']
 else:
 figname = None
 if 'FIGURE' in kwargs.keys():
 FIGURE = kwargs['FIGURE']
 else:
 FIGURE = [None,None,None]
 if 'overlay' in kwargs.keys():
 overlay = kwargs['overlay']
 else:
 overlay = 0
 if 'zlevel' in kwargs.keys():
 zlevel = kwargs['zlevel']
 else:
 zlevel = None
 if 'zsize' in kwargs.keys():
 zsize = kwargs['zsize']
 else:
 zsize = np.ones(len(lon))
 if 'base' in kwargs.keys():
 base = kwargs['base']
 else:
 base = 1
 
 ## Extract plotting kwargs, just makes a dict I can pass to basemap plot
command
 plot_kwargs = set_plotkwargs(kwargs)
 
 ##Get fig if exists
 fig=FIGURE[0]
 m=FIGURE[1]
 az=FIGURE[2]
 nullfmt = NullFormatter()
 if fig==None:
 # get a basemap from Basemap passing the region info. 
 exec("fig,m=get_base%s(region=region,coords=(lon,lat))"%base)
 if az==None: 
 ax=plt.gca()
 pos = ax.get_position()
 l, b, w, h = getattr(pos, 'bounds', pos)
 az = fig.add_axes([l,b,w,h],frameon=False)
 if az!=None and overlay==0:
 az.cla()
 plt.axes(az)
 #PRINT TRACK
 cx,cy = m(lon,lat)
 if zlevel!=None: 
 
c=m.scatter(cx,cy,zsize,zlevel,cmap=cm.spectral,marker=marker,faceted=False,zorder=10,alpha=0.35) 
 #m.scatter has no color bar, so create a ghost 'scatter' instance:
 ax=plt.gca()
 plt.draw()
 pos = ax.get_position()
 l, b, w, h = getattr(pos, 'bounds', pos)
 jnkax = fig.add_axes([l,b,w,h],frameon=False)
 axes(jnkax)
 plt.figure(); 
 
plt.scatter(cx,cy,zsize,zlevel,cmap=cm.spectral,marker=marker,faceted=False,zorder=10,alpha=0.75)
 plt.figure(fig.number);
 cax = plt.axes([l+w+0.03, b, 0.02, h]) 
 plt.colorbar(cax=cax) # draw colorbar
 #delete the ghost instance
 plt.close(2); 
 #make the ax axes active
 plt.axes(ax);
 else:
 m.plot(cx,cy,**plot_kwargs)
 plt.axes(az)
 az.xaxis.set_major_formatter( nullfmt )
 az.yaxis.set_major_formatter( nullfmt )
 plt.setp(az, xticks=[],yticks=[])
 az.axesPatch.set_alpha(0.0)
 if figname:
 savefig(figname)
 FIGURE=[fig,m,az] 
 return FIGURE
-- 
View this message in context: http://www.nabble.com/plotting-100%27s-of-figures%2C-mpl-slows-and-consumes-memory%21-tp24543343p24546109.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jouni K. S. <jk...@ik...> - 2009年07月18日 08:38:28
jan_strube <cur...@gm...> writes:
> File
> "/home/jstrube/local//lib64/python2.6/site-packages/matplotlib/backends/backend_pdf.py",
> line 1723, in _fillp
> (len(self._fillcolor) <= 3 or self._fillcolor[3] != 0.0))
> TypeError: object of type 'NoneType' has no len()
Yes, that looks like a bug. It seems that the hatch support doesn't get
a lot of use, so you have run into an edge case that no-one has
encountered before.
> This is the case not only for the pdf backend, but for the qt4agg backend as
> well.
Do you mean that saving as pdf from the qt4agg backend causes the same
error, or is there a different error raised from that particular
backend? When you save as pdf, you (usually) invoke the pdf backend, no
matter what interactive backend you use.
> Yes, the example works just fine. I am attaching a self-contained example to
> reproduce the problem.
Thank you for the report and the example! I think I have fixed this for
the svg and pdf backends, but the PostScript backend still needs work.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: John H. <jd...@gm...> - 2009年07月18日 00:55:34
On Fri, Jul 17, 2009 at 7:02 PM, John [H2O]<was...@gm...> wrote:
>
> I have a script looping through and plotting 100's of figures. It runs fine,
> but after the first few plots, the loop considerably slows down and the
> memory usage keeps going up.
>
> The script is quite complicated, so can't really paste it here, but I am
> trying to pass figure instances around and I am trying to reuse the
> axes/figures... but maybe someone could demonstrate how this is done
> efficiently?
You either need to close the figure in the loop, or reuse the same
figure and cla it, eg
for i in range(1000):
 fig = plt.figure()
 # plot something
 plt.close(fig)
or explicitly reuse the same fig by giving a figure number and clearing it:
for i in range(1000):
 fig = plt.figure(1)
 # plot something
 fig.cla()
JDH
From: John [H2O] <was...@gm...> - 2009年07月18日 00:02:38
I have a script looping through and plotting 100's of figures. It runs fine,
but after the first few plots, the loop considerably slows down and the
memory usage keeps going up. 
The script is quite complicated, so can't really paste it here, but I am
trying to pass figure instances around and I am trying to reuse the
axes/figures... but maybe someone could demonstrate how this is done
efficiently?
What do I need to do so that each successive plot is using the same instance
of axes rather than adding a new one... this is all I can imagine is
happening.
Thanks,
john
-- 
View this message in context: http://www.nabble.com/plotting-100%27s-of-figures%2C-mpl-slows-and-consumes-memory%21-tp24543343p24543343.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Paul R. <Pau...@nr...> - 2009年07月17日 22:15:59
Ryan Krauss-2 wrote:
> 
> RTFM:
> 
> plot(t,y, drawstyle='steps-post')
> 
> 
Actually, 'steps-pre' (which is the default) and 'steps-post' seem to have
swapped definitions.
Here is what the docs say:
 *where*: [ 'pre' | 'post' | 'mid' ]
 If 'pre', the interval from x[i] to x[i+1] has level y[i]
 If 'post', that interval has level y[i+1]
 If 'mid', the jumps in *y* occur half-way between the
 *x*-values.
In fact both the default behavior and what you get with steps-pre are what
SHOULD happen with steps-post. And steps-post (as you point out) does what
should be the default behavior and that of steps-pre.
I have filed a bug report on this, since it is very important that this work
as expected. As the original poster pointed out, this used to work
correctly but recently seems to have gotten broken.
Cheers,
-- Paul
-- 
View this message in context: http://www.nabble.com/possible-bug-with-linestyle%3D%27steps%27-tp23568959p24542440.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
9 messages has been excluded from this view by a project administrator.

Showing results of 509

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