bugGNU Octave - Bugs: bug #60433, legend with gnuplot improperly...


bug #60433: legend with gnuplot improperly sized for uppercase labels

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Wed 21 Apr 2021 09:00:29 PM UTC  
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  3 - Low Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  Open
Release:  6.2.0 Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 22 Apr 2021 06:14:54 PM UTC, comment #5: 

The biggest one is the long standing issue that OpenGL uses single precision.  That frequently forces users to gnuplot.

Rik <rik5>
Project Administrator
Thu 22 Apr 2021 05:52:07 PM UTC, comment #4: 

>> maybe worth collecting that list on the wiki

What would be helpful is a list of "I use gnuplot, rather than the default OpenGL toolkit, because..."

There are still cases where gnuplot gives better results. My opinion is that we must fix those and give up doing as if we supported gnuplot.

Pantxo Diribarne <pantxo>
Project Member
Thu 22 Apr 2021 04:04:55 PM UTC, comment #3: 

yes, I noticed that from a few other bug reports.

i did briefly step through _gnuplot_legend_, and nothing immediately jumped out. I may take another look and try to find the difference and patch if it looks straight forward. 

Otherwise we can just consider this part of the gnuplot issues list. (maybe worth collecting that list on the wiki, as there still seems to be enough gnuplot users that at some point maybe someone will take the plunge.)

Nicholas Jankowski <nrjank>
Thu 22 Apr 2021 03:50:10 PM UTC, comment #2: 

As gnuplot is not actively supported in Octave, I lowered the priority.

The code for legend was largely re-written by Pantxo and it uses Octave's interface to OpenGL to accomplish what it needs to.  The changes were so profound that it was not possible to update the code AND keep support for gnuplot.  See the start of the legend.m code:

function [hleg, hleg_obj, hplot, labels] = legend (varargin)

  ## Use the old legend code to handle gnuplot toolkit
  if (strcmp (graphics_toolkit (), "gnuplot"))
    if (nargout > 0)
      [hleg, hleg_obj, hplot, labels] = __gnuplot_legend__ (varargin{:});
      __gnuplot_legend__ (varargin{:});

The very first thing that is done is to check the graphics toolkit.  If it is gnuplot, we use the old m-file code from previous Octave versions (with all of the problems that it had).  There is no plan to update _gnuplot_legend_ code, although patches against it would probably be reviewed and accepted.

Rik <rik5>
Project Administrator
Wed 21 Apr 2021 09:02:01 PM UTC, comment #1: 

sorry for the poor title, meant in to be:

legend with gnuplot improperly sized for uppercase labels

Nicholas Jankowski <nrjank>
Wed 21 Apr 2021 09:00:29 PM UTC, original submission:  

Apologies if this overlaps any of the other gnuplot legend bugs. A search didn't show any that appeared to match. Apologies if this is a missed duplicate.

Following on a question over in StackOverflow [1], there is a plotting bug that only occurs with gnuplot, where the legend is improperly sized depending (seemingly) only on whether the text is uppercase.  it appears to size the legend based on lowercase text. A simple test case:

plot([1 2 3],[4 5 6], 'DisplayName','thisisaverylongname');legend


plot([1 2 3],[4 5 6], 'DisplayName','THISISAVERYLONGNAME');legend

produces the attached image

(file gnuplot_simplelabellengthtest.png)

Note that if a lower case name the same length as the upper case name above has the legend box the correct size. (e.g., "thisisaverylongname1234" takes about the same amount of space on the screen as "THISISAVERYLONGNAME", but the former has a larger legend to accommodate it while the latter does not.

[1] https://stackoverflow.com/questions/64986635/octave-box-legend-not-proper-width-with-upper-case-text

Nicholas Jankowski <nrjank>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by nrjank (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-22 rik5 Priority5 - Normal => 3 - Low
    2021-04-22 pantxo StatusNone => Confirmed
        Summarylegend with gnuplot => legend with gnuplot improperly sized for uppercase labels
    2021-04-21 nrjank Attached File- => Added gnuplot_simplelabellengthtest.png, #51302

    Back to the top

    Powered by Savane 3.6