LKeene wrote:
>
>
> - I have a numpy.ndarray of data with 350 rows and 500 columns. How do
> I display it in the upper-left hand corner of the frame client with no
> tick marks/labels, etc...just the colormap at screen
> coords(0,0)->(349,499) (rows,columns)? Could someone post a few lines
> to do this? Thanks so much in advance!
>
> -L
>
Hmm... interesting problem...
Here's a simple example where the image fills the frame - note the
properties such as xticks, yticks = [], position=[0,0,1,1], and the size of
the Frame itself... on my platform (Mac OS X) the height of the frame should
be 22 pixels more than the image (discovered by trial and error).
The border of the axes is still visible in black - obscuring the outer
pixels of the image - does anyone know how to shut that off?
import matplotlib
matplotlib.interactive(False)
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
from matplotlib.pyplot import setp
import numpy as np
import wx
class MatplotlibFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.figure = Figure()
print self.figure
self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
self.subplot = self.figure.add_subplot(111)
#cdata = np.random.rand(351, 501)
cdata = np.zeros((351, 501))
cdata[::50, ::50] = 1
self.subplot.imshow(cdata, aspect='equal', interpolation='nearest')
setp(self.subplot, xticks=[], yticks=[], position=[0,0,1,1])
def repaint(self):
self.canvas.draw()
class App(wx.App):
def OnInit(self):
frame = MatplotlibFrame(parent=None, title="an image", size=(501,
351+22))
frame.Show()
return True
app = App()
app.MainLoop()
--
View this message in context:
http://www.nabble.com/Help-with-simply-plotting-2d-array%2C-please-tp22214482p22216497.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users