bugGNU Octave - Bugs: bug #47765, legend text covers the line and...

 
 

bug #47765: legend text covers the line and marker.

Submitted by:  Guan <xyzhaoguan>
Submitted on:  Fri 22 Apr 2016 10:48:32 PM UTC  
 
Category: Plotting with OpenGLSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.0.2Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Mon 25 Apr 2016 04:43:22 PM UTC, comment #10:

Thanks Rik.

Pantxo Diribarne <pantxo>
Project Member
Mon 25 Apr 2016 03:11:38 PM UTC, comment #9:

I found another instance where a double-click in FLTK would trigger an autoscale. I fixed that too and checked all three changes in under Pantxo's name (since he did the original work) on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/9191c24fb329). This will be part of the next bug fix release (4.0.3) or more likely Octave will move to 4.2.0.

Rik <rik5>
Project Administrator
Sun 24 Apr 2016 06:54:27 PM UTC, comment #8:

Thanks Rik for pointing me to fltk. I attached a new patch.

(file #36990)

Pantxo Diribarne <pantxo>
Project Member
Sun 24 Apr 2016 06:03:35 PM UTC, comment #7:

@Pantxo: The patch works fine for Qt. Could you also update the selection routine in _init_fltk_.cc? We don't want this to work for some toolkits and fail for others.

The relevant routine is in _init_fltk_.cc.

Rik <rik5>
Project Administrator
Sun 24 Apr 2016 08:04:24 AM UTC, comment #6:

I attached a patch implementing the snippet from comment #5.

(file #36984)

Pantxo Diribarne <pantxo>
Project Member
Sat 23 Apr 2016 11:59:22 PM UTC, comment #5:

Autoscaling is not the only problem. What if you try "plot (1:10)" after clicking the legend, you probably don't want the next plot to be drawn there.

I think we should only prevent the selection from changing a legend/colorbar into the currentaxes. This happens in canvasMousePressEvent, something like:

Pantxo Diribarne <pantxo>
Project Member
Sat 23 Apr 2016 05:03:47 PM UTC, comment #4:

Confirmed. I agree with Pantxo's analysis as well.

I'm not sure whether the easiest solution would be to prevent a legend axes object from ever getting selected, or whether we need to disable autoscaling when the axes object is a legend.

For the second choice, the code is in libgui/graphics/Canvas.cc.

After getting the currentaxes into the variable ah, we could check that it doesn't have the legend property before continuing.

Rik <rik5>
Project Administrator
Sat 23 Apr 2016 09:24:02 AM UTC, comment #3:

I can confirm this with Qt toolkit.
I think the whole problem lies in autoscaling legend objects. The object selection mechanism is not well behaved here: when clicking on a legend, the currentobject property of the figure should be changed to reflect the fact that the legend has been selected (this works well), but a legend should never become the currentaxes.

Pantxo Diribarne <pantxo>
Project Member
Sat 23 Apr 2016 12:06:46 AM UTC, comment #2:

Before print to pdf, please click the legend and click "Autoscale", you will see the difference.

Let's make it more clear with the following code:

plot(a,b,'o-.')
legend('test')

The line style (dotted dash line) is not shown clearly with original plot. After selecting the legend and "Autoscale", the line and marker are shown correctly.

It also depends on the figure size, and font size. When the figure size is large and font size is small, this problem is not very obvious. But you still can see the difference when after clicking "Autoscale".

Guan <xyzhaoguan>
Fri 22 Apr 2016 11:19:19 PM UTC, comment #1:

This works for me. I used the following code with 4.0.2 on Kubuntu 15.10

Also, what does

return? It should be qt.

(file #36983)

Rik <rik5>
Project Administrator
Fri 22 Apr 2016 10:48:32 PM UTC, original submission:

The legend texts always cover the legend lines.

a=(1:0.4:10)
b=(1:23)
plot(a,b)
legend('test')

This code generates test1.pdf.
After I click the legend and then click the "Autoscale" button in Figure 1. I got test2.pdf.

It seems the staring position of the text need to be adjusted and the size of legend box needs to be adjusted accordingly.

I tested 4.02 under windows 7, and 4.0.0 under ubuntu.

Guan <xyzhaoguan>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #36990:  legend_ax3.patch added by pantxo (2KiB - text/x-diff)
file #36984:  legend_ax.patch added by pantxo (1KiB - text/x-diff)
file #36983:  test3.pdf added by rik5 (3KiB - application/pdf)
file #36981:  test1.pdf added by xyzhaoguan (3KiB - application/pdf)
file #36982:  test2.pdf added by xyzhaoguan (3KiB - application/pdf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Apr 2016 03:11:38 PM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Sun 24 Apr 2016 06:54:27 PM UTCpantxoAttached File-=>Added legend_ax3.patch, #36990
    Sun 24 Apr 2016 08:04:24 AM UTCpantxoAttached File-=>Added legend_ax.patch, #36984
      StatusConfirmed=>Patch Submitted
    Sat 23 Apr 2016 09:24:02 AM UTCpantxoCategoryPlotting=>Plotting with OpenGL
      Item GroupOther=>Incorrect Result
      StatusWorks For Me=>Confirmed
    Fri 22 Apr 2016 11:19:19 PM UTCrik5Attached File-=>Added test3.pdf, #36983
      StatusNone=>Works For Me
    Fri 22 Apr 2016 10:48:32 PM UTCxyzhaoguanAttached File-=>Added test1.pdf, #36981
      Attached File-=>Added test2.pdf, #36982

    Back to the top


    Powered by Savane 3.1-cleanup1