#1253 Aspect ratio of ellipses

windows (5)

The ellipse code in do_ellipse() (graphics.c) assumes that the aspect ratio of the plot canvas can be determined by using

double aspect = (double)term->v_tic / (double)term->h_tic;

The same assumption about the aspect ratio can be found in get_arrow() (graphics.c), get_arrow3d() (graph3d.c), and do_arc() (term.c).

This assumption fails for the Windows terminal since it uses a fixed (virtual) height and width of its canvas and only maps it to screen coordinates while drawing. When resizing the graph window of the windows terminal, it adjusts v_tic and h_tic accordingly. In order to obtain the correct aspect ratio of ellipses, the code should always use

if (strcmp(term->name, "windows") == 0)
    aspect = 1.;

The problem applies to versions 4.6 and 4.7, but is not visible in version 4.6.3 due to another bug. It would be possible to fix this problem by adding a few checks like the one above. But IMHO this would be really ugly and I am hoping for a better proposal.

Attached is a screen copy illustrating the problem. It was created after using the script below and then changing the aspect ratio of the graph window, followed by a 'replot'.

set yrange [-2:2]
set xrange [0:3]
set samples 4
unset key
set style ellipse units xy
plot '+' u 1:(0):(1):(2) with ellipses
1 Attachments


  • Hans-Bernhard Broeker

    In all fairness though, that's not the ellipse code's fault, then. Not by a very wide margin.

    The Windows terminal just breaks a basic requirement for gnuplot terminal drivers, when you change its aspect ration on a Window redraw. The only fix of that would be a total rewrite of how this driver handles the mapping from terminal coordinates to actual coordinates.

  • Bastian Märkisch

    • labels: --> windows
    • status: open --> closed-fixed
  • Bastian Märkisch

    Until somebody does this "total rewrite", the above fix is included in the 4.6 and 4.7 branches.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks