##// 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
@@ -228,12 +233,12 b' class OctaveMagics(Magics):'
228 end
233 end
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
241
235 # close all;
236
237 ''' % {'plot_dir': plot_dir, 'size': size}
242 ''' % {'plot_dir': plot_dir, 'size': size}
238
243
239 code = ' '.join((pre_call, code, post_call))
244 code = ' '.join((pre_call, code, post_call))
General Comments 0
You need to be logged in to leave comments. Login now