Revision: 5171
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5171&view=rev
Author:   jdh2358
Date:     2008-05-17 13:57:13 -0700 (Sat, 17 May 2008)

Log Message:
-----------
made backend agg open png in binary mode

Modified Paths:
--------------
    branches/v0_91_maint/examples/embedding_in_gtk2.py
    branches/v0_91_maint/examples/embedding_in_tk.py
    branches/v0_91_maint/examples/embedding_in_tk2.py
    branches/v0_91_maint/examples/mathtext_demo.py
    branches/v0_91_maint/examples/mathtext_examples.py
    branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py

Modified: branches/v0_91_maint/examples/embedding_in_gtk2.py
===================================================================
--- branches/v0_91_maint/examples/embedding_in_gtk2.py  2008-05-17 17:05:36 UTC 
(rev 5170)
+++ branches/v0_91_maint/examples/embedding_in_gtk2.py  2008-05-17 20:57:13 UTC 
(rev 5171)
@@ -5,7 +5,6 @@
 """
 import gtk
 
-from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
 from numpy import arange, sin, pi
 

Modified: branches/v0_91_maint/examples/embedding_in_tk.py
===================================================================
--- branches/v0_91_maint/examples/embedding_in_tk.py    2008-05-17 17:05:36 UTC 
(rev 5170)
+++ branches/v0_91_maint/examples/embedding_in_tk.py    2008-05-17 20:57:13 UTC 
(rev 5171)
@@ -1,7 +1,4 @@
 #!/usr/bin/env python
-import matplotlib
-matplotlib.use('TkAgg')
-
 from numpy import arange, sin, pi
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, 
NavigationToolbar2TkAgg

Modified: branches/v0_91_maint/examples/embedding_in_tk2.py
===================================================================
--- branches/v0_91_maint/examples/embedding_in_tk2.py   2008-05-17 17:05:36 UTC 
(rev 5170)
+++ branches/v0_91_maint/examples/embedding_in_tk2.py   2008-05-17 20:57:13 UTC 
(rev 5171)
@@ -1,43 +1,38 @@
 #!/usr/bin/env python
-import matplotlib
-matplotlib.use('TkAgg')
-
-from numpy import arange, sin, pi
-from matplotlib.axes import Subplot
-from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, 
NavigationToolbar2TkAgg
-from matplotlib.figure import Figure
-
 import Tkinter as Tk
-import sys
+import numpy as np
+import matplotlib.backends.backend_tkagg as backend
+import matplotlib.figure as mfigure
 
-def destroy(e): sys.exit()
 
 root = Tk.Tk()
 root.wm_title("Embedding in TK")
-#root.bind("<Destroy>", destroy)
 
+fig = mfigure.Figure(figsize=(5,4), dpi=100)
+ax = fig.add_subplot(111)
+t = np.arange(0.0,3.0,0.01)
+s = np.sin(2*np.pi*t)
 
-f = Figure(figsize=(5,4), dpi=100)
-a = f.add_subplot(111)
-t = arange(0.0,3.0,0.01)
-s = sin(2*pi*t)
+ax.plot(t,s)
+ax.grid(True)
+ax.set_title('Tk embedding')
+ax.set_xlabel('time (s)')
+ax.set_ylabel('volts (V)')
 
-a.plot(t,s)
-a.set_title('Tk embedding')
-a.set_xlabel('X axis label')
-a.set_ylabel('Y label')
 
-
 # a tk.DrawingArea
-canvas = FigureCanvasTkAgg(f, master=root)
+canvas = backend.FigureCanvasTkAgg(fig, master=root)
 canvas.show()
 canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
 
-#toolbar = NavigationToolbar2TkAgg( canvas, root )
+#toolbar = backend.NavigationToolbar2TkAgg( canvas, root )
 #toolbar.update()
-canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
+#toolbar.pack(side=Tk.LEFT)
 
-button = Tk.Button(master=root, text='Quit', command=sys.exit)
+def destroy():
+    raise SystemExit
+
+button = Tk.Button(master=root, text='Quit', command=destroy)
 button.pack(side=Tk.BOTTOM)
 
 Tk.mainloop()

Modified: branches/v0_91_maint/examples/mathtext_demo.py
===================================================================
--- branches/v0_91_maint/examples/mathtext_demo.py      2008-05-17 17:05:36 UTC 
(rev 5170)
+++ branches/v0_91_maint/examples/mathtext_demo.py      2008-05-17 20:57:13 UTC 
(rev 5171)
@@ -18,7 +18,7 @@
 ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
 tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$'
 
-ax.text(1, 1.6, tex, fontsize=20, va='bottom')
+mymath = ax.text(1, 1.6, tex, fontsize=20, va='bottom')
 
 ax.legend(("Foo", "Testing $x^2$"))
 

Modified: branches/v0_91_maint/examples/mathtext_examples.py
===================================================================
--- branches/v0_91_maint/examples/mathtext_examples.py  2008-05-17 17:05:36 UTC 
(rev 5170)
+++ branches/v0_91_maint/examples/mathtext_examples.py  2008-05-17 20:57:13 UTC 
(rev 5171)
@@ -49,7 +49,7 @@
     r'$\widehat{abc}\widetilde{def}$',
     r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$',
     r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu 
\nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$',
-    ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
+    #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
     ]
 
 from pylab import *

Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008-05-17 
17:05:36 UTC (rev 5170)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008-05-17 
20:57:13 UTC (rev 5171)
@@ -390,14 +390,14 @@
     def print_raw(self, filename_or_obj, *args, **kwargs):
         self.draw()
         if type(filename_or_obj) in (str, unicode):
-            filename_or_obj = open(filename_or_obj, 'w')
+            filename_or_obj = file(filename_or_obj, 'wb')
         self.get_renderer()._renderer.write_rgba(filename_or_obj)
     print_rgba = print_raw
 
     def print_png(self, filename_or_obj, *args, **kwargs):
         self.draw()
         if type(filename_or_obj) in (str, unicode):
-            filename_or_obj = open(filename_or_obj, 'w')
+            filename_or_obj = file(filename_or_obj, 'wb')
         self.get_renderer()._renderer.write_png(filename_or_obj,
                                                 self.figure.dpi.get())
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to