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

Showing results of 36569

<< < 1 .. 1454 1455 1456 1457 1458 .. 1463 > >> (Page 1456 of 1463)
From: Steve C. <ste...@ya...> - 2004年01月18日 05:32:05
When using the matlab interface (with the default GTK+ backend),
matlab.title() sets the current axis title, but can you set the window
title - it defaults to "Figure 1"?
-- 
Steve
From: John H. <jdh...@ac...> - 2004年01月18日 00:04:38
>>>>> "Yann" == Yann Le Du <yan...@no...> writes:
 Yann> Hello, I've just discovered matplotlib-0.40 (with linux),
 Yann> and going through the tutorial, I get an error (pasted at
 Yann> the end of email) when using dashes in the "Multiple lines
 Yann> with one plot command" example.
This script runs on my system
 from matplotlib.matlab import *
 t = array([0,1,2,3], Float)
 plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
 show()
/usr/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py in 
set_dashes(self, dash_offset, dash_list)
 175 dpi = self.drawable.dpi.get()
 176 if dash_list is not None:
--> 177 dashes = dash_list*dpi/72.0
 178 self.gdkGC.line_style = gdk.LINE_ON_OFF_DASH
 179 dl = [int(math.ceil(val)) for val in dash_list]
TypeError: unsupported operand type(s) for /: 'array' and 'float'
This looks a lot like a known bug with 
from __future__ import division 
and use of the division / operator with Numeric arrays. For that
reason I usually try and write
 dashes = dpi/72.0*dash_list
or 
 dashes = dash_list*(dpi/72.0)
Apparently I forgot this time. Try the above and see if they help.
Please let me know.
John Hunter
From: Yann Le Du <yan...@no...> - 2004年01月17日 21:58:24
Hello,
Yet another question : has anyone managed to make an interactive 
matplotlib session from inside the IPython shell ?
Y
From: Yann Le Du <yan...@no...> - 2004年01月17日 19:21:02
Hello,
I've just discovered matplotlib-0.40 (with linux), and going through the
tutorial, I get an error (pasted at the end of email) when using dashes in
the "Multiple lines with one plot command" example.
If instead of putting :
plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
I put :
plot(t, t, 'r-', t, t**2, 'bs', t, t**3, 'g^')
it works fine.
Maybe someone can help ?
Y
========
/usr/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py in 
set_dashes(self, dash_offset, dash_list)
 175 dpi = self.drawable.dpi.get()
 176 if dash_list is not None:
--> 177 dashes = dash_list*dpi/72.0
 178 self.gdkGC.line_style = gdk.LINE_ON_OFF_DASH
 179 dl = [int(math.ceil(val)) for val in dash_list]
TypeError: unsupported operand type(s) for /: 'array' and 'float'
From: John H. <jdh...@ac...> - 2004年01月16日 04:10:07
>>>>> "matthew" == matthew arnison <ma...@ca...> writes:
 matthew> Hi, Currently matplotlib outputs postscript graphs which
 matthew> have no bounding box set. This means that by default they
 matthew> fill the whole page. If you want to include several plots
 matthew> in the same page in a document (because you generated
 matthew> them separately, or because the subplot output is a bit
 matthew> messy) then you have to manually crop each postscript
 matthew> graph. (Atleast that is my experience with LaTeX via lyx,
 matthew> Word is presumably similar.)
