displaying plain data without fancy features (wx)

Hello,

I am trying to display an array with imshow(), however I want to 'turn off'
display of axes, numbers, and all that extra stuff which comes with it. I
want only my array(grayscale image) to be shown

···

###########################

import wx
import matplotlib
matplotlib.use( 'WXAgg' )
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure

class Frame1(wx.Frame):
   def __init__(self, parent):
       wx.Frame.__init__(self,None)
       self.panel1 = wx.Panel(self)
       self.Add_MPL_Plot()

   def Add_MPL_Plot(self):
       figure = Figure(None, 80)
       canvas = FigureCanvasWxAgg(self.panel1, -1, figure)
       canvas.SetSize(wx.Size(300,300))
       subplot = figure.add_subplot(111)
       subplot.imshow(here comes my array) # i did not included it to code
for simplicity

if __name__ == '__main__':
   app = wx.PySimpleApp()
   frame = Frame1(None)
   frame.Show()

   app.MainLoop()

#########################

is there a way to do it?

another thing, is it possible to open .png images this way? (since it is
possible to save stuff plotted with imshow to .png)
--
View this message in context: http://old.nabble.com/displaying-plain-data-without-fancy-features-(wx)-tp31890673p31890673.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hello,

I am trying to display an array with imshow(), however I want to ‘turn off’

display of axes, numbers, and all that extra stuff which comes with it. I

want only my array(grayscale image) to be shown

###########################

import wx

import matplotlib

matplotlib.use( ‘WXAgg’ )

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg

from matplotlib.figure import Figure

class Frame1(wx.Frame):

def init(self, parent):

   wx.Frame.__init__(self,None)

   self.panel1 = wx.Panel(self)

   self.Add_MPL_Plot()

def Add_MPL_Plot(self):

   figure = Figure(None, 80)

   canvas = FigureCanvasWxAgg(self.panel1, -1, figure)

   canvas.SetSize(wx.Size(300,300))

   subplot = figure.add_subplot(111)

   subplot.imshow(here comes my array)   # i did not included it to code

for simplicity

if name == ‘main’:

app = wx.PySimpleApp()

frame = Frame1(None)

frame.Show()

app.MainLoop()

#########################

is there a way to do it?

Sorry for the long delay in responding.

Yes, you can call:

subplot.set_axis_off()
subplot.set_frame_on(False)

to turn all of that “stuff” off. Although, you will still have a border around it. To prevent that, then you will have to create the axes object directly and set its rect kwarg to [0, 0, 1, 1].

another thing, is it possible to open .png images this way? (since it is

possible to save stuff plotted with imshow to .png)

Yeah, there is a imread() function:

http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=imread#matplotlib.pyplot.imread

I hope this helps!
Ben Root

···

On Mon, Jun 20, 2011 at 8:13 PM, kafooster <dmozejko@…83…287…> wrote: