On Nov 16, 2007 9:23 AM, John Hunter <jdh2358@...> wrote:
> On Nov 15, 2007 10:42 PM, C M <cmpython@...> wrote:
> > sorry, the last email did not get the pic attached. retrying, and text
> > recopied below:
> > ----------------------------------------------
> > Using Python 2.5, wxPython 184.108.40.206 (msw-unicode) matplotlib 0.90.1
> > on winXP. I have two questions:
> > 1) I have a small working app that produces a matplotlib plot.
> > This is a plot embedded in wxPython (it's not using Pylab).
> > When it is run as a python script, it looks fine. However, after
> > packaging it into an .exe with py2exe (using GUI2Exe to do that),
> > the font and size of the axes are different: smaller, and now in
> > italics. See attached picture. I also get the errors:
> > C:\mycode\dist\myapp.exe\matplotlib\__init__.py:948: UserWarning: Could
> > find matplotlibrc; using defaults
> > C:\mycode\dist\myapp.exe\matplotlib\__init__.py:999: UserWarning: could
> > find rc file; returning defaults
> > I did include in the data files this folder:
> > C:\Python25\Lib\site-packages\matplotlib\mpl-data\back.png
> > and in the Python packages I included:
> > pytz
> > matplotlib.numerix
> > 2) I thought that was the only error, but now I also see that, in
> > either case (as a python script or as a .exe file), each time I
> > resize the window, and the plot resizes (it is in a wxPython
> > sizer), the color of the data line changes randomly! It starts
> > blue, and then as I resize it it can be green, red, whatever.
> > In the picture attached, with resizing they've wound up different
> > colors, though they both started blue as they should have.
> My guess is that you are calling plot in an event handler that is
> triggered by a resize, and are seeing mpl's color cycler. As for the
> fonts, it looks like whatever fonts are being picked up by default
> (outside of py2exe) are not being packaged by py2exe. Make sure all
> the fonts in site-pacakges/matplotlib/mpl-data are being picked up by
> py2exe. In general, as long as py2exe is picking up all of mpl-data,
> I don't see why you would have trouble with fonts, your rc file, or
> your icons (eg back.png). Of course, w/o seeing any code or setup
> files this is just a wild guess.
The font problem turned out to be simply that I didn't realize that the
latest version of matplotlib comes with the matplotlibrc file commented out
(I had not tried to change fonts before so hadn't noticed I couldn't).
Uncommented the fonts section solved it. Thanks for the tip.
Is there a way to disable color cycling?