Hi Matthew, thanks for keeping the flame under my butt re EPS. This
is something that has come up a number of times and isn't hard to
implement. I just haven't taken the time to do it. Work has kept me
pretty busy the last two weeks.
There was a discussion on this mailing list some time ago where
several workarounds were discussed - sourceforge archives are
currently down or I'd post a link. I use the following: PS can be
included directly in LaTeX and sized
 \usepackage[dvips]{graphics}
 \newcommand{\dofig}[2]
 {\center{\scalebox{#1}{\includegraphics*{#2}}}} 
 \begin{figure}[t]
 \dofig{0.5}{somefile.ps}
 \caption{\footnotesize Insert your figure caption here} 
 \label{fig:figref}
 \end{figure}
0.5 is a scaling arg. Don't know how to do it in lyx though.
Others use ps2eps or ps2epsi.
But I can get the eps thing done with little effort -- I already know
the bounding box, it's just a matter of detecting the extension and
adding one line of code to the PS output. 
Stay tuned!
John Hunter
From: matthew a. <ma...@ca...> - 2004年01月15日 23:53:57
Hi,
Currently matplotlib outputs postscript graphs which have no bounding box
set. This means that by default they fill the whole page. If you want to
include several plots in the same page in a document (because you
generated them separately, or because the subplot output is a bit messy)
then you have to manually crop each postscript graph. (Atleast that is my 
experience with LaTeX via lyx, Word is presumably similar.)
I tried a few tools to fix this. I finally found bbfig:
http://rpmfind.net/linux/RPM/contrib/noarch/noarch/bbfig-1.14-2.noarch.html
which correctly calculates the bounding box for an arbitrary
postscript file.
As hinted by this page:
http://www.mcs.kent.edu/mcsinfo/compsys/faq/cmds/bbfig.html
you can do
bbfig yourfile.ps | ghostview -
to see the bounding box visually. But /usr/doc/bbfig-1.14/README.RPM
says you can also do
bbfig myfigure.ps | gs -q -dNODISPLAY -
then add it output to the top of the ps file to have it be correctly
cropped.
bbfig is coded in postscript! But I thought you might be interested
in case you want to fix matplotlib so that it outputs correctly
bounded (e)ps files by default.
Cheers,
Matthew.
From: Steve C. <ste...@ya...> - 2004年01月10日 06:58:26
Whenever I run 'cvs update' I always get a long list of '?' status files
like
? docs/matplotlib.afm.html
? docs/matplotlib.artist.html
...
? htdocs/backends.html
? htdocs/classdocs.html
...
? htdocs/screenshots/axes_demo_large.png
? htdocs/screenshots/axes_demo_small.png
...
? matplotlib/__init__.pyc
? matplotlib/_matlab_helpers.pyc
...
CVS uses the '?' label for files in my working directory which do not
correspond to anything in the source repository.
These files, for example the .pyc files, are not source files, they are
generated from the source files by the build process.
CVS by default knows that it should ignore files such as *.o and *.exe.
It can be told to ignore additional files in a directory by creating the
file .cvsignore in the relevant directory and listing the files to
ignore (either by name or using wildcards).
So to remove the warnings listed above, you could set up the files
docs/.cvsignore:
*.html
htdocs/.cvsignore:
*.html
htdocs/screenshots/.cvsignore:
*.png
matplotlib/.cvsignore:
*.pyc
-- 
Steve
From: John H. <jdh...@ac...> - 2004年01月09日 14:54:15
>>>>> "Birger" == <bir...@te...> writes:
 Birger> Hi. I stumbled over your matplotlib module, and it's
 Birger> exactly what I have been looking for being a long time
 Birger> matlab user.
 Birger> Since sourceforge is down, I have a question which I hope
 Birger> you'll answer, but I fully understand if you don't have
 Birger> the time
No problem, when it comes back up you may want to join the mailing
list
 Birger> (using GTK, latest version on winXP) creating a simple
 Birger> script like this:
 Birger> from matplotlib.matlab import * vector = [1, 2, 3, 4, 5,
 Birger> 3, 2, 1] plot(vec) savefig(r'c:\test.jpg')
 Birger> This does not save the file, but calling 'show()' will
 Birger> show the file and then save the file. Shouldn't it be
 Birger> possible to save a fig without calling show? I have plans
 Birger> to use this in a cgi application, and hope I can do it
 Birger> this way.
There are three ways to do this currently. Are you planning on
running your web server under windows or linux or other? The platform
you are on will determine which route is easiest.
 1) On Linux/UNIX, Run matplotlib in a X virtual frame buffer (Xvfb)
 which is a virtual X windows. There you can save the figures in
 the GTK backend with no window ever popping up. I'm going to do
 some more investigating to see if pygtk is capable of drawing
 with no window in the absence of Xvfb (in which the window is
 simulated). I am using matplotlib in a web application server so
 I can provide some example code.
 2) Alternatively, you can use the GD backend, which is designed to
 do offline drawing. I haven't succeeded in getting gdmodule
 compiled for windows, but I know it's doable. I just haven't
 pressed the issue because so far noone has wanted it.
 3) Finally, a hack solution which would work under windows is to use
 the ps backend to generate the plots (this requires only Numeric
 and produces high quality output) and use another module like PIL
 to convert them to PNG or JPG to serve over the web. This is in
 my opinion the least desirable solution, but one you may want to
 consider if you must work on win32 and can't get GD running. 
 Birger> If I were better at programming, I would have written a
 Birger> PIL module for matplotlib, since matplotlib is a module I
 Birger> will use extensively in the future
I would like to have a PIL and python Tk backend. So when you get
you're programming chops up to speed, definitely think of us!
John Hunter
From: John H. <jdh...@ac...> - 2004年01月08日 23:23:16
>>>>> "matthew" == matthew arnison <ma...@ca...> writes:
 matthew> I think you need to use threads. I'm only just learning
 matthew> how to use them myself. But have a look at:
Have you looked at examples/interactive.py and
examples/interactive2.py? 
JDH
From: matthew a. <ma...@ca...> - 2004年01月08日 23:14:55
I think you need to use threads. I'm only just learning how to use them 
myself. But have a look at:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq20.001.htp
and play with something like:
#!/usr/bin/python
# Trying to figure out how to use threads.
# This doesn't work, but I feel it is close.
import time
import thread
from matplotlib.matlab import *
import gtk
gtk.threads_init()
# gtk.mainloop()
figure(1)
plot([1,2,3,4,5,2])
print "figure 1"
gtk.threads_enter()
thread.start_new_thread(show, ())
gtk.threads_leave() 
time.sleep(2)
figure(2)
plot([1,2,3,4,5,2,10])
print "figure 2"
gtk.threads_enter()
thread.start_new_thread(show, ())
gtk.threads_leave() 
time.sleep(2)
...
Cheers,
Matthew.
On Thu, 8 Jan 2004, Flavio C. Coelho wrote:
> Hi,
> 
> I have a problem with matplotlib:
> 
> My program is an interective simulator which needs to re-plot results
> multiple times at the users request.
> 
> But after I issue show() I cannot generate other plots.
> 
> what can I do to circumvent this?
> 
> thanks in advance,
> 
> Flávio Codeço Coelho,
> PhD
> Programa de Computação
> Científica
> Fundação Oswaldo Cruz
> Rio de Janeiro -- Brasil
> 
> 
> ________________________________________________________________________
> 
From: John H. <jdh...@ac...> - 2004年01月08日 18:04:36
>>>>> "Flavio" == Flavio C Coelho <fcc...@fi...> writes:
 Flavio> Hi, I have a problem with matplotlib:
 Flavio> My program is an interective simulator which needs to
 Flavio> re-plot results multiple times at the users request.
 Flavio> But after I issue show() I cannot generate other plots.
 Flavio> what can I do to circumvent this?
If you are using matplotlib in an application, as it sounds like you
are, you don't need to call show at all. You control the GUI mainloop
yourself. See, for example, examples/embedding_in_gtk2.py or
examples/embedding_in_wx.py.
Do the application users need to use the matlab interface plotting
commands themselves, or are they simply interacting with the plots
using widgets you provide? If the latter, I suggest not using the
matlab interface at all, and importing Figure from
backends.backend_gtk or backends.backend_wx. and Subplot from axes
and controlling the plots using the object oriented API.
All of the matlab plotting commands are simply thin wrappers to the
Axes API (hist, psd, scatter, etc... are all accessible from the axes
instance)
Eg,
 subplot(111)
 plot(t,s)
 xlabel('hi mom')
 set(gca(), 'xlim', [0,10])
is
 fig = Figure(figsize=(5,4), dpi=100)
 ax = Subplot(f, 111)
 ax.plot(t,s)
 ax.set_xlabel('hi mom')
 ax.set_xlim([0,10])
You can force a redraw of the figure by doing
 fig.draw()
The moral of the story: don't call show for applications; that is for
python batch scripts.
Will this work for you?
Of course if you have a shell and you want to allow your users to
interact with the plot using the matlab interface, you'll need a
different approach. Something along the lines of
examples/interactive2.py, which is an interactive shell for pygtk. I
haven't worked with custom shells for wx, but interactive control of
matplotlib figures works in PyCrust with the CVS version of matplotlib.
Make sure you are using the CVS version of matplotlib as a number of
critical bugs in the WX backend that affect interactive use have been
fixed since the 0.40 release. Note the API for working interactively
has changed. You now do
 import matplotlib
 matplotlib.use('WX')
 matplotlib.interactive(True)
Ditto for GTK.
Here's a snapshot of the latest version in case your CVS mirrors are
behind:
 http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.41c.tar.gz
Hope this helps!
John Hunter
From: matthew a. <ma...@ca...> - 2004年01月07日 23:27:47
Attachments: subplot_demo.py
That's great.
It's interesting to read your discussion of backend switching issues. It's
something that gnuplot deals with very poorly indeed, which is what
motivated me to seek out matplotlib. I.e. in gnuplot you can freely switch 
backends, but the line styles are set differently (and sometimes very 
awkwardly: X resources for instance!) for each backend.
Anyway, I tried out what's in CVS. As you say, it mostly works. I had
trouble though with my (rather complicated) 2x2 subplot script. The worst
problem is that when I use the Save button to save as .ps, the output is
sized too large to fit on the page: only the lower left subplot is fully
visible.
There are various other layout problems, which I managed to reproduce in
the attached hacked version of subplot_demo.py, but unfortunately I
couldn't reproduce the problem above outside of my script.
Other problems:
* when saving from the GTK window into a .ps file, the lines are not 
clipped by the edge of the plot area: see the top left plot in the 
attached code
* xaxis and yaxis labels often land on top of adjacent subplot titles and
plot areas in savefig('blah.ps') output (I've had trouble with this in the 
-dPS output too)
Also, I tried to save as file.eps, but the save dialog complained and only
accepts .ps. Presumably this is an easy fix?
Cheers,
Matthew.
On Wed, 7 Jan 2004, John Hunter wrote:
> 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: 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
---
From: John H. <jdh...@ac...> - 2003年12月29日 15:48:43
>>>>> "Eugene" == Eugene A Suchkov <Cit...@in...> writes:
 Eugene> 1) I can't make 2 plots using WX-backend sequentially
Do you need to use matplotlib interactively from the prompt, or do you
simply need to make 2 figures?
The latter is easy
 import matplotlib
 matplotlib.use('WX')
 from matplotlib.matlab import *
 figure(1)
 plot([1,2,3,4])
 figure(2)
 plot([1,4,9,16])
 show()
For interactive mode, as suggested earlier, we're still ironing out
the bugs regarding interactivity and WX.
Thanks!
John Hunter
From: John H. <jdh...@ac...> - 2003年12月29日 15:45:41
>>>>> "Eugene" == Eugene A Suchkov <Cit...@in...> writes:
 Eugene> When I'm performing smth like:
 Eugene> tl=get_xticklabels(...) for l in tl: print get_text(l)
 Eugene> I'm wondering why tl is a correct list, but with empty
 Eugene> text :(
This is related to the first problem you are having. When you are not
running matplotlib in interactive mode, nothing on the plotting side
is done until you call 'show()'. The reason for this is that the
backend doesn't have access to the gtk primitives until the window is
realized.
If you start your script with
 >>> import matplotlib
 >>> from matplotlib.matlab import *
 >>> from matplotlib.backends.backend_gtk import ShowOn
 >>> ShowOn().set(1) # turning on interactive mode
and turn on interactive mode, then you can, for example, print the
labels before calling show, as in the script below.
Note however, whether or not you are in interactive mode, you will be
able to control the text properties, as in 
 ax = subplot(111)
 ax.plot([1,2,3])
 tl = ax.get_ticklabels()
 set(tl, 'color', 'r')
You aren't the first one to be confused about interactive mode
vis-a-vis the various backends. It's not a trivial issue since both
the GTK and WX backend have event loops that they go into, but it's a
high priority since it's causing trouble for several people.
Hopefully by the next minor release we'll have it worked out.....
import matplotlib
from matplotlib.matlab import *
from matplotlib.backends.backend_gtk import ShowOn
ShowOn().set(1) # turning on interactive mode
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
ax = subplot(111)
ax.plot(t,s)
tl = ax.get_xticklabels()
for l in tl:
 print l.get_text()
show()
From: John H. <jdh...@ac...> - 2003年12月29日 15:30:34
>>>>> "Todd" == Todd G Gardner <pi...@ea...> writes:
 Todd> Hello all, Please pardon my ignorance as I am fairly new to
 Todd> matplotlib.
 Todd> I have 1000 sets of (x,y) data. I would like to cycle
 Todd> through this data by graphing set 1 then 2 then ... 1000.
 Todd> How can I refresh a plot without closing and reopening that
 Todd> plot?
Pekko Piirola <pek...@he...> sent me an example some time
ago that cycles through a data set. Currently this example only works
in the GTK backend, but we're actively working on getting a unified
GUI interface to allow for this kind of thing. You may also want to
take a look at examples/system_monitor.py and examples/dynamic_demo.py
which show how to dynamically update a plot.
#!/usr/bin/env python2.3
import matplotlib.matlab
import gtk
import Numeric
fig = matplotlib.matlab.figure(1)
ind = Numeric.arange(60)
x_tmp=[]
for i in range(100):
 x_tmp.append(Numeric.sin((ind+i)*Numeric.pi/15.0))
X=Numeric.array(x_tmp)
lines = matplotlib.matlab.plot(X[:,0],'o')
def updatefig(*args):
 updatefig.count += 1
 if updatefig.count>59: updatefig.count=0
 lines[0].set_data(ind,X[:,updatefig.count])
 fig.draw()
 return gtk.TRUE
updatefig.count=-1
gtk.timeout_add(200,updatefig)
matplotlib.matlab.show()
From: Todd G. G. <pi...@ea...> - 2003年12月29日 07:02:35
Hello all,
Please pardon my ignorance as I am fairly new to matplotlib.
I have 1000 sets of (x,y) data. I would like to cycle through this data by
graphing set 1 then 2 then ... 1000.
How can I refresh a plot without closing and reopening that plot?
Any pointer would be greatly appreciated.
Todd
From: Jeremy O'D. <je...@o-...> - 2003年12月28日 22:45:12
Hi Eugene,
On Sunday 28 December 2003 7:34 am, you wrote:
>
> I's really useful feature, e.g.:
>
> I have a WX program. It has some buttons, checkboxes, radiobuttons, to
> combine the options (detrending, plotting autocorrelation etc), and I
> can perform this options for any file with data. Now the user should
> quit this program to plot anothe graph... I's really tiring :(
Looking at this description, I wonder if it might be better for you to embed a 
figure in your application. You will then be able to build up the figure as 
you want it and hit the 'save' button, then maybe continue with changes, or 
clear the data in the chart.
The example 'embedding_in_wx.py' shows how to embed a Matplotlib chart in a 
wxFrame (and it works just as well if the PlotFigure class is derived from 
wxPanel, which is what you would probably do in a larger program than the 
short example).
The plotted data itself is stored in a FigureWx instance. This needs to be 
associated with a FigureManager and Toolbar instance if you want to be able 
to pan, zoom and save plot images.
In the example, the plotting is done in a single function, plot_data(). 
However, it is easy to add event handling functions which act on the Figure, 
e.g., if data is held in self.data_x and self.data_y, and the axis instance 
is self.axis:
(in __init__() for PlotFigure):
 EVT_BUTTON(self, ID_REGRESSION, self.onRegressionButton)
...
and new function:
def onRegressionButton(self, evt):
 reg_x, reg_y = PerformRegression(self.data_x, self.data_y)
 self.axis.plot(reg_x, reg_y)
 self.toolbar.update()
 self.fig.draw() 
Hope this helps. I'll make the changes for show() anyway - it is important to 
John and I that all backends are as close to identical as possible, and you 
have clearly identified the bug for me. Good luck, and thanks for the 
feedback.
Regards
Jeremy
From: Jeremy O'D. <je...@o-...> - 2003年12月27日 13:18:17
Hi Eugene,
I've had a quick look into the problem for you, and I can't give an immediate 
solution, but I'll try to get a fix in the next few days.
I can say that in the original design, the intention was that show() would be 
the last line of any script. I know that John (author of virtually everything 
in Matplotlib except backend_wx) has recently made some changes to allow 
show() to be called more than once.
Unfortunately, the code needed to do thisis quite specific to each GUI 
library, and I cannot simply port what has been done for GTK (I've just tried 
something very close to the GTK implementation, and it doesn't work).
A few questions for John Hunter: 
I think I need to do something like the following:
- show() must now instantiate any figures already defined and enter the the 
main event loop. ShowOn needs to keep track of this.
- I need to keep track of the number of figures instantiated. I assume that 
Gcf.destroy() does this.
- I need to ensure that I do not exit when the last figure is destroyed, and 
therefore need to manage that I may need to create a new figure manager if 
there is none.
Have I missed anything?
Regards
Jeremy
Eugene A. Suchkov writes:
>
> Hi all!
> 
> There are some bug's I've found in two days I got started with echotag.
> 
> 1) I can't make 2 plots using WX-backend sequentially
> 
> For example:
> 
> ---CODE---
> 
> import matplotlib
> matplotlib.use('WX')
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
> plot([1,4,9,16])
> show()
> 
> --END CODE--
> 
> Well, everything is OK, while building 1st graph, but then an error
> occurs:
> 
> --OUTPUT--
> 
> Traceback (most recent call last):
> File "plot.py", line 7, in ?
> plot([1,4,9,16])
> File "/usr/lib/python2.2/site-packages/matplotlib/matlab.py", line
> 723, in plot draw_if_interactive()
> File
> "/usr/lib/python2.2/site-packages/matplotlib/backends/backend_wx.py",
> line 986, in draw_if_interactive current_fig =
> Gcf().get_current_figwin().figure AttributeError: 'Gcf' object has no
> attribute 'get_current_figwin'
> 
> --END OUTPUT--
> It was tested on Linux and Windows. Versions 0.40 and 0.32
> 
> When I'm using GTK everything is OK with both graphs, but using WX is
> critical :(
657 messages has been excluded from this view by a project administrator.

Showing results of 36569

<< < 1 .. 1454 1455 1456 1457 1458 .. 1463 > >> (Page 1456 of 1463)
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 によって変換されたページ (->オリジナル) /