Re: [Matplotlib-users] Autoscale embedding in gtk + dynamical update of plot + Y log scale
Hi All, I'd like to renew this request below. I've worked-around this problem setting xlim/ylim (as min/max of the relative axis) right before redraw the figure, but I'd like to know for a more elegant solution. Thanks in advance, Sandro On Sun, May 10, 2009 at 23:31, Sandro Tosi mo...@debian.org wrote: Hi All, I'm facing a weird problem while embedding in a gtk window made with glade (dunno if this might be involved in the problem, but worth noticing) + dynamical update of the plot. What I'm doing is: fig = Figure() ax = fig.add_subplot(111) line, = ax.plot([], []) then using that reference to update the plot when user click on a button: def update_graph(params): line_ref.set_data(np.array([L1, L2])) ax.set_yscale('log') fig_ref.canvas.draw() Sadly, the graph embedded remains unchanged, if not for the Y labels ticks that changes because of the log scale. The data is there, becase if I explicitly set the x/ylim then the data are shown, but i'd like mpl to autoscale. I've used several tentatives to make it works: - ax.set_autoscale_on(True) - ax.autoscale_view() but none of them worked. Do you know if there's something I can do to make that graph autoscale at set_data time? can I force it somehow? if I can't do it handy, is there a workaround to obtain the same effect? Thanks in advance, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Autoscale embedding in gtk + dynamical update of plot + Y log scale
On Tue, May 12, 2009 at 12:11 PM, Sandro Tosi mo...@debian.org wrote: Hi All, I'd like to renew this request below. I've worked-around this problem setting xlim/ylim (as min/max of the relative axis) right before redraw the figure, but I'd like to know for a more elegant solution. Thanks in advance, Sandro On Sun, May 10, 2009 at 23:31, Sandro Tosi mo...@debian.org wrote: Hi All, I'm facing a weird problem while embedding in a gtk window made with glade (dunno if this might be involved in the problem, but worth noticing) + dynamical update of the plot. What I'm doing is: fig = Figure() ax = fig.add_subplot(111) line, = ax.plot([], []) then using that reference to update the plot when user click on a button: def update_graph(params): line_ref.set_data(np.array([L1, L2])) ax.set_yscale('log') fig_ref.canvas.draw() Sadly, the graph embedded remains unchanged, if not for the Y labels ticks that changes because of the log scale. The data is there, becase if I explicitly set the x/ylim then the data are shown, but i'd like mpl to autoscale. I've used several tentatives to make it works: - ax.set_autoscale_on(True) - ax.autoscale_view() but none of them worked. If you change the data directly, and want mpl to autoscale, you need to call ax.relim() before calling ax.autoscale_view(). mpl stores the min/max of the data you add to it when you add the lines, rectangles, etc to the figure. When you update the data directly, there is no internal mechanism to notify the limits to update (we could add this but haven't). So you must explicitly call relim, which tells mpl to reinspect the data recalculate the limits. It might be a better design to have each artist store its limits, updating them when data is updated, and then having the container artists, eg the Axes, do a union of the child bboxes. But this is not the design we have currently. Hope this helps, JDH JDH -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Autoscale embedding in gtk + dynamical update of plot + Y log scale
Hi All, I'm facing a weird problem while embedding in a gtk window made with glade (dunno if this might be involved in the problem, but worth noticing) + dynamical update of the plot. What I'm doing is: fig = Figure() ax = fig.add_subplot(111) line, = ax.plot([], []) then using that reference to update the plot when user click on a button: def update_graph(params): line_ref.set_data(np.array([L1, L2])) ax.set_yscale('log') fig_ref.canvas.draw() Sadly, the graph embedded remains unchanged, if not for the Y labels ticks that changes because of the log scale. The data is there, becase if I explicitly set the x/ylim then the data are shown, but i'd like mpl to autoscale. I've used several tentatives to make it works: - ax.set_autoscale_on(True) - ax.autoscale_view() but none of them worked. Do you know if there's something I can do to make that graph autoscale at set_data time? can I force it somehow? if I can't do it handy, is there a workaround to obtain the same effect? Thanks in advance, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users