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

Showing results of 57

<< < 1 2 3 (Page 3 of 3)
From: John H. <jdh...@ac...> - 2004年01月07日 14:54:16
>>>>> "matthew" == matthew arnison <ma...@ca...> writes:
 >> But there is no reason you shouldn't be able to create a PS
 >> figure or a GD figure to save. I've been meaning to add a 'PS'
 >> extension checker in the savefig command that would enable you
 >> to save to PS from any backend.
 >> 
 >> Is this primarily what you need to switch backends for?
 matthew> Yes that's the sweet spot.
 matthew> Presumably the Save button on the GTK/WX GUI just calls
 matthew> savefig()? In which case you'd be able to save postscript
 matthew> from there too, which would be popular too I think.
I've made some changes to the GTK backend that enable save to a ps
figure, either by calling
 savefig('somefile.ps')
or using a file with the ps extension from the save figure dialog.
It's not too pretty internally but it works (more or less). Consider
this a preliminary functional implementation with known bugs that will
be hammered out later.
The problem in implementing this is that the AxisText instances (axis
and tick labels, title) are backend dependent. As Jeremy noted when
he did the wx backend, this is different than the way other objects
(lines, patches) are handled. With some refactoring this can be made
more elegant.
The other problem is that the default fonts are different between the
backends, so you'll get a lot of warnings like "Falling back on
default font". This is another problem we need to clear up -- ie, we
need a set of shared fontnames between backends.
Finally, a 'gotcha' that you need to watch out for is that text
references in scripts will be destroyed by calling a postscript
savefig (because of the way text instance conversions are handled).
So if you did
 ax = subplot(111)
 plot(something)
 labels = ax.get_xticklabels()
 savefig('somefile.ps')
 set(labels, 'color', 'r')
 savefig('somefile.png')
The color change would not take effect because the text references
have been changed. Moral of story: do not change figure text
properties after calling savefig for a ps figure with text instances
obtained before the savefig call. 
Other than that it should work. Let me know. I've updated CVS but be
forewarned: CVS mirrors sometime take a while to update.
JDH
From: matthew a. <ma...@ca...> - 2004年01月05日 22:57:49
On Mon, 5 Jan 2004, John Hunter wrote:
> >>>>> "matthew" == matthew arnison <ma...@ca...> writes:
> 
> matthew> The matplotlib docs say you need to specify the backend
> matthew> before importing matplotlib.matlab. But this seems a bit
> matthew> restrictive: what if I want to display a plot on screen,
> matthew> and then output the same plot to postscript and print it?
> matthew> Normally imports are done only once at the top of a file,
> matthew> but I'd like to be able to switch backends anywhere.
> 
> But there is no reason you shouldn't be able to create a PS figure or
> a GD figure to save. I've been meaning to add a 'PS' extension
> checker in the savefig command that would enable you to save to PS
> from any backend.
> 
> Is this primarily what you need to switch backends for?
Yes that's the sweet spot.
Presumably the Save button on the GTK/WX GUI just calls savefig()? In 
which case you'd be able to save postscript from there too, which would 
be popular too I think.
Another thing that would be handy is a simple cross-platform recipe (or
function call?) for spawning persistent plot windows that don't block
execution of the calling script. It may have been on this list (I should 
really search before asking) but it should be in the matplotlib docs I 
think.
Oh yeah, and a default keyboard shortcut (or three! Esc, Q, Ctrl-Q) for
quitting the plot window.
And, being able to put the legend outside the plot area (either within a 
subplot, or outside all the subplots if the legend is the same for all). A 
big legend tends to cover up the data.
Cheers,
Matthew.
From: John H. <jdh...@ac...> - 2004年01月05日 16:03:55
>>>>> "matthew" == matthew arnison <ma...@ca...> writes:
 matthew> The matplotlib docs say you need to specify the backend
 matthew> before importing matplotlib.matlab. But this seems a bit
 matthew> restrictive: what if I want to display a plot on screen,
 matthew> and then output the same plot to postscript and print it?
 matthew> Normally imports are done only once at the top of a file,
 matthew> but I'd like to be able to switch backends anywhere.
The reason you need to specify the backend first is because everything
from making a figure window to mapping an RGB tuple to a color is
backend dependent. The matlab interface wouldn't know what to do with
the 'figure' command without knowing its backend.
What I think would be useful would be able to instantiate any backend
figure with a figure instance from another backend. Eg a backend
factory which did something like
 figPS = backend_factory(fig, 'PS')
 figGD = backend_factory(fig, 'GD')
Ie, you could initialize a figure in any backend with an instance from
another figure.
This probably will never work perfectly across all backends, primarily
because the GTK and WX backends both have a mainloop that they enter
and it would be difficult to run both at the same time (though perhaps
possible with GUI thread). But in most cases you wouldn't want too.
But there is no reason you shouldn't be able to create a PS figure or
a GD figure to save. I've been meaning to add a 'PS' extension
checker in the savefig command that would enable you to save to PS
from any backend.
Is this primarily what you need to switch backends for?
John Hunter
From: John H. <jdh...@ac...> - 2004年01月05日 15:26:20
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> The problem seems to be that process_docs.py is expecting
 Steve> to read many "matplotlib.*.html" files, but these files do
 Steve> not exist.
Yep, this is a doc bug in the README file. You need to first build the
class docs from the matplotlib root
 > make htmldocs
This will build all the matplotlib html class docs in the 'docs'
subdir, which process_docs.py assumes are there. If all you want are
the class docs, this is all you will need to do. process_docs and the
rest of the files in htdocs build the matplotlib web site.
I've updated the README file -- thanks for letting me know.
JDH
From: matthew a. <ma...@ca...> - 2004年01月05日 04:45:23
Well I just answered my own question. As the docs point out, you can use 
the -dPS option to turn on the postscript backend. So to use this in 
harmony with my scripts I needed to:
a) break out the plotting into a separate application called using command
line options (conveniently I had already done this)
b) tell my option parser about the -d option:
import matplotlib
from matplotlib.matlab import *
# ...
def main():
 # ...
 parser.add_option("-d", dest="plotbackend", default="GTK",
 choices=matplotlib._knownBackends.keys(),
 help="Graphics backend to use to generate plots.")
 # ...
c) use options.plotbackend in my own code to tell whether to 
savefig('something.ps')
It's a bit awkward, but workable.
Cheers,
Matthew.
On Mon, 5 Jan 2004, matthew arnison wrote:
> Hi
> 
> I'm writing a small script to plot my data, and I'd like to use a command 
> line option to allow the same plot to be either displayed with GTK or 
> output to postscript.
> 
> This means I have to switch matplotlib backends within the script.
> 
> Now by the time I know what option the user has chosen, I'm in a function:
> 
> def plotThings(options):
> matplotlib.use(options.plotbackend)
> from matplotlib.matlab import *
> 
> plot(...)
> ...
> 
> and python complains
> 
> SyntaxWarning: import * only allowed at module level
> 
> It still works, but I think I'm on thin ice. And it doesn't work if I do:
> 
> def main():
> # ... parse options ...
> 
> matplotlib.use(options.plotbackend)
> from matplotlib.matlab import *
> 
> plotThings(options)
> 
> SyntaxWarning: import * only allowed at module level
> NameError: global name 'plot' is not defined
> 
> The matplotlib docs say you need to specify the backend before importing 
> matplotlib.matlab. But this seems a bit restrictive: what if I want to 
> display a plot on screen, and then output the same plot to postscript and 
> print it? Normally imports are done only once at the top of a file, but 
> I'd like to be able to switch backends anywhere.
> 
> What are your thoughts on this issue?
> 
> I've been using matplotlib for a while. It's the best python plotting tool 
> I reckon. Thanks for contributing to free software.
> 
> Cheers and thanks,
> Matthew.
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
> Free Linux Tutorials. Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: matthew a. <ma...@ca...> - 2004年01月05日 01:44:09
Hi
I'm writing a small script to plot my data, and I'd like to use a command 
line option to allow the same plot to be either displayed with GTK or 
output to postscript.
This means I have to switch matplotlib backends within the script.
Now by the time I know what option the user has chosen, I'm in a function:
def plotThings(options):
 matplotlib.use(options.plotbackend)
 from matplotlib.matlab import *
 plot(...)
 ...
and python complains
SyntaxWarning: import * only allowed at module level
It still works, but I think I'm on thin ice. And it doesn't work if I do:
def main():
 # ... parse options ...
 matplotlib.use(options.plotbackend)
 from matplotlib.matlab import *
 plotThings(options)
SyntaxWarning: import * only allowed at module level
NameError: global name 'plot' is not defined
The matplotlib docs say you need to specify the backend before importing 
matplotlib.matlab. But this seems a bit restrictive: what if I want to 
display a plot on screen, and then output the same plot to postscript and 
print it? Normally imports are done only once at the top of a file, but 
I'd like to be able to switch backends anywhere.
What are your thoughts on this issue?
I've been using matplotlib for a while. It's the best python plotting tool 
I reckon. Thanks for contributing to free software.
Cheers and thanks,
Matthew.
From: Steve C. <ste...@ya...> - 2004年01月03日 07:38:41
I'm using matplotlib 0.40 from CVS and am trying to generate the html
docs as described in matplotlib/htdocs/README. This is the error I get:
$ python process_docs.py
 Converting matplotlib.cbook.html to template
Traceback (most recent call last):
 File "process_docs.py", line 20, in ?
 s = file('../docs/' + fname).read()
IOError: [Errno 2] No such file or directory:
'../docs/matplotlib.cbook.html'
The problem seems to be that process_docs.py is expecting to read many
"matplotlib.*.html" files, but these files do not exist.
Steve
---
2 messages has been excluded from this view by a project administrator.

Showing results of 57

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