Re: [Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
Hi Darren,
I have updated from svn and tried to run the code. It is not working, but,
the failures have nothing to do with texmanager.py. I'm getting some of our
codes failing from within one of our __init__.py files (my guess is a naming
conflict). And some more codes failing with:
File
"/home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/axes.py",
line 263, in _xy_from_xy
assert nrx == nry, 'Dimensions of x and y are incompatible'
AssertionError: Dimensions of x and y are incompatible
I also get:
/home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/__init__.py:801:
UserWarning: This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
at the top of all of our plotting routine outputs now.
This sounds like we have bugs in our code, which we need to deal with before
we can upgrade our numpy and matplotlib versions. Because of time
restraints, it is likely that upgrading of these modules on our systems will
not happen for a few months. Using MPLCONFIGDIR should stop most of our
failures anyway, I guess we can solve the rest by automatically retrying
failed jobs.
Thanks for the help
Ian
2008/7/17 Darren Dale <[EMAIL PROTECTED]>:
> On Wednesday 16 July 2008 07:20:59 am Ian Harry wrote:
> > [EMAIL PROTECTED] 07:14 AM matplotlib]$ diff texmanager.py
> > /usr/lib64/python2.4/site-packages/matplotlib/texmanager.py
> > 248c248
> > < fh = file(outfile,'a')
> > ---
> >
> > > fh = file(outfile)
> >
> > 252,254c252
> > < else:
> > < try: verbose.report(fh.read(), 'debug')
> > < except: pass
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > 259,261c257,258
> > < else:
> > < try: os.remove(fname)
> > < except: pass
> > ---
> >
> > > else: os.remove(fname)
> >
> > 280c277
> > < fh = file(outfile,'a')
> > ---
> >
> > > fh = file(outfile)
> >
> > 285,287c282
> > < else:
> > < try: verbose.report(fh.read(), 'debug')
> > < except: pass
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > 289,290c284
> > < try: os.remove(outfile)
> > < except: pass
> > ---
> >
> > > os.remove(outfile)
> >
> > 314c308
> > < # else: verbose.report(fh.read(), 'debug')
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > --snip--
>
> I took a different approach:
>
> Index: lib/matplotlib/texmanager.py
> ===
> --- lib/matplotlib/texmanager.py(revision 5771)
> +++ lib/matplotlib/texmanager.py(working copy)
> @@ -273,16 +273,22 @@
> %(os.path.split(texfile)[-1], outfile))
> mpl.verbose.report(command, 'debug')
> exit_status = os.system(command)
> -fh = file(outfile)
> +try:
> +fh = file(outfile)
> +report = fh.read()
> +fh.close()
> +except IOError:
> +report = 'No latex error report available.'
> if exit_status:
> raise RuntimeError(('LaTeX was not able to process the
> following \
> -string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex))
> +
> fh.read())
> -else: mpl.verbose.report(fh.read(), 'debug')
> -fh.close()
> +string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex))
> +
> report)
> +else: mpl.verbose.report(report, 'debug')
> for fname in glob.glob(basefile+'*'):
> if fname.endswith('dvi'): pass
> elif fname.endswith('tex'): pass
> -else: os.remove(fname)
> +else:
> +try: os.remove(fname)
> +except OSError: pass
>
> return dvifile
>
> @@ -305,14 +311,19 @@
> os.path.split(dvifile)[-1], outfile))
> mpl.verbose.report(command, 'debug')
> exit_status = os.system(command)
> -fh = file(outfile)
> +try:
> +fh = file(outfile)
> +report = fh.read()
> +fh.close()
> +except IOError:
> +report = 'No dvipng error report available.'
> if exit_status:
> raise RuntimeError('dvipng was not able to \
> process the flowing file:\n%s\nHere is the full report generated by
> dvipng: \
> -\n\n'% dvifile + fh.read())
> -else: mpl.verbose.report(fh.read(), 'debug')
> -fh.close()
> -os.remove(outfile)
> +\n\n'% dvifile + report)
> +else: mpl.verbose.report(report, 'd
Re: [Matplotlib-users] Error when running multiple jobs utilizing the Tex utilities in matplotlib
On Fri, Jul 18, 2008 at 6:12 AM, Ian Harry <[EMAIL PROTECTED]> wrote:
> Hi Darren,
> /home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/__init__.py:801:
> UserWarning: This call to matplotlib.use() has no effect
> because the the backend has already been chosen;
> matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
> or matplotlib.backends is imported for the first time.
>
> at the top of all of our plotting routine outputs now.
>
> This sounds like we have bugs in our code, which we need to deal with before
> we can upgrade our numpy and matplotlib versions. Because of time
> restraints, it is likely that upgrading of these modules on our systems will
> not happen for a few months. Using MPLCONFIGDIR should stop most of our
> failures anyway, I guess we can solve the rest by automatically retrying
> failed jobs.
>
For your own sake, this use bug should be fixed because it means mpl
is not doing what you think. The backend needs to be set before pylab
is imported. The two main ways to set the backend are in the rc file
and with the use directive. If you do the latter, make sure you put
import matplotlib
matplotlib.use('YourBackend')
near the top of your main driver code, before you import pylab or any
other modules which import it. You should also do this only in one
place in your code. If you try and do it after you import pylab, and
your backend is already set to something else from your rc files, your
code will break .
JDH
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] scatter() / plot() alignment
I am trying to plot some 2D scatter plot data where: * the points have a colormap * some points have larger, colored circles on them * some points have a dark ring around them I have managed to get this functionality to work by using both the scatter() and plot() commands. My problem is that the dark rings printed by the plot() command do not line up with the circles of the scatter() command. (Example file below). My question is this: * Is there a way to set an offset for one of these plotting methods so that they line up properly? Setting it in the X/Y data will not work because it will not be scale independent. * Or is there a way to use only one plotting method? I can't seem to get plot() to draw different colors, and I can't get scatter() to draw a wide ring. Thanks, -Ben from pylab import * N = 30 x = 0.9*rand(N) y = 0.9*rand(N) z = 0.9*rand(N) w = 0.9*rand(N) scatter(x, y, c=z) scatter(x[:10], y[:10], s=120, c=w[:10], marker='o', alpha=0.4) plot(x[5:15], y[5:15], 'o', markersize=15, markeredgecolor='k', markeredgewidth=2, markerfacecolor='none') show() - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Scatter plots with date axes
With the following snippet, I expect a vertical line from y=(0, 2) and squares at y=(4, 5, 6) at the specified time. No squares appear with the call to scatter, even though the y axis limits adjust to (0,7) as if something is being plotted. Is this a known limitation of scatter? I'm running the following under ipython -pylab. from datetime import datetime f=figure() ax=f.add_subplot(111) d=datetime(2004,05,26,23,00,00) d=date2num(d) ax.xaxis_date() ax.plot((d,d,d),range(3)) # vertical line ax.scatter((d,d,d),(4,5,6),marker='s') # no symbols plotted draw() Thanks, Eric - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
