bugGNU Octave - Bugs: bug #56528, HorizontalAlignment in legend not...

 
 

bug #56528: HorizontalAlignment in legend not working

Submitter:  Muhali <muhali>
Submitted:  Thu 20 Jun 2019 04:38:54 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 5.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 22 Jun 2019 05:16:57 PM UTC, comment #4: 

@Muhali: There is no easy way to control the text positioning out of the "textposition" property. Actually the text is left aligned and the anchor is at the right hand tip of the line plus a small hard-coded margin, hence the observed behavior when you switch the alignement to "right".

I'm inclined to close this report as "invalid" since there is no actual bug, unless you want to turn it into a feature request. Don't expect much though, fixing the dozen of true legend bugs we  have at hand should be a priority.

Pantxo Diribarne <pantxo>
Group Member
Fri 21 Jun 2019 08:07:31 AM UTC, comment #3: 

@pantxo: No, set (hl, "textposition", "left") is not what I had in mind.

If the lines are e.g. on the left side, I am looking for a way to align the text either right, ending at the right legend boundary, or left, starting at the lines. Currently the text seems to be centered.

Muhali <muhali>
Thu 20 Jun 2019 09:09:51 PM UTC, comment #2: 

@Mukali: What are you trying to do in the first place? I think text/line/patch objects in legend-axes are considered "internals". The interface to manipulate the aspect of legends is limited to top level legend axes properties, e.g.


plot (1:10)
hl = legend ("toto");
set (hl, "textposition", "left")


I don't think this is a bug but rather that legend specific properties ("location", "textposition", "fontsize", ...) are poorly documented.

I also think that we should hide internal objects in some way (at least "handlevisibity" = "off"), as Matlab did when legend axes became proper legend objects (see empty children in  https://www.mathworks.com/help/matlab/ref/matlab.graphics.illustration.legend-properties.html).

Pantxo Diribarne <pantxo>
Group Member
Thu 20 Jun 2019 06:05:08 PM UTC, comment #1: 

Confirm with dev version.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Thu 20 Jun 2019 04:38:54 PM UTC, original submission:  

by doing


plot(rand(3,2)) ;
h = legend({"l1" "line 2"}) ;
ht = findobj(h, 'type', 'text') ;
set(ht,'HorizontalAlignment', 'right') ;


with qt, the legend text gets mangled with the lines,
with gnuplot, nothing happens.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-11 rik5 Open/ClosedOpen Closed
    2019-06-22 pantxo StatusNone Invalid / Not an Octave Bug
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code