Octave graphics bugs and thoughts

Ben Abbott bpabbott at mac.com
Wed May 6 06:24:22 CDT 2009


On May 5, 2009, at 11:01 PM, Daniel J Sebald wrote:

> I've come across some bugs in the gnuplot implementation of Octave's  
> graphics.  I also want to give some thoughts and suggestions.  The  
> order will be 1) thoughts, 2) bugs, 3) suggustion.
>
> I commend those who've done so much work on the gnuplot graphics.   
> Many complain about gnuplot, but what I've seen is near as good as  
> Matlab in appearance and functionality.  In fact, the gnuplot  
> implementation has one advantage: if one is running a long  
> simulation that occassionally puts out a plot, because gnuplot is a  
> separate process, the plot can be viewed while the simulation is  
> still running.  That doesn't work so well in a single-threaded app.
>
> Here are some bugs...
>
> The X11 terminal has a problem with all characters appearing as  
> Greek when some other piece of text in the plot has a Greek  
> character.  Here are some commands and the results I see:
>
> plot([1:50])
> title('Here is English text')
> <Text appears as it should in X11 terminal>
> xlabel('\omega H')
> <The title changes to all Greek characters>
> title('Here is English text')
> <Nothing changes>
> title('Here is English text \omega')
> <The title appear appropriately in English mixed with Greek>
>
> So there is some odd behavior there, but perhaps it is gnuplot that  
> has a bug.  Other terminals seem to be OK.  If developers think this  
> is a gnuplot issue, I will check into it.

It does appear to be a gnuplot issue. Try the commands below ...

set term x11 enhanced
set xlabel "{/Symbol w} A B C D" font ",14"
plot sin(x)

If you change the default axes font to something specific ...

set (0, "defaultaxesfontname", "Arial")

Your example should work correctly.

> A colorbar will shift as a result of printing the plot in  
> PostScript.  Only after a PostScript print is there a problem.
>
> imagesc(rand(50))
> colorbar()
> <colorbar looks good in X11 terminal>
> print('-depsc2', 'junk.eps')
> <colorbar still looks good in X11>
> print('-dpsc2', 'junk.ps')
> <colorbar shifts leftward in X11, but in PostScript it is in the  
> correct positon>
>
> The colorbar will look correct in the PostScript plot, but only for  
> the first plot. Subsequent plots will have the colorbar wrong in  
> PostScript.  I do see some special consideration in the Octave  
> scripts for the PostScript case; perhaps a variable is not being set  
> back to the correct value.

The colorbar needs more work. There are other examples where it does  
not render properly. I you make another call to colorbar it should fix  
itself ... which indicates that a listener should be able to fix it. I  
looked at this a few weeks ago but didn't find a proper solution.

Perhaps it makes sense to add some additional tests to colorbar that  
illustrate the problem?

In particular, combinations with "axis equal" and/or "axes square"  
cause problems.

%!demo
%! clf
%! plot([0, 2])
%! colorbar ("east")
%! axis square

%!demo
%! clf
%! plot([0, 2])
%! colorbar ("eastoutside")
%! axis square

%!demo
%! clf
%! plot([0, 2])
%! colorbar ("east")
%! axis equal

%!demo
%! clf
%! plot([0, 2])
%! colorbar ("eastoutside")
%! axis equal

Regarding the fontsize problems, I'll responds separately. (it's more  
complicated than it appears).

Ben


More information about the Octave-maintainers mailing list