[Matplotlib-users] ytick fontsize for exponentials

2007-11-28 Thread Jesper Larsen
Hi matplotlib users

I am trying to fit a substantial number of subplots into a single plot.
I would therefore like to reduce the font size of my x- and yticks. Some
of the plots contain very large numbers on the y-axis. Using the default
formatting this means that the exponential will be written above the
plot. When the font size of the y-axis is reduced the font size of the
exponential above the plot is not reduced as shown in the example code
below:

import pylab

pylab.figure()
x = [1, 2, 3]
y = [1e13, 2e13, 3e13]
pylab.plot(x,y)
pylab.xticks(fontsize=6)
pylab.yticks(fontsize=6)
pylab.savefig('test.png')

Has anyone got any suggestions on how to reduce the font size of the
exponential as well or is this a bug in matplotlib?

- Jesper

-- 
Jesper Larsen, Ph.D.
Scientist
National Environmental Research Institute 
University of Aarhus
Department of Marine Ecology 
Frederiksborgvej 399 
DK-4000 Roskilde 
Denmark 
tel: +45 46301866
http://www.neri.dk


-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Wanted: recommendations on embedding matplotlib in a wxPython application

2007-11-28 Thread Ryan Krauss
I may be jumping into this conversation way too late, but I really
like wxmpl.  The one bell and whistle that I love is the
click-and-drag box zoom available by default.  Attached is my hacked
together simple example of putting a wxmpl.PlotPanel on a wx.notebook.

Ryan

On Nov 27, 2007 11:06 AM, C M [EMAIL PROTECTED] wrote:



 On Nov 27, 2007 11:27 AM, Rich Shepard [EMAIL PROTECTED] wrote:
 
  On Mon, 26 Nov 2007, C M wrote:
 
 
   Basically what I did (sorry if this is too basic, but I'm pretty new to
   this and this may jog others to correct deficiencies in this simple
   approach) was to:
 
This is all straightforward and clear. The one statement I've not yet
  understood is this:
 
 
  self.graph = matplotFrame3.PlotPanel(self.panel1 ,xpoints,
 ypoints)
 
I assume that matplotFrame3 is the name of the module in which you've
  written PlotPanel(). Is this assumption correct?
 

 Exactly. That is the module which I mention importing in step 4.

 
I'm modifying your approach to suit our application but it seems to be
 the
  most parsimonious and elegant solution for simple display of plots in a
  wxPython panel.
 
  Thanks,
 
 
 
 
  Glad it will help your application.


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


#!/usr/bin/env python

import wx

from wxmpl import PlotPanel

from scipy import *

class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title,
  pos=(150, 150), size=(650, 700))
# Create the menubar
menuBar = wx.MenuBar()

# and a menu 
menu = wx.Menu()

# add an item to the menu, using \tKeyName automatically
# creates an accelerator, the third param is some help text
# that will show up in the statusbar
menu.Append(wx.ID_EXIT, Exit\tAlt-X, Exit the application)

# bind the menu event to an event handler
self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT)

# and put the menu on the menubar
menuBar.Append(menu, File)
self.SetMenuBar(menuBar)

#create the notebook
self.notebook = wx.Notebook(self, -1, style=0)

#create the first pane for the notebook
self.notebook_pane_1 = wx.Panel(self.notebook, -1)

#create the sizer for the first pane
grid_sizer = wx.FlexGridSizer(2, 1, 0, 0)

#create widgets for pane one
self.PlotPanel = PlotPanel(self.notebook_pane_1, -1)
self.button_1 = wx.Button(self.notebook_pane_1, -1, button_1)

#add the widgets to pane one's sizer
grid_sizer.Add(self.PlotPanel, 0, 0, 0)
grid_sizer.Add(self.button_1, 0, 0, 0)

self.notebook_pane_1.SetSizer(grid_sizer)

grid_sizer.AddGrowableCol(0)
grid_sizer.AddGrowableRow(0)
#Add pane one to the notebook
self.notebook.AddPage(self.notebook_pane_1, tab1)

#create the sizer for the main frame
mainsizer = wx.BoxSizer(wx.VERTICAL)
#add the notebook to the sizer
mainsizer.Add(self.notebook, 1, wx.EXPAND, 0)

