|
From: Joel H. <yo...@if...> - 2007-02-01 23:22:10
|
Hi! I'm using matplotlib and pygtk to write a viewer for multiple sequence alignments. (Big matrices (~100x1000) of characters, usually colored by cell according to chemical properties). Now I've run into trouble since the rendering of the actual characters is very slow. I have included a small example that illustrates this. Set SHOW_LETTERS = False to see the change in rendering speed. The difference is even greater when using real data, so I would very much appreciate suggestions as to how I could improve it. My strategy: I create an image with the same dimension as the msa, and where each pixel is colored according to properties of the corresponding character in the msa. I plot this in the background of the figure using imshow(). At each redraw (refresh, resize, zoom...) I determine the size that each image pixel occupies at the current canvas size, and pick a font where one letter will fit inside this square. Then I put the corresponding msa letter into this square using text()/add_artist(). Would it be possible to use only one Text instance that would hold all letters, and somehow stretch that to the desired size? If so, could I expect better performance? Does anyone have a better idea? Thanks for an awesome plotting package! /Joel Hedlund |