Printing problems with "WXAgg" on Linux

I have developed a plotter software using “WXAgg”. ( matplotlib 0.90.1)

It works fine on Windows, but I found some problems on Linux about printing.

Printing problems on Red Hat Linux 5 or Fedra Core 6

  1. You cannot set orientation to LANDSCAPE, it seems “SetOrientation” does not work.

  2. When you set LANDSCAPE manually, only lower half part will be printed.

  3. Printing quality is far much worse than Windows’s printing.

Please try my simple sample program as below.

Noriko Minakawa

···

import wx
import os
import matplotlib
matplotlib.use(‘WXAgg’)
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from matplotlib.figure import Figure
import matplotlib.numerix as numpy

class PlotFrame(wx.Frame):

def __init__(self):
    wx.Frame.__init__(self, None, -1, "Test Printing with WX Backend")
    self.fig   = Figure(None, 100)
    self.canvas= FigCanvas(self, -1, self.fig)
    self.axes  = self.fig.add_axes([0.15,0.15,0.75,0.75])
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
    self.Fit()
    self.Plot_Data()
   
def Print_Data(self):    
    self.canvas.printerData.SetPaperId(wx.PAPER_A4)
    self.canvas.printerData.SetOrientation(wx.LANDSCAPE)
    dpi = self.canvas.figure.dpi.get()
    self.canvas.figure.dpi.set(200)
    self.canvas.Printer_Print()
    self.canvas.figure.dpi.set(dpi)
    self.canvas.draw()

def Plot_Data(self):
    t = numpy.arange(0.0,5.0,0.01)
    s = numpy.sin(2.0*numpy.pi*t)
    c = numpy.cos(0.4*numpy.pi*t)
    self.axes.plot(t,s)
    self.axes.plot(t,c)

if name == ‘main’:
app = wx.PySimpleApp()
fig = PlotFrame()
fig.Show(True)
fig.Print_Data()
app.MainLoop()