##// END OF EJS Templates
Fix figure handling. Fix pull.
Stefan van der Walt -
Show More
@@ -91,6 +91,7 b' class OctaveMagics(Magics):'
91 '''
91 '''
92 inputs = line.split(' ')
92 inputs = line.split(' ')
93 for input in inputs:
93 for input in inputs:
94 input = unicode_to_str(input)
94 self.oct.put(input, self.shell.user_ns[input])
95 self.oct.put(input, self.shell.user_ns[input])
95
96
96
97
@@ -123,11 +124,14 b' class OctaveMagics(Magics):'
123 @magic_arguments()
124 @magic_arguments()
124 @argument(
125 @argument(
125 '-i', '--input', action='append',
126 '-i', '--input', action='append',
126 help='Names of input variables to be pushed to Octave. Multiple names can be passed, separated by commas with no whitespace.'
127 help='Names of input variables to be pushed to Octave. Multiple names '
128 'can be passed, separated by commas with no whitespace.'
127 )
129 )
128 @argument(
130 @argument(
129 '-o', '--output', action='append',
131 '-o', '--output', action='append',
130 help='Names of variables to be pulled from Octave after executing cell body. Multiple names can be passed, separated by commas with no whitespace.'
132 help='Names of variables to be pulled from Octave after executing cell '
133 'body. Multiple names can be passed, separated by commas with no '
134 'whitespace.'
131 )
135 )
132 @argument(
136 @argument(
133 '-s', '--size', action='append',
137 '-s', '--size', action='append',
@@ -209,12 +213,13 b' class OctaveMagics(Magics):'
209
213
210 function fig_create(src, event)
214 function fig_create(src, event)
211 global __ipy_figures;
215 global __ipy_figures;
212 __ipy_figures(size(__ipy_figures) + 1) = src;
216 __ipy_figures(gcf()) = src;
213 set(src, "visible", "off");
217 set(src, "visible", "off");
214 end
218 end
215
219
216 set(0, 'DefaultFigureCreateFcn', @fig_create);
220 set(0, 'DefaultFigureCreateFcn', @fig_create);
217
221
222 close all;
218 clear ans;
223 clear ans;
219 '''
224 '''
220
225
@@ -229,10 +234,10 b' class OctaveMagics(Magics):'
229
234
230 for f = __ipy_figures
235 for f = __ipy_figures
231 outfile = sprintf('%(plot_dir)s/__ipy_oct_fig_%%03d.png', f);
236 outfile = sprintf('%(plot_dir)s/__ipy_oct_fig_%%03d.png', f);
232 print(f, outfile, '-dpng', '-S%(size)s');
237 try
238 print(f, outfile, '-dpng', '-tight', '-S%(size)s');
239 end
233 end
240 end
234
235 # close all;
236
241
237 ''' % {'plot_dir': plot_dir, 'size': size}
242 ''' % {'plot_dir': plot_dir, 'size': size}
238
243
General Comments 0
You need to be logged in to leave comments. Login now