Menu

#2650 in polar plots, "with labels rotate variable" is ineffective without points/nopoints

None
closed-fixed
nobody
None
2023-12-30
2023-09-18
najevi
No

Version 6.0 patchlevel rc1 last modified 2023-07-08

Leveraging a familiar demo script to quickly illustrate this bug ... see the code below.
Yes that 12'th data point reads -2,600 degrees because in polar plots the effect of the rotation variable seems to be scaled back by a factor of not quite 30. -2600 roughly corresponds to -90 degrees rotation.

#
# Additional data columns can be used to hold text rotation or color
# for plot style "with labels"
#
# Note that polar plots do not use rotate variable in the way Cartesian plots do
#
$Data <<EOD
10 one -30
20 two -60
30 three -90
40 four -120
50 five -150
60 six -180
70 seven -210
80 eight -240
90 nine -270
100 ten -300
110 eleven -330
120 twelve -2600
EOD

set angle degrees
unset key

set xrange [0:130]
set yrange [0:130]
set xtics 10,10,120 nomirror
set ytics 10,10,120 nomirror
set border 3

set multiplot \
    title "variable color and orientation in plotstyle 'with labels'" \
    layout 3,1

set title "Cartesian 'with labels rotate variable'" offset 0,-1
plot $Data using 1:1:2:3:0 with labels rotate variable tc variable font ",20"

set polar
set angle degrees
set xrange [-90:50]
#set rrange [0:130]
set trange [0:130]
set title "Polar 'with labels rotate variable'" offset 1,-1
plot $Data using 1:1:2:3:0 with labels rotate variable tc variable font ",20"

set title "Polar 'with labels nopoint rotate variable'" offset 1,-1
plot $Data using 1:1:2:3:0 with labels nopoint rotate variable tc variable font ",20"

unset multiplot

The first being standard Cartesian plot and the second two being polar. As can be seen from the script the first polar plot omits any reference to point or nopoint and the second explicitly specifies nopoint (which I understood to be the default attribute, at least for labels not associated with data points).

With either points or nopoints specified there is evidence of rotation of labels but it looks as though there is a scaling factor applied to the angle of rotation. I don't understand why point/nopoint is required to get any rotation of labels. Perhaps that behaviour is by design and if so the manual ought to document that enabling requirement.

Polar plots have an arguably greater need for using variable orientation of per point labels than Cartesian plots so I hope that this bug can be rectified soon.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2023-09-18
    • status: open --> pending-fixed
    • Group: -->
    • Priority: -->
     
  • najevi

    najevi - 2023-09-19

    The (approximate) multiplier necessary for achieving the intended angle of rotation (i.e. as specified by the variable ... whether that be in degrees or radians) is different depending on "set angles". This may be a clue as to where the error can be found.

    • about 29 for "set angles degrees" and
    • about 63 for "set angles radians"

    No, I am not referring to the obvious 180/pi multiplier for converting radians to degrees.

    Also the compile options are detailed below:

    gnuplot> show version long
    
            G N U P L O T
            Version 6.0 patchlevel rc1    last modified 2023-07-08
    
            Copyright (C) 1986-1993, 1998, 2004, 2007-2023
            Thomas Williams, Colin Kelley and many others
    
            gnuplot home:     http://www.gnuplot.info
            faq, bugs, etc:   type "help FAQ"
            immediate help:   type "help"  (plot window: hit 'h')
    
    Compile options:
        +READLINE  -LIBREADLINE  +HISTORY
        +UNICODE  +OBJECTS  +STATS  +WATCHPOINTS  +EXTERNAL_FUNCTIONS +POLARGRID
        +COMPLEX_FUNCS  +LIBCERF  +AMOS
        +GD_PNG  +GD_JPEG  +GD_TTF  +GD_GIF  +ANIMATION
        -USE_CWDRC  +USE_MOUSE  +HIDDEN3D_QUADTREE
        +FUNCTIONBLOCKS +CHI_SHAPES
        64-bit integer arithmetic
        sizeof(struct coordinate) = 64 with extra coordinate
    GNUPLOT_DRIVER_DIR = ""
    GNUPLOT_PS_DIR     = "share/PostScript"
    HELPFILE           = "C:\Program Files\gnuplot\bin\wgnuplot.chm"
    
     
    • Ethan Merritt

      Ethan Merritt - 2023-09-19

      The bug was stupid but simple, as they often are. The conversion from cartesian -> polar coordinates was being applied not only to the pair of values in columns 1 and 2 (x/y -> r/theta coordinates) but also to the paired values in columns 3,4 and 5,6 (clearly nonsense). Fixed in 6.1 and 6.0rc2.

      Thanks for your bug report.

       
  • Ethan Merritt

    Ethan Merritt - 2023-12-30
    • Status: pending-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.