self.SetSizer(mainsizer)
mainsizer.Fit(self)
self.Layout()
self.InitialPlot()


def InitialPlot(self):
fig = self.PlotPanel.get_figure()
ax = fig.add_subplot(111)
ax.cla()
t = arange(0,1,0.01)
y = sin(2*pi*t)
x = cos(4*pi*t)
ax.plot(t,y,t,x)
ax.set_xlabel('Time (sec)')
ax.set_ylabel('$y(t)$')


def OnTimeToClose(self, evt):
Event handler for the button click.
print See ya later!
self.Close()


class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, Simple wxmpl embedding example)
self.SetTopWindow(frame)

#print Print statements go to this stdout window by default.

frame.Show(True)
return True


if __name__ == __main__:
app = MyApp(redirect=False)
app.MainLoop()
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] wxmpl: Can't create printer PDF because the id PDF is already used

2007-11-28 Thread Ryan Krauss
I just created a small wxmpl example that I really like (attached),
but when I run it, I get these error messages:

** (python:18091): WARNING **: Can't create printer PDF because the
id PDF is already used

(python:18091): GnomePrintCupsPlugin-WARNING **: The CUPS printer PDF
could not be created


(python:18091): GnomePrintCupsPlugin-WARNING **: The data for the CUPS
printer PDF could not be loaded.


I don't know if this is wxmpl specific, caused by wxPython, or caused
by matplotlib, but I would like to make it go away.  Any thoughts?

Thanks,

Ryan
#!/usr/bin/env python

import wx

from wxmpl import PlotPanel

from scipy import *

class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title,
  pos=(150, 150), size=(650, 700))
# Create the menubar
menuBar = wx.MenuBar()

# and a menu 
menu = wx.Menu()

# add an item to the menu, using \tKeyName automatically
# creates an accelerator, the third param is some help text
# that will show up in the statusbar
menu.Append(wx.ID_EXIT, Exit\tAlt-X, Exit the application)

# bind the menu event to an event handler
self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT)

# and put the menu on the menubar
menuBar.Append(menu, File)
self.SetMenuBar(menuBar)

#create the notebook
self.notebook = wx.Notebook(self, -1, style=0)

#create the first pane for the notebook
self.notebook_pane_1 = wx.Panel(self.notebook, -1)

#create the sizer for the first pane
grid_sizer = wx.FlexGridSizer(2, 1, 0, 0)

#create widgets for pane one
self.PlotPanel = PlotPanel(self.notebook_pane_1, -1)
self.button_1 = wx.Button(self.notebook_pane_1, -1, button_1)

#add the widgets to pane one's sizer
grid_sizer.Add(self.PlotPanel, 0, 0, 0)
grid_sizer.Add(self.button_1, 0, 0, 0)

self.notebook_pane_1.SetSizer(grid_sizer)

grid_sizer.AddGrowableCol(0)
grid_sizer.AddGrowableRow(0)
#Add pane one to the notebook
self.notebook.AddPage(self.notebook_pane_1, tab1)

#create the sizer for the main frame
mainsizer = wx.BoxSizer(wx.VERTICAL)
#add the notebook to the sizer
mainsizer.Add(self.notebook, 1, wx.EXPAND, 0)

self.SetSizer(mainsizer)
mainsizer.Fit(self)
self.Layout()
self.InitialPlot()


def InitialPlot(self):
fig = self.PlotPanel.get_figure()
ax = fig.add_subplot(111)
ax.cla()
t = arange(0,1,0.01)
y = sin(2*pi*t)
x = cos(4*pi*t)
ax.plot(t,y,t,x)
ax.set_xlabel('Time (sec)')
ax.set_ylabel('$y(t)$')


def OnTimeToClose(self, evt):
Event handler for the button click.
print See ya later!
self.Close()


class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, Simple wxmpl embedding example)
self.SetTopWindow(frame)

#print Print statements go to this stdout window by default.

frame.Show(True)
return True


if __name__ == __main__:
app = MyApp(redirect=False)
app.MainLoop()
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users