SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Jeremy O'D. <je...@o-...> - 2003年12月02日 17:14:17
Hi Flavio,
I expect that you've found the solution to your problem now, but just in
case, I have now published significantly improved version of the wx
embedding example in CVS.
Since Sourceforge can take some time to sort these things out, I have
included the code here.
I should also note that there has been quite a significant enhancement to
the CVS version of backend_wx committed to CVS. You may wish to use this
(although I don't think that the interface has changed anywhere.
Details of the changes have been posted to the matplotlib-devel list, or
you can see details at the top of the source file (matplotlib-devel
archiving appears to be very slow).
Regards
Jeremy
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D=
3D=3D3D=3D3D=3D3D=3D3D
"""
Copyright (C) Jeremy O'Donoghue, 2003
License: This work is licensed under the PSF. A copy should be included
with this source code, and is also available at
http://www.python.org/psf/license.html
This is a sample showing how to embed a matplotlib figure in a wxPanel.
The example implements the full navigation toolbar, so you can automatica=
=3D
lly
inherit standard matplotlib features such as the ability to zoom, pan and
save figures in the supported formats.
There are a few small complexities worth noting in the example:
1) By default, a wxFrame can contain a toolbar (added with SetToolBar())
 but this is at the top of the frame. Matplotlib default is to put the
 controls at the bottom of the frame, so you have to manage the toolbar
 yourself. I have done this by putting the figure and toolbar into a
 sizer, but this means that you need to override GetToolBar for your
 wxFrame so that the figure manager can find the toolbar.
2) I have implemented a figure manager to look after the plots and axes.
 If you don't want a toolbar, it is simpler to add the figure directly
 and not worry. However, the figure manager looks after clipping of the
 figure contents, so you will need it if you want to navigate
3) There is a bug in the way in which my copy of wxPython calculates
 toolbar width on Win32, so there is a tricky line to ensure that the
 width of the toolbat is the same as the width of the figure.
4) Depending on the parameters you pass to the sizer, you can make the
 figure resizable or not.
"""
import matplotlib
matplotlib.use('WX')
from matplotlib.backends import Figure, Toolbar, FigureManager
from matplotlib.axes import Subplot
import Numeric as numpy
from wxPython.wx import *
class PlotFigure(wxFrame):
 def __init__(self):
 wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
 self.fig =3D3D Figure(self, -1, (5,4), 75)
 self.toolbar =3D3D Toolbar(self.fig)
 self.toolbar.Realize()
 # On Windows, default frame size behaviour is incorrect
 # you don't need this under Linux
 tw, th =3D3D self.toolbar.GetSizeTuple()
 fw, fh =3D3D self.fig.GetSizeTuple()
 self.toolbar.SetSize(wxSize(fw, th))
 # Create a figure manager to manage things
 self.figmgr =3D3D FigureManager(self.fig, 1, self)
 # Now put all into a sizer
 sizer =3D3D wxBoxSizer(wxVERTICAL)
 # This way of adding to sizer prevents resizing
 #sizer.Add(self.fig, 0, wxLEFT|wxTOP)
 # This way of adding to sizer allows resizing
 sizer.Add(self.fig, 1, wxLEFT|wxTOP|wxGROW)
 # Best to allow the toolbar to resize!
 sizer.Add(self.toolbar, 0, wxGROW)
 self.SetSizer(sizer)
 self.Fit()
 def plot_data(self):
 # Use ths line if using a toolbar
 a =3D3D self.figmgr.add_subplot(111)
 # Or this one if there is no toolbar
 #a =3D3D Subplot(self.fig, 111)
 t =3D3D numpy.arange(0.0,3.0,0.01)
 s =3D3D numpy.sin(2*numpy.pi*t)
 c =3D3D numpy.cos(2*numpy.pi*t)
 a.plot(t,s)
 a.plot(t,c)
 self.toolbar.update()
 def GetToolBar(self):
 # You will need to override GetToolBar if you are using an
 # unmanaged toolbar in your frame
 return self.toolbar
if __name__ =3D3D=3D3D '__main__':
 app =3D3D wxPySimpleApp()
 frame =3D3D PlotFigure()
 frame.plot_data()
 frame.Show()
 app.MainLoop()
From: Jon S. <red...@ya...> - 2005年04月05日 12:11:25
Hi,
I'm using Mac OS X 10.3 with fink. I've used matlabplot before, but 
since I've apt-get'd and upgrade'd-all, I've been getting the errors:
/sw/lib/python2.4/site-packages/matplotlib/font_manager.py:425: 
UserWarning: Could not open font file /Library/Fonts/NISC18030.ttf
 warnings.warn("Could not open font file %s"%fpath)
** (bubba.py:15740): WARNING **: `GtkTextSearchFlags' is not an enum 
type
** (bubba.py:15740): WARNING **: Cannot open font file for font 
Helvetica 10
** (bubba.py:15740): WARNING **: Cannot open fallback font, nothing to 
do
Then, matplotlib stops. I've reinstalled gtk, python, and matplotlib, 
but simply reinstalling does not seem to work. Does anyone know what's 
going on?
-Jon
From: Martin R. <law...@gm...> - 2005年09月06日 11:41:02
Hello everyone,
when using errorbar() it is possible to change the attributes (linethickness
etc.) with setp(). This works really well.
But on the otherhand when you try to set the attributes within the
errorbar()-command it will not work - see the exapmle below.
Finding this a bit disturbing I took a look at "axes.py" where errorbar() is
placed. I found out that the drawing of those bars and caps (also
just beeing lines) are added to the plot without the "**kwargs".
Credulously and optimistic I just added it there and - of course - got an
errormessage. So I made a copy of kwargs in the method errorbar() and poped
out all the keywords which could be problematic (I only found out 'marker',
'ls' and 'linestyle') by
kwargs_bars = kwargs.copy() # make copy of kwargs (not only a
 # pointer)
if kwargs.has_key('marker'): # Is the 'marker' keyword given in
 # kwargs?
 marker=kwargs_bars.pop('marker')# filter this entry out (would raise
 # error "duplicate keyword argument")
if kwargs.has_key('ls'): # Is the 'ls' keyword given in kwargs?
 marker=kwargs_bars.pop('ls') # filter this entry out (vlines, hlines
 # would not be drawn)
if kwargs.has_key('linestyle'): # Is the 'linestyle' keyword given
 marker=kwargs_bars.pop('linestyle') # in kwargs?
and then added **kwargs_bars to the following vlines, hlines and plots:
barlines.extend( self.hlines(y, x, left,**kwargs_bars) )
barlines.extend( self.hlines(y, x, right,**kwargs_bars) )
caplines.extend( self.plot(left, y, '|', ms=2*capsize,**kwargs_bars) )
caplines.extend( self.plot(right, y, '|', ms=2*capsize,**kwargs_bars) )
and also for yerr.
Now the example below worked fine.
I'm now thinking of two things - the second one of them beeing a
possible drawback.
 i) I'm not sure if other keywords should also be poped out. I can't imagine
any further problems - but we all know that this means completely
nothing in the wide field of possible errormessages ;-)
ii) Like before you have the ability to set the color of the cap- and
barlines seperatly from the color of the line connecting the points.
The problem mentioned above (you can't change the thickness of the caps and
bars from the errorbar()-command) still persists for 'linestyle'. Therefor
I'm not sure if the confusion existing before is cleared away. Propably not.
Just imagine a user: "I would like to change the style of the bars and caps
to '-.'. Why do I have to use setp() instead of giving it to errorbar()?"
But I hope that the changes in axes.py are helpful.
Bye,
Martin
PS: Would it be more agreeable if I try to create a patch ruther
then sending the codesnippets? If yes: could anyone give me a hint on how
to find information about patches (how t omake them, how to apply
them)?
Thanks!
#-------------------------------------------------------------------------------
"""This little program shows that it makes an enormous difference
 where the properties of the errorbar()-command are set.
 a) within the command errorbar(...)
 b) seperately with an setp() command
"""
from pylab import *
N=20
x = 1.0*arange(N)/(N-1)
yerrors = .02*rand(N) # errors in y
xerrors = .02*rand(N) # errors in x
y = exp(-x) # plain curve
figure(1)
subplot(121)
print ("Left : If the features are set with setp() everything works out
fine.")
error_plot_1 = errorbar(x,y, yerr=yerrors,xerr=xerrors,
 ls='none',ecolor='r')
setp(error_plot_1,linewidth=3,markeredgewidth=2)
subplot(122)
print ("Right : But if one uses the command errorbars() itself not.")
error_plot = errorbar(x,y, yerr=yerrors,xerr=xerrors,
 ls='none',ecolor='r',
 linewidth=3,markeredgewidth=2)
show()
-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl
From: <dav...@fr...> - 2005年09月23日 18:34:18
Hi matplotlib users,
 I'm looking for a way to remove and/or control the properties (color,
thickness,...) of the lines (axis) around the graph.
I spent already quite some time to search a solution. I have found only o=
ne
comment on these lines in the multiline-plot wiki:
"It's on our list of things to change the way these axes lines are draw
so that you can remove it, but it isn't done yet"
Is this done now? Is there even a dirty trick to at least remove them?
Thanks,
David
From: Nils W. <nw...@me...> - 2006年02月24日 19:02:31
Hi all,
I have installed two different version of python
One is in /usr/bin/python and the other is in
/usr/local/bin
I have installed matplotlib using
/usr/bin/python setup.py build
/usr/bin/python setup.py install
It works fine.
However if I try to install matplotlib using
/usr/local/bin/python setup.py build
it fails due to missing pygtk.
How can I resolve this problem ?
Can I add something to
/usr/local/bin/python setup.py build
and
/usr/local/bin/python setup.py install ?
Nils
 =20
From: John H. <jdh...@ac...> - 2006年02月24日 20:10:44
>>>>> "Nils" == Nils Wagner <nw...@me...> writes:
 Nils> Can I add something to
 Nils> /usr/local/bin/python setup.py build
 Nils> and
 Nils> /usr/local/bin/python setup.py install ?
You have a few choices: 
 * don't enable the GTK backend for your matplotlib install in
 /usr/local/bin/python -- edit setup.py and set BUILD_GTK=0
 * install pygtk and everything else you want in the
 /usr/local/bin/python before installing mpl there
 * update your PYTHONPATH and PKG_CONFIG_PATH so both can see the
 same pygtk install. This will only work if both pythons have the
 same major version number, eg both are 2.3 or both are 2.4.
 * use a subject heading when posting
JDH
From: Finny K. <kur...@mo...> - 2006年02月24日 20:45:11
I've been having trouble gettin histograms to work on arrays. This is no=
t
the particular case that I've had, but illustrates the general error.=20
Wondering if anyone knew what I was doing wrong? Thanks.
>>> from pylab import *
>>> from numpy import *
>>> x=3Dones([2,10])
>>> x
array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])
>>> hist(x[0])
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 1857,
in hist
 ret =3D gca().hist(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1676,
in hist
 n,bins =3D matplotlib.mlab.hist(x, bins, normed)
 File "/usr/lib/python2.4/site-packages/matplotlib/mlab.py", line 617, i=
n
hist
 ymin -=3D 0.5
TypeError: unsupported operand type(s) for -=3D: 'str' and 'float'
From: Finny K. <kur...@mo...> - 2006年03月01日 16:53:48
I've finally figured out why I've been having trouble creating histograms=
.
 As it turns out, if you pass to hist() a datatype that is numpy.ndarray
instead of a Numeric array, you get the following error. Check this out:
>>> import numpy
>>> import Numeric
>>> from pylab import *
>>> y=3DNumeric.array([1,2])
>>> hist(y) # This works no problem
>>> x=3Dnumpy.array([1,2])
>>> hist(x)
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 1857,
in hist
 ret =3D gca().hist(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1676,
in hist
 n,bins =3D matplotlib.mlab.hist(x, bins, normed)
 File "/usr/lib/python2.4/site-packages/matplotlib/mlab.py", line 621, i=
n
hist
 dy =3D (ymax-ymin)/bins
TypeError: unsupported operand type(s) for -: 'str' and 'str'
I'm not exactly sure why this is true, but I've empirically found this ou=
t
to be the case. If anyone knows why, I'd sure love to know.
Thanks,
Finny Kuruvilla
From: John H. <jdh...@ac...> - 2006年03月01日 17:23:09
>>>>> "Finny" == Finny Kuruvilla <kur...@mo...> writes:
 Finny> I'm not exactly sure why this is true, but I've empirically
 Finny> found this out to be the case. If anyone knows why, I'd
 Finny> sure love to know.
matplotlib will work with numpy, numarray *or* Numeric, but it doesn't
work with all three at the same time. You need to set your "numerix"
setting in your config file to agree with which package you are using
(and then restart python). An example rc file is at
http://matplotlib.sf.net/matplotlibrc
We provide a numerix compatibility layer which you can consider using
so you won't get into these troubles. This essentially guarantees
that the array object you are using is the same as the one you have
set in your configuration file
 import matplotlib.numerix as nx
 x=nx.array([1,2])
 hist(x)
You can inspect the value of the numerix parameter with
 import matplotlib
 print matplotlib.rcParams['numerix']
rcParams is a dictionary mapping a configuration parameter to a
value. Most of these can be changed dynamically at runtime, but two,
the 'numerix' and the 'backend' setting must be changed before
importing the numerix module and pylab, respectively, because these
trigger imports that are not easily undone. Most people just set
these once in their rc file and are done with it, but you can set them
in a script with 
 from matplotlib import rcParams
 rcParams['numerix] = 'numpy'
 rcParams['backend'] = 'PS'
 # it is now safe to import numerix and pylab
 import matplotlib.numerix as nx # you'll be using numpy
 import pylab # with the postscript backend as default
JDH
JDH
From: Pieter D. <pie...@gm...> - 2006年08月18日 12:26:31
Hi,
I'm trying to generate a contour plot with logarithmic axes. I'm
generating data on a grid defined by logspaces:
x_range = logspace(log10(xstart),log10(xend),num=25)
y_range = logspace(log10(ystart),log10(yend),num=25)
Then, to generate the plot I do the following:
[X,Y]=pylab.meshgrid(log10(x_range),log10(y_range))
pylab.contourf(X,Y,transpose(data))
And to obtain nicer tick mark labels, this dirty way:
xmajorForm = pylab.FormatStrFormatter('10e%.1f')
ax.xaxis.set_major_formatter(xmajorForm)
ymajorForm = pylab.FormatStrFormatter('10e%.1f')
ax.yaxis.set_major_formatter(ymajorForm)
Are there better ways to (1) set the x and y xis scaling to
logarithmic, and to (2) obtain nicely formatted tick mark labels ?
I tried playing around with the x and y axis data and with LogLocator
and LogFormatter but it doesn't seem to do the job.
Pieter
From: Peter Z. <zhu...@ke...> - 2006年09月28日 09:02:24
Hi, All,
 
I am doing some plotting and I want to do some format change to my tick.
Here is what I want:
 
Origin ticks: 0.0 1.0 2.0 3.0
4.0 5.0
Ticks I want: 0.0mV 1000mv 2000mV 3000mV 4000mV 5000mV
 
Just showing the ticks in an easier-read way. Because I don't want so see
anything like 1.2345e-2, I want to see 12.345mV.
 
Thanks very much..
 
CONFIDENTIALITY NOTE: This message is intended only for the use of the 
individual or entity to which it is addressed and may contain information 
that is privileged, confidential, and exempt from disclosure under 
applicable law. If the reader of this notice is not the intended recipient, 
you are hereby notified that any dissemination, distribution or copying of 
this communication is strictly prohibited. If you have received this 
communication in error, please notify the sender immediately by telephone at
(86-10)8225 5779-361.
 
_____________________________________________________________________________
Scanned by IBM Email Security Management Services powered by MessageLabs. For more information please visit http://www.ers.ibm.com
_____________________________________________________________________________
From: lucaberto\@libero\.it <luc...@li...> - 2006年11月16日 20:42:28
Hello at all.
I need to do a real time plot where on the frame i have this like limit
line:
 import math
 dati =3D []
 for freq in range(int(freqiniziale), (int(freqfinale )+ 1)):
 forza =3D float(massa) * ((2*math.pi*freq)**2)/10
 dati.append(forza)
 ax1 =3D subplot(111)
 plot(dati)
 xlabel('Frequenza HZ')
 ylabel('Deg')
 title('Grafico Calibrazione')
 ax2 =3D twinx()
 plot([0.1,0.2,0.3],'r-')
 ylabel('Forza')
 ax2.yaxis.tick_right()
 #dlg =3D wx.FileDialog(self, "Choose a file", ".", "", "*.*",
wx.SAVE)
 #try:
 # if dlg.ShowModal() =3D=3D wx.ID_OK:
 # filename =3D dlg.GetPath()
 # savefig(filename+'.pdf')
 #finally:
 # dlg.Destroy()
 show()
with this i have the grap on the screen but i have to update every time 
that i receive others data coming from two instruments (10 seconds),
how i can update the grap? 
Regards
Luca=0A=0A=0A------------------------------------------------------=0ASco=
pri MOTOROLA K1, la nuova icona di design Motorola.Clicca e vinci !=0Ahtt=
p://click.libero.it/motorola16nov=0A
From: Praveen G. <pra...@ya...> - 2007年05月07日 15:50:41
Hi,
I'm a newbie trying to install matplotlib (0.87) on Linux (2.6.11,FC4). I have Python 2.4, wxPython 2.8.3 and all required libraries for matplotlib (freetype, libpng, zlib). I'm tring to use wxAgg as the backend, and there is a build error for matplotlib when it tries to compile the wxagg files.. I've attached the resulting output from the build.
It will be great help if anyone can give throw some light on how to fix this build error.
Thanks
Praveen
 
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
From: Christopher B. <Chr...@no...> - 2007年05月07日 16:18:04
Praveen Gopalakrishnan wrote:
> Hi, I'm a newbie trying to install matplotlib (0.87) on Linux
> (2.6.11,FC4). I have Python 2.4, wxPython 2.8.3 and all required
> libraries for matplotlib (freetype, libpng, zlib). I'm tring to use
> wxAgg as the backend, and there is a build error for matplotlib when
> it tries to compile the wxagg files..
I'm pretty sure that 0.87 will not build with wxPython2.8.* I think it's 
been fixed in SVN, but not in the 0.90 release either.
You can:
switch to wxPython 2.6
or
search the archives of this list for the fix and patch your source 
(search for my name, that may help)
or
Use the SVN version of MPL.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Ken M. <mc...@ii...> - 2007年05月07日 17:39:33
On May 7, 2007, at 11:21 AM, Christopher Barker wrote:
> Praveen Gopalakrishnan wrote:
>> Hi, I'm a newbie trying to install matplotlib (0.87) on Linux
>> (2.6.11,FC4). I have Python 2.4, wxPython 2.8.3 and all required
>> libraries for matplotlib (freetype, libpng, zlib). I'm tring to use
>> wxAgg as the backend, and there is a build error for matplotlib when
>> it tries to compile the wxagg files..
>
> I'm pretty sure that 0.87 will not build with wxPython2.8.* I think 
> it's
> been fixed in SVN, but not in the 0.90 release either.
Chris is correct, you cannot build 0.87's _wxagg module using 
wxPython 2.8. However, you can edit setup.py and change the value of 
the BUILD_WXAGG variable from 'auto' to 0. This will inhibit the 
compilation of the module and everything should work fine.
Ken
From: Rutkov D. <den...@ma...> - 2007年06月11日 14:34:55
Hello everyone! I'm seeking help with real-time plotting using Python and MatPlotLib. I've encoutered several problems so far:
1. There is no function to just add a point to the existing curve, so each time the data is updated all the curve has to be redrawn. This is not a clean solution for the real-time plotting. 
2. I'm trying to use threads in Python in order to be able to get the data and draw the curve at the same time. Sometimes it's working, and sometimes the graphics rendering just hangs. Moreover, if I try to use the Timer class for the plotting thread, it is invoked only one time. I wonder, if my threads are stirring with a graphical library ones. If there is no special thread handling with Tk, I'll investigate my code again.
I'll appreciate any help.
Thank you.
Dendron.
From: David M. <dav...@ho...> - 2007年09月17日 17:12:54
Hi,
=20
I am new to matplotlib.
=20
I am trying to save a sample graph I created as a jpeg image. It seems for=
m the documentation that the type of image can be determined by the extensi=
on that is used. Commands seem simple enough.
=20
ind =3D arange(len(importance_IncNodePurity)) # the x locations for the gro=
ups
width =3D 0.35 # the width of the bars
p1 =3D bar(ind, importance_IncNodePurity, width, color=3D'r')
ylabel('Importance')
title('Importance Node Purity')
xticks(ind+width, importance_row_names)
psave=3D"c:\eclipse\dafaf.jpg"
savefig(psave)
show()
=20
=20
However, I seem to get the following errors and I have no idea what they me=
an.
=20
Traceback (most recent call last):
File "C:\Documents and Settings\dmontgomery\workspace\Test\src\create_table=
.py", line 259, in <module>
savefig(psave)
File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 796, in save=
fig
return fig.savefig(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 759, in sav=
efig
self.canvas.print_figure(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", =
line 188, in print_figure
**kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", li=
ne 493, in print_figure
raise IOError('Do not know know to handle extension *%s' % ext)
IOError: Do not know know to handle extension *.jpg
=20
Thanks,
=20
David=
From: Darren D. <dd...@co...> - 2007年09月17日 17:19:46
On Monday 17 September 2007 01:12:46 pm David Montgomery wrote:
> I am trying to save a sample graph I created as a jpeg image. It seems
> form the documentation that the type of image can be determined by the
> extension that is used. Commands seem simple enough.
>
> ind = arange(len(importance_IncNodePurity)) # the x locations for the
> groups width = 0.35 # the width of the bars
> p1 = bar(ind, importance_IncNodePurity, width, color='r')
> ylabel('Importance')
> title('Importance Node Purity')
> xticks(ind+width, importance_row_names)
> psave="c:\eclipse\dafaf.jpg"
> savefig(psave)
> show()
>
>
> However, I seem to get the following errors and I have no idea what they
> mean.
[...]
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 493, in print_figure raise IOError('Do not know know to handle
> extension *%s' % ext)
> IOError: Do not know know to handle extension *.jpg
It means the Agg library, which we use for rendering, does not know how to 
create jpegs. Can you work with png's instead? They are a much better format 
for plots and line art than jpegs.
Darren
From: <Gio...@ma...> - 2007年10月22日 11:08:04
Dear all,
is there the possiblity in matplolib to buind dendograms ?
I've searched a bit bout found no examples of it it seems not implemented
is there a plan for doing it ?
Thanks in advance for all reply
Giorgio
From: Christiaan P. <cep...@go...> - 2007年12月21日 16:45:39
Hi guys and girls,
Quick question regarding matplotlib's svg backend...
I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having some
problems with .svg files created by matplotlib. Text isn't showing up.
Firefox displays the same .svg file correctly though...
The problem:
It seems some text stuff is stored in a section called defs at the end of
the file with stuff linking to this earlier in the file. Qt doesn't like
that and only displays the normal plot stuff (lines, etc.) but not the
labels and other text.
More exact:
<use xlink:href="#c_7" .....
references
<path id="c_7" d="M10.6875 .....
at the end of the file.
When I simply cut and paste the defs section to the beginning of the file it
solves the problem.
What does the svg standard say about this? I assume Qt's implementation is
defect...
Has anybody else encountered this problem? I'll send an e-mail to Qt too
and ask them about it.
Hope you're all having a nice day.
Regards,
cputter
From: Christiaan P. <cep...@go...> - 2007年12月23日 08:43:54
Hi there,
Just an update regarding the svg problem I was having:
I simply went back to 0.90 and that's working now.
Would still be nice to know if the svg output from matplotlib complies with
the standard or whether it's Qt that's messing things up.
Merry x-mass!
cputter
On 21/12/2007, Christiaan Putter <cep...@go...> wrote:
>
> Hi guys and girls,
>
> Quick question regarding matplotlib's svg backend...
>
> I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having some
> problems with .svg files created by matplotlib. Text isn't showing up.
> Firefox displays the same .svg file correctly though...
>
> The problem:
>
> It seems some text stuff is stored in a section called defs at the end of
> the file with stuff linking to this earlier in the file. Qt doesn't like
> that and only displays the normal plot stuff (lines, etc.) but not the
> labels and other text.
>
> More exact:
>
> <use xlink:href="#c_7" .....
>
> references
>
> <path id="c_7" d="M10.6875 .....
>
> at the end of the file.
>
>
>
> When I simply cut and paste the defs section to the beginning of the file
> it solves the problem.
>
> What does the svg standard say about this? I assume Qt's implementation
> is defect...
>
> Has anybody else encountered this problem? I'll send an e-mail to Qt too
> and ask them about it.
>
> Hope you're all having a nice day.
>
> Regards,
> cputter
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Michael D. <md...@st...> - 2008年01月04日 14:32:12
Between 0.90 and 0.91, the SVG backend was changed to store the glyph 
outlines of the characters in the SVG file itself. (This is on by 
default, but can be turned off with the rc parameter 
svg.embed_char_paths). This helps make the SVG files much more 
portable, as the need to install the math fonts has long been a FAQ on 
this list. I've been doing all my testing with Firefox and Inkscape. 
Is there a simple Qt-based SVG viewer I could add to my testing regimen?
I won't pretend to be an expert on the SVG spec, but it does say this:
<http://www.w3.org/TR/SVG/struct.html#Head>
====
To provide some SVG user agents with an opportunity to implement 
efficient implementations in streaming environments, creators of SVG 
content are encouraged to place all elements which are targets of local 
URI references within a 'defs' element which is a direct child of one of 
the ancestors of the referencing element. For example:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="8cm" height="3cm"
 xmlns="http://www.w3.org/2000/svg">
 <desc>Local URI references within ancestor's 'defs' element.</desc>
 <defs>
 <linearGradient id="Gradient01">
 <stop offset="20%" stop-color="#39F" />
 <stop offset="90%" stop-color="#F3F" />
 </linearGradient>
 </defs>
 <rect x="1cm" y="1cm" width="6cm" height="1cm"
 fill="url(#Gradient01)" />
 <!-- Show outline of canvas using 'rect' element -->
 <rect x=".01cm" y=".01cm" width="7.98cm" height="2.98cm"
 fill="none" stroke="blue" stroke-width=".02cm" />
</svg>
View this example as SVG (SVG-enabled browsers only)
In the document above, the linear gradient is defined within a 'defs' 
element which is the direct child of the 'svg' element, which in turn is 
an ancestor of the 'rect' element which references the linear gradient. 
Thus, the above document conforms to the guideline.
====
So we are complying to that part of the spec. The spec doesn't seem to 
say anything about whether the defs must appear before or after their 
use -- but maybe I just can't find the relevant paragraph.
In any case, this should be easy enough to fix on matplotlib's end, and 
certainly won't break compliance with the spec. I'll have a look, and 
may come back to you for help with testing with Qt if you don't mind.
Cheers,
Mike
Christiaan Putter wrote:
> Hi there,
> 
> Just an update regarding the svg problem I was having:
> 
> I simply went back to 0.90 and that's working now.
> 
> Would still be nice to know if the svg output from matplotlib complies 
> with the standard or whether it's Qt that's messing things up.
> 
> Merry x-mass!
> 
> cputter
> 
> 
> 
> On 21/12/2007, *Christiaan Putter* <cep...@go... 
> <mailto:cep...@go...>> wrote:
> 
> Hi guys and girls,
> 
> Quick question regarding matplotlib's svg backend...
> 
> I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having
> some problems with .svg files created by matplotlib. Text isn't
> showing up. Firefox displays the same .svg file correctly though...
> 
> The problem:
> 
> It seems some text stuff is stored in a section called defs at the
> end of the file with stuff linking to this earlier in the file. Qt
> doesn't like that and only displays the normal plot stuff (lines,
> etc.) but not the labels and other text.
> 
> More exact:
> 
> <use xlink:href="#c_7" .....
> 
> references
> 
> <path id="c_7" d="M10.6875 .....
> 
> at the end of the file.
> 
> 
> 
> When I simply cut and paste the defs section to the beginning of the
> file it solves the problem.
> 
> What does the svg standard say about this? I assume Qt's
> implementation is defect...
> 
> Has anybody else encountered this problem? I'll send an e-mail to
> Qt too and ask them about it.
> 
> Hope you're all having a nice day.
> 
> Regards,
> cputter
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Christiaan P. <cep...@go...> - 2008年01月12日 18:23:48
Hi Michael,
Sorry for getting back to you only now, and thanks for the help.
If you have Qt installed there should be an sample Svg viewer app in the
examples somewhere. If you'd like I can send it to you somehow, just let me
know.
I tested the new .svg you sent me it's rendering the same in Firefox and
Qt. So it works.
Once again thanks for your help and let me know if I can send you something
to help with testing in Qt. Personally I think Qt's support for svg is
still a bit iffy.
Have a nice,
Christiaan
On 04/01/2008, Michael Droettboom <md...@st...> wrote:
>
> Can you please test the attached SVG file?
>
> Cheers,
> Mike
>
> Michael Droettboom wrote:
> > Between 0.90 and 0.91, the SVG backend was changed to store the glyph
> > outlines of the characters in the SVG file itself. (This is on by
> > default, but can be turned off with the rc parameter
> > svg.embed_char_paths). This helps make the SVG files much more
> > portable, as the need to install the math fonts has long been a FAQ on
> > this list. I've been doing all my testing with Firefox and Inkscape.
> > Is there a simple Qt-based SVG viewer I could add to my testing regimen?
> >
> > I won't pretend to be an expert on the SVG spec, but it does say this:
> >
> > <http://www.w3.org/TR/SVG/struct.html#Head>
> >
> > ====
> >
> > To provide some SVG user agents with an opportunity to implement
> > efficient implementations in streaming environments, creators of SVG
> > content are encouraged to place all elements which are targets of local
> > URI references within a 'defs' element which is a direct child of one of
> > the ancestors of the referencing element. For example:
> >
> > <?xml version="1.0" standalone="no"?>
> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> > "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> > <svg width="8cm" height="3cm"
> > xmlns="http://www.w3.org/2000/svg">
> > <desc>Local URI references within ancestor's 'defs' element.</desc>
> > <defs>
> > <linearGradient id="Gradient01">
> > <stop offset="20%" stop-color="#39F" />
> > <stop offset="90%" stop-color="#F3F" />
> > </linearGradient>
> > </defs>
> > <rect x="1cm" y="1cm" width="6cm" height="1cm"
> > fill="url(#Gradient01)" />
> > <!-- Show outline of canvas using 'rect' element -->
> > <rect x=".01cm" y=".01cm" width="7.98cm" height="2.98cm"
> > fill="none" stroke="blue" stroke-width=".02cm" />
> > </svg>
> >
> > View this example as SVG (SVG-enabled browsers only)
> >
> > In the document above, the linear gradient is defined within a 'defs'
> > element which is the direct child of the 'svg' element, which in turn is
> > an ancestor of the 'rect' element which references the linear gradient.
> > Thus, the above document conforms to the guideline.
> >
> > ====
> >
> > So we are complying to that part of the spec. The spec doesn't seem to
> > say anything about whether the defs must appear before or after their
> > use -- but maybe I just can't find the relevant paragraph.
> >
> > In any case, this should be easy enough to fix on matplotlib's end, and
> > certainly won't break compliance with the spec. I'll have a look, and
> > may come back to you for help with testing with Qt if you don't mind.
> >
> > Cheers,
> > Mike
> >
> > Christiaan Putter wrote:
> >> Hi there,
> >>
> >> Just an update regarding the svg problem I was having:
> >>
> >> I simply went back to 0.90 and that's working now.
> >>
> >> Would still be nice to know if the svg output from matplotlib complies
> >> with the standard or whether it's Qt that's messing things up.
> >>
> >> Merry x-mass!
> >>
> >> cputter
> >>
> >>
> >>
> >> On 21/12/2007, *Christiaan Putter* <cep...@go...
> >> <mailto:cep...@go...>> wrote:
> >>
> >> Hi guys and girls,
> >>
> >> Quick question regarding matplotlib's svg backend...
> >>
> >> I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having
> >> some problems with .svg files created by matplotlib. Text isn't
> >> showing up. Firefox displays the same .svg file correctly
> though...
> >>
> >> The problem:
> >>
> >> It seems some text stuff is stored in a section called defs at the
> >> end of the file with stuff linking to this earlier in the file. Qt
> >> doesn't like that and only displays the normal plot stuff (lines,
> >> etc.) but not the labels and other text.
> >>
> >> More exact:
> >>
> >> <use xlink:href="#c_7" .....
> >>
> >> references
> >>
> >> <path id="c_7" d="M10.6875 .....
> >>
> >> at the end of the file.
> >>
> >>
> >>
> >> When I simply cut and paste the defs section to the beginning of
> the
> >> file it solves the problem.
> >>
> >> What does the svg standard say about this? I assume Qt's
> >> implementation is defect...
> >>
> >> Has anybody else encountered this problem? I'll send an e-mail to
> >> Qt too and ask them about it.
> >>
> >> Hope you're all having a nice day.
> >>
> >> Regards,
> >> cputter
> >>
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> <mailto:Mat...@li...>
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >>
> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
From: Michael D. <md...@st...> - 2008年01月14日 13:18:54
I've committed these changes to matplotlib SVN, and it should make it 
into the next release of 0.91.x, if we decide to make one.
You may be right that Qt's SVG support is iffy (I don't know enough 
about the spec to be sure, so I'm not conceding that), but either way it 
doesn't bother me to make changes that help SVG work in more places. 
It's like all those pragmatic web developers who have to make things 
work with IE...
Thanks for your help. I'll try to get the Qt SVG demo installed here so 
I can test with that the next time our SVG code changes.
Cheers,
Mike
Christiaan Putter wrote:
> Hi Michael,
> 
> Sorry for getting back to you only now, and thanks for the help.
> 
> If you have Qt installed there should be an sample Svg viewer app in the 
> examples somewhere. If you'd like I can send it to you somehow, just 
> let me know.
> 
> I tested the new .svg you sent me it's rendering the same in Firefox and 
> Qt. So it works.
> 
> Once again thanks for your help and let me know if I can send you 
> something to help with testing in Qt. Personally I think Qt's support 
> for svg is still a bit iffy.
> 
> Have a nice,
> 
> Christiaan
> 
> On 04/01/2008, *Michael Droettboom* <md...@st... 
> <mailto:md...@st...>> wrote:
> 
> Can you please test the attached SVG file?
> 
> Cheers,
> Mike
> 
> Michael Droettboom wrote:
> > Between 0.90 and 0.91, the SVG backend was changed to store the glyph
> > outlines of the characters in the SVG file itself. (This is on by
> > default, but can be turned off with the rc parameter
> > svg.embed_char_paths). This helps make the SVG files much more
> > portable, as the need to install the math fonts has long been a
> FAQ on
> > this list. I've been doing all my testing with Firefox and
> Inkscape.
> > Is there a simple Qt-based SVG viewer I could add to my testing
> regimen?
> >
> > I won't pretend to be an expert on the SVG spec, but it does say
> this:
> >
> > < http://www.w3.org/TR/SVG/struct.html#Head>
> >
> > ====
> >
> > To provide some SVG user agents with an opportunity to implement
> > efficient implementations in streaming environments, creators of SVG
> > content are encouraged to place all elements which are targets of
> local
> > URI references within a 'defs' element which is a direct child of
> one of
> > the ancestors of the referencing element. For example:
> >
> > <?xml version="1.0" standalone="no"?>
> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> > " http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> > <svg width="8cm" height="3cm"
> > xmlns="http://www.w3.org/2000/svg">
> > <desc>Local URI references within ancestor's 'defs'
> element.</desc>
> > <defs>
> > <linearGradient id="Gradient01">
> > <stop offset="20%" stop-color="#39F" />
> > <stop offset="90%" stop-color="#F3F" />
> > </linearGradient>
> > </defs>
> > <rect x="1cm" y="1cm" width="6cm" height="1cm"
> > fill="url(#Gradient01)" />
> > <!-- Show outline of canvas using 'rect' element -->
> > <rect x=".01cm" y=".01cm" width="7.98cm" height=" 2.98cm"
> > fill="none" stroke="blue" stroke-width=".02cm" />
> > </svg>
> >
> > View this example as SVG (SVG-enabled browsers only)
> >
> > In the document above, the linear gradient is defined within a
> 'defs'
> > element which is the direct child of the 'svg' element, which in
> turn is
> > an ancestor of the 'rect' element which references the linear
> gradient.
> > Thus, the above document conforms to the guideline.
> >
> > ====
> >
> > So we are complying to that part of the spec. The spec doesn't
> seem to
> > say anything about whether the defs must appear before or after their
> > use -- but maybe I just can't find the relevant paragraph.
> >
> > In any case, this should be easy enough to fix on matplotlib's
> end, and
> > certainly won't break compliance with the spec. I'll have a
> look, and
> > may come back to you for help with testing with Qt if you don't
> mind.
> >
> > Cheers,
> > Mike
> >
> > Christiaan Putter wrote:
> >> Hi there,
> >>
> >> Just an update regarding the svg problem I was having:
> >>
> >> I simply went back to 0.90 and that's working now.
> >>
> >> Would still be nice to know if the svg output from matplotlib
> complies
> >> with the standard or whether it's Qt that's messing things up.
> >>
> >> Merry x-mass!
> >>
> >> cputter
> >>
> >>
> >>
> >> On 21/12/2007, *Christiaan Putter* <cep...@go...
> <mailto:cep...@go...>
> >> <mailto: cep...@go...
> <mailto:cep...@go...>>> wrote:
> >>
> >> Hi guys and girls,
> >>
> >> Quick question regarding matplotlib's svg backend...
> >>
> >> I've embeded pyhton into c++ and Qt's (4.3.3) svg support is
> having
> >> some problems with .svg files created by matplotlib. Text isn't
> >> showing up. Firefox displays the same .svg file correctly
> though...
> >>
> >> The problem:
> >>
> >> It seems some text stuff is stored in a section called defs
> at the
> >> end of the file with stuff linking to this earlier in the
> file. Qt
> >> doesn't like that and only displays the normal plot stuff
> (lines,
> >> etc.) but not the labels and other text.
> >>
> >> More exact:
> >>
> >> <use xlink:href="#c_7" .....
> >>
> >> references
> >>
> >> <path id="c_7" d="M10.6875 .....
> >>
> >> at the end of the file.
> >>
> >>
> >>
> >> When I simply cut and paste the defs section to the
> beginning of the
> >> file it solves the problem.
> >>
> >> What does the svg standard say about this? I assume Qt's
> >> implementation is defect...
> >>
> >> Has anybody else encountered this problem? I'll send an
> e-mail to
> >> Qt too and ask them about it.
> >>
> >> Hope you're all having a nice day.
> >>
> >> Regards,
> >> cputter
> >>
> >>
> >>
> >> 
> -------------------------------------------------------------------------
> 
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> <http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/>
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> <mailto:Mat...@li...>
> >> <mailto:Mat...@li...
> <mailto:Mat...@li...>>
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >>
> -------------------------------------------------------------------------
> 
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> <http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/>
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> <mailto:Mat...@li...>
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> >
> 
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: andy yu <yc...@ho...> - 2008年08月28日 05:28:41
Hello, I am trying to construct a plot that is a barchartwith the X-axis being dates. I have used the plot_dates
to generated line plots that look great, however, I cannotfigure out a way to do a barchart with dates as theXaxis.Has anyone done one of these
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE 
1 2 3 > >> (Page 1 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 によって変換されたページ (->オリジナル) /