From: Jordan D. <jd...@eo...> - 2006-08-25 00:13:15
|
So I have a contourf plot and I am resetting the ylims so as to only display a subset of the full contourf plot. Is there anyway to set norm and the colorbar so they take their colormapping settings using the data currently on display? By which I mean: the full dataset has a range of 260-320. The reset axes limits display a region that only has values between 280-310. I'd like the colormap to extend over this range of values automatically, without having to set vmin=280, vmax=310. Any way to do that? Jordan |
From: Eric F. <ef...@ha...> - 2006-08-25 07:55:42
|
Jordan Dawe wrote: > So I have a contourf plot and I am resetting the ylims so as to only > display a subset of the full contourf plot. Is there anyway to set norm > and the colorbar so they take their colormapping settings using the data > currently on display? By which I mean: the full dataset has a range of > 260-320. The reset axes limits display a region that only has values > between 280-310. I'd like the colormap to extend over this range of > values automatically, without having to set vmin=280, vmax=310. Any way > to do that? Jordan, I don't think so; and although I have not thought hard about it, my impression is that adding this capability would take a lot of work and redesign. I expect that in most cases what you describe would not be the desired behavior, so it would have to be a non-default option. Eric |
From: John H. <jdh...@ac...> - 2006-08-29 04:38:43
|
>>>>> "Eric" == Eric Firing <ef...@ha...> writes: Eric> I don't think so; and although I have not thought hard about Eric> it, my impression is that adding this capability would take Eric> a lot of work and redesign. I expect that in most cases Eric> what you describe would not be the desired behavior, so it Eric> would have to be a non-default option. One should be able to write a specific example that exposes this functionality fairly easily using callback event handling. I'll provide a simple example using a line plot to get the approximate ylimits of the data based on the xaxis zoom limits, and maybe some enterprising developer can extend this example to an image which sets the clim based on the xlim and ylim from pylab import nx, figure, show t = nx.arange(0.0, 2.0, 0.1) s = nx.sin(2*nx.pi*t) fig = figure() ax = fig.add_subplot(111) ax.plot(t, s) def on_xlim(ax): xmin, xmax = ax.get_xlim() imin, imax = nx.searchsorted(t, (xmin, xmax)) thiss = s[imin:imax] ax.set_ylim(min(thiss), max(thiss)) ax.figure.canvas.draw() ax.connect('xlim_changed', on_xlim) show() |