Hi Darren,

On Wed, Feb 27, 2008 at 09:24:18AM -0500, Darren Dale wrote:
> I don't see the problem here with either 0.91.2, the maintanance branch, or 
> the development branch. Maybe I dont know what I am looking for. Could you 
> please send me an eps and png example so I can compare my results with yours? 

Thanks for having a look.  I append a slightly modified version of the
script and output files "out.ps", "out.eps" and "out.png".  The files
are created using the calls

    ./broken.py ps
    ./broken.py eps
    ./broken.py png

out.ps - new failure mode: too small picture (shows only the pixel data)
out.eps - shifted as before
out.png - this looks ok.

Many thanks,
Jochen
-- 
http://seehuhn.de/
#! /usr/bin/env python

from sys import argv
if len(argv)>1 and argv[1] in ["ps", "eps"]:
    import matplotlib
    matplotlib.use("PS")
    outfile="out."+argv[1]
else:
    import matplotlib
    matplotlib.use("Agg")
    outfile="out."+argv[1]
from pylab import *

def create_hist():
    X = array([-3.3, -3.0, -2.7 ])
    Y = array([-0.3, -0.0, 0.3 ])
    hist = array([[ 0.2, 0.4 ], [ 0.6, 0.8 ]])
    return X, Y, hist

def generate_figure(fname, X, Y, hist, stamp=None):
    width = 4.5
    height = 1.6
    margin = 0.05
    padding = 0.05

    x0 = -3.3
    x1 = 4.0
    q = (x1-x0)/(width - 2*margin - 2*padding)
    y0 = -0.3
    y1 = y0 + (height - 2*margin - 2*padding)*q

    # create an appropriately sized figure
    rc('text', usetex=True)
    rc('font', family="serif", serif="Times", size=12.0)
    rc('xtick', labelsize=12)
    rc('ytick', labelsize=12)
    rc('figure.subplot', left=margin/width)
    rc('figure.subplot', right=(width-margin)/width)
    rc('figure.subplot', bottom=margin/height)
    rc('figure.subplot', top=(height-margin)/height)
    fig = figure(figsize=(width, height))
    ax = axes([margin/width, margin/height,
               (width-2*margin)/width, (height-2*margin)/height])
    p = q*padding

    # plot the density data
    mycmdata = {
        'red': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
        'green': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
        'blue': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
    }
    mycm = matplotlib.colors.LinearSegmentedColormap('mycm',  mycmdata)
    pcolor(X, Y, hist, cmap=mycm, shading='flat')

    # plot the corner
    plot([x0, x0, x1], [y1, y0, y0], "k-")
    plot([x0+0.6, x0+0.6, x1], [y1, y0+0.6, y0+0.6], "k-")

    # place the stamp
    if stamp is not None:
        text(x1-p, y1-p, stamp, va='top', ha='right')

    # save the result
    axis([x0-p, x1+p, y0-p, y1+p])
    axis("off")
    savefig(fname, facecolor="yellow")

X, Y, hist = create_hist()
generate_figure(outfile, X, Y, hist, "$t=1$")

Attachment: out.ps
Description: PostScript document

Attachment: out.eps
Description: PostScript document

<<attachment: out.png>>

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to