octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40686] Incorrect colorbar size after "axis ti


From: Anne Hanna
Subject: [Octave-bug-tracker] [bug #40686] Incorrect colorbar size after "axis tight" or "axis equal"
Date: Fri, 1 Feb 2019 01:26:33 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #8, bug #40686 (project octave):

I looked at this a bit more and found what I believe may be a solution.  I was
able to construct an example Gnuplot script which seems to illustrate the same
problem as is occuring in the Octave code.


set multiplot;
reset;

unset colorbox

#set size square
set tmargin screen 0.925;
set bmargin screen 0.11;
set lmargin screen 0.13;
set rmargin screen 0.75;
set xrange [-0.5:1.5]
set yrange [-0.5:3.5]
$map1 << EOD
1 2
3 4
5 6
7 8
EOD
set view equal xyz
set view map
splot '$map1' matrix with image

set tmargin screen 0.925;
set bmargin screen 0.11;
set lmargin screen 0.8275;
set rmargin screen 0.874;
#set view 0,0
$cb1 << EOD
1 10
2 20
3 30
4 40
5 50
6 60
7 70
8 80
EOD
set xrange [-0.5:1.5]
set yrange [-0.5:7.5]
unset xtics
#set size nosquare
plot '$cb1' matrix title '' with image

unset multiplot


This code draws a "main" plot and a pseudo-colorbar in a similar way to what
Octave does, and results in the pseudo-colorbar being shorter in height than
the main plot.  Uncommenting the "set size nosquare" command matches the
pseudo-colorbar height to the main plot.

The thing I see happening here is that the combination of "set view equal xyz"
and "set view map" _in that order_ locks the scale ratio between the x and y
axis units at 1:1 (as confirmed by "show size").  Since the pseudo-colorbar is
drawn _after_ the main plot, it picks up this setting.  (You can see that each
of the 16 pseudo-colorbar "pixels" ends up square.)  So, since the
pseudo-colorbar is very narrow in the x direction, it ends up very short in
the y direction.

What we _actually_ want is for the pseudo-colorbar to completely fill the
tall, narrow region allocated for it, allowing its "pixels" to have whatever
aspect ratio is needed for that task.  "set size nosquare" does this, and the
pseudo-colorbar height now matches that of the main plot.

I tested this in Octave by editing the __gnuplot_draw_axes__ to insert a "set
size nosquare" command right before the plot command for the colorbar, and it
seems to fix the colorbar height without mucking up anything else.  Does this
seem like a reasonable approach?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?40686>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]