Created
May 21, 2012 01:47
-
-
Save taldcroft/2760243 to your computer and use it in GitHub Desktop.
embed gtk in matplotlib example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gtk | |
import numpy as np | |
from matplotlib.figure import Figure | |
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg | |
win = gtk.Window() | |
win.connect("destroy", lambda x: gtk.main_quit()) | |
win.set_default_size(400,300) | |
fig = Figure(figsize=(5,4), dpi=100) | |
ax = fig.add_subplot(1, 1, 1) | |
# Do something (make a plot) | |
canvas = FigureCanvasGTKAgg(fig) # a gtk.DrawingArea | |
win.add(canvas) | |
win.show_all() | |
gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment