I have a matrix with 580x580 elements and I want to plot it like a gray colormap (with colorbar indicating the values and axes on the picture indicating pixel values) in a Canvas of a GUI I'm making with TKinter. I know I can do that using the function imshow(myMatrix, cmap='gray'), but that requires me to import the pylab library. Is there another way of creating the colormap or, if not, is it possible to show the output of the imshow function on my GUI panel instead of on a new window?
Asked
Active
Viewed 1,893 times
1 Answers
0
-
Thanks, that was very helpful. I still have to figure out how to insert the colorbar. One last thing: my figure appears after a push a button. However, if I push one more time, it does not put the figure in the same place (instead of the old one basically), but just next to it. Is there any command to do that? – maupertius Mar 16 '12 at 10:22
-
maupertius: if you're having difficulty with your code, I'd start a new question that includes a small code snippet illustrating the problem. Also, if an answer is helpful, it's courteous to up-vote it and, if it solves your problem, to accept it. – Wilduck Mar 16 '12 at 15:41
-
Wilduck: your answer was VERY helpful, however as a new user I can't vote it up. I haven't accepted your answer because I haven't solved the problem yet – maupertius Mar 19 '12 at 10:34
-
Fair enough. Unfortunately, I know more about matplotlib than tkinter, so I won't be too much more use to you. If you need more help, I would ask another question. Post the smallest piece of code that displays the problem you're encountering, the behavior you expect, and what you've tried to do so far. – Wilduck Mar 19 '12 at 15:47