[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57271] problems with legend() when labels are
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #57271] problems with legend() when labels are empty or spaces only |
Date: |
Tue, 19 Nov 2019 13:04:42 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
URL:
<https://savannah.gnu.org/bugs/?57271>
Summary: problems with legend() when labels are empty or
spaces only
Project: GNU Octave
Submitted by: rik5
Submitted on: Tue 19 Nov 2019 10:04:40 AM PST
Category: Plotting
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
Problem #1: empty label replaced by "data1"
Code to reproduce:
x = 1:10;
plot (x,x, x, x+2)
legend ('', 'x + 2')
hl = legend
The first call to legend correctly places blank text next to the legend key
for the first line. However, when legend is called a second time the blank
label is replaced by the text 'data1'.
My guess is that the legend code which checks whether DisplayName is empty
should also check whether it is a string or numeric. If the default
DisplayName was '[]' then it would be possible to distinguish between labels
which have never been set and '""' labels which are empty strings and were
intentionally set by the programmer.
Problem #2: Using spaces as labels causes legend keys to be misaligned.
Code to reproduce.
x = 1:10;
plot (x,x, x, x+2)
legend (' ', 'x + 2')
The first line is offset to the right with respect to the second one. This
effect is only visible on screen. Printing the figure results in the correct
placement.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57271>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #57271] problems with legend() when labels are empty or spaces only,
Rik <=