colorbar lefts multiplot

Ben Abbott bpabbott at mac.com
Wed Apr 1 18:39:37 CDT 2009


On Apr 1, 2009, at 5:44 PM, Petr Mikulik wrote:

> 	Hello Ben,
>
>>> I've just discovered yet another bug (seems to be bug in 3.1.55,  
>>> not in
>>> 3.0.3):
>>>
>>> hold on
>>> colorbar
>>> imagesc(1./hilb(2));
>>> hold off
>>>
>>> hold on
>>> imagesc(1./hilb(4));
>>> hold off
>>>
>>> Note that it does not hurt saying
>>> 	unset multiplot
>>> if 'multiplot' was used somewhere in past and there is such a  
>>> danger of
>>> having multiplot on after some premature crash.
>>
>> It may be a few days before I have time to dig into this. Do you  
>> have a
>> suggestion for what should be changed Octave's sources?
>
> As far as I know you are now avoiding "set colorbox; replot" of  
> gnuplot,
> then I don't know.
>
>
> I thought that each command such as "colorbar", "axis xy", "title  
> 'bla'",
> etc., forces an immediate replot of the whole drawing canvas.  
> Therefore I
> wanted to test what is faster and with less redrawings:
>
> 1:
> imagesc(1./hilb(1024))
> colorbar; axis xy; title 'bla'; xlabel 'x'; ylabel 'y'
>
> 2:
> hold on
> colorbar; axis xy; title 'bla'; xlabel 'x'; ylabel 'y'
> imagesc(1./hilb(1024))
> hold off
>
> 3:
> set (gcf, 'visible', 'off')
> imagesc(1./hilb(1024))
> colorbar; axis xy; title 'bla'; xlabel 'x'; ylabel 'y'
> set (gcf, 'visible', 'on')
>
> I was surprised I cannot see speed difference easily.
> Thus I would like to ask: which sequence is the most efficient? What  
> is the
> number of canvas "(re)plots" in each case -- 1 or 6?
>
> ---
>
> Petr

Hi Petr,

I came along after the architecture for the gnuplot backend was  
already in place. So I may get some of this wrong ... My understanding  
is that gnuplot_drawnow.m is called for each "replot".

You can verify my understanding by placing the following code at the  
top of gnuplot_drawnow()

	persistent num_replots = 1
	fprintf ("replots = %d\n", num_replots++)

The counter can be reset by "clear gnuplot_drawnow"

For your first example, and when the lines are entered from the  
command line, there is one replot for each line (2 total). If any of  
these are run from a script, you'll only get one call to  
gnuplot_drawnow.

When the "visible" property is "off" gnuplot_drawnow is not called.

Thus (1) and (2) produce 2 plot sequences (from the command line), and  
(3) only 1.

However, if you enter the following at the command line ...

	imagesc(1./hilb(1024))
	colorbar
	axis xy
	title 'bla'
	xlabel 'x'
	ylabel 'y'

You'll get 6.

Ben





More information about the Octave-maintainers mailing list