Matplotlib-users Digest, Vol 51, Issue 24

Jouni, I think you're right.
If I run LaTeX from the command line I get the error message:
warning: Could not open char translation file `cp8bit.tcx'.
This is e-TeX, Version 3.141592-2.1 (Web2C 7.5.2)
kpathsea: Running mktexfmt latex.efmt
fmtutil: unknown format type: latex.efmt.
I can't find the format file `latex.efmt'!

But if I run it from TeXShop it runs perfectly:
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009)
  \write18 enabled.
entering extended mode


~ Harry$ which latex

I don't know whether this is the right forum, but could you tell me how to fix this? I'm running OS X 10.6.4.



On 8/12/10 4:37 PM, wrote:

Send Matplotlib-users mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
  matplotlib-users List Signup and Options
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Matplotlib-users digest..."

Today's Topics:

    1. PNG without transparency (Miha Tom?i?)
    2. TeX not working with Matplotlib (Harry Boer)
    3. Re: TeX not working with Matplotlib (Jouni Sepp?nen)
    4. Re: Hints on sizing plot elements? (Tony S Yu)


Message: 1
Date: Thu, 12 Aug 2010 08:56:06 +0200
From: Miha Tom?i?<miha.tomsic@...287...>
Subject: [Matplotlib-users] PNG without transparency
Content-Type: text/plain; charset="iso-8859-1"


I am having trouble saving figures to PNG with Agg backend. The problem is I
can't get a PNG without transparency even if I specify:

fig.savefig("colorAgg.png", dpi=300, transparent=False)

identify still indicates there is a 1-bit aplha channel present:

Image: colorAgg.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 390x300+0+0
  Resolution: 118.11x118.11
  Print size: 3.30201x2.54001
  Units: PixelsPerCentimeter
  Type: TrueColorMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
  Channel statistics:
      min: 0 (0)
      max: 255 (1)
      mean: 192.918 (0.756542)
      standard deviation: 96.4001 (0.37804)
      min: 0 (0)
      max: 255 (1)
      mean: 189.457 (0.74297)
      standard deviation: 98.0884 (0.38466)
      min: 0 (0)
      max: 255 (1)
      mean: 177.814 (0.697309)
      standard deviation: 107.593 (0.421932)
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
     75477: (255,255,255, 0) #FFFFFF white
      8184: ( 9,106, 37, 0) #096A25 rgb(9,106,37)
      8119: (113,170, 76, 0) #71AA4C rgb(113,170,76)
      8119: (204, 0, 0, 0) #CC0000 rgb(204,0,0)
      6655: ( 0, 0, 0, 0) #000000 black
      3466: ( 1, 1, 1, 0) #010101 rgb(1,1,1)
      2482: (106,106,106, 0) #6A6A6A rgb(106,106,106)
       287: ( 3, 44, 15, 0) #032C0F rgb(3,44,15)
       285: ( 47, 71, 31, 0) #2F471F rgb(47,71,31)
       285: ( 85, 0, 0, 0) #550000 rgb(85,0,0)
       215: ( 2, 2, 2, 0) #020202 rgb(2,2,2)
       196: (116,116,116, 0) #747474 rgb(116,116,116)

This is not a big deal but there si a problem when I insert this PNGs in PDF
and there si a RGB/CMYK conversion on every page that contains transparent

How can I get rid of the aplha channel completely? How do I tell the backend
to work (or at least save) in pure RGB not in RGBA color space?

Thanks and take care,
-------------- next part --------------
An HTML attachment was scrubbed...


Message: 2
Date: Thu, 12 Aug 2010 09:46:41 +0200
From: Harry Boer<h.boer@...3236...>
Subject: [Matplotlib-users] TeX not working with Matplotlib
Content-Type: text/plain; charset="iso-8859-1"

   Hi there,

I'm trying to render text with LaTeX using the example on page 53 of the
Matplotlib tutorial; see source code and output below.
It's not working. divipng, (latest)Ghostscript, and LaTeX are all
installed; their executables
in my PATH. Matplotlib is working flawlessly. Help is appreciated.
Thanks, Harry

GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson


from matplotlib import rc
from numpy import arange, cos, pi
from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
       grid, savefig, show

rc('text', usetex=True)
rc('font', family='serif')
figure(1, figsize=(6,4))
ax = axes([0.1, 0.1, 0.8, 0.7])
t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)+2
plot(t, s)

xlabel(r'\textbf{time (s)}')
ylabel(r'\textit{voltage (mV)}',fontsize=16)
title(r"\TeX\ is Number
        fontsize=16, color='r')



warning: Could not open char translation file `cp8bit.tcx'.
kpathsea: Running mktexfmt latex.efmt
fmtutil: unknown format type: latex.efmt.
Traceback (most recent call last):
    File "", line 34, in<module>
line 356, in savefig
      return fig.savefig(*args, **kwargs)
line 1032, in savefig
      self.canvas.print_figure(*args, **kwargs)
    --------AND A LOT OF MORE OUTPUT LIKE THE ABOVE--------------
      string:\n%s\nHere is the full report generated by LaTeX: \n\n'%
repr(tex)) + report)
RuntimeError: LaTeX was not able to process the following string:
Here is the full report generated by LaTeX:

This is e-TeX, Version 3.141592-2.1 (Web2C 7.5.2)
I can't find the format file `latex.efmt'!

-------------- next part --------------
An HTML attachment was scrubbed...


Message: 3
Date: Thu, 12 Aug 2010 10:41:41 +0000 (UTC)
From: Jouni Sepp?nen<jks@...397...>
Subject: Re: [Matplotlib-users] TeX not working with Matplotlib
Content-Type: text/plain; charset=utf-8

Harry Boer<h.boer@...83...> writes:

         kpathsea: Running mktexfmt latex.efmt
         fmtutil: unknown format type: latex.efmt.

Sounds like your LaTeX installation is broken. Can you run latex by hand? Is it
the same binary that matplotlib ends up calling?

Jouni Sepp?nen


Message: 4
Date: Thu, 12 Aug 2010 10:37:10 -0400
From: Tony S Yu<tsyu80@...287...>
Subject: Re: [Matplotlib-users] Hints on sizing plot elements?
To: Russell E. Owen<rowen@...2756...>
Content-Type: text/plain; charset="us-ascii"

On Aug 12, 2010, at 1:08 AM, Russell E. Owen wrote:

I'm making a strip chart widget (which I plan to make publicly available
when finished). The basics are working fine, but the automatic sizing is
not doing so well. Strip charts are typically short, and when suitably
short the X axis annotations are partially truncated.

So...can I convince the automatic sizer to always show the full X (time)
axis annotations and put all the variable sizing into the data area? Or
do I have to manually set them somehow?

As far as I know, there's nothing to automatically resize the padding around the the axes. (The manual way to do it is to call `fig.subplots_adjust`). I wrote a helper script (attached below) to adjust the layout so that there's a specified amount of padding around the axes.

Unfortunately, this resizer doesn't function correctly when using the GTK backend. It apparently works fine with TkAgg, MacOSX, and Qt4Agg backends.

Also, is there a way from my software (not a .matplotlibrc file) to
globally make the default background color white for axis annotation
areas? Right now the background is gray for annotations and while for
plot area and I'd prefer it was all white.

-- Russell

Just set plt.rc('figure', facecolor='w') in your code (assuming you've imported matplotlib.pyplot as plt).


-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-python-script
Size: 6017 bytes
Desc: not available
-------------- next part --------------

Usage note: Since it sounds like you're not creating subplots, you can just use the `tight_borders` function, instead of the `tight_layout` function; the later requires two redraws while the first requires only one.


This email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge


Matplotlib-users mailing list
matplotlib-users List Signup and Options

End of Matplotlib-users Digest, Vol 51, Issue 24