bugGNU Octave - Bugs: bug #41970, plotyy () and changing legend...

 
 

bug #41970: plotyy () and changing legend properties

Submitter:  sergey plotnikov <nul0m>
Submitted:  Thu 27 Mar 2014 10:43:12 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 17 Jul 2014 08:13:22 PM UTC, comment #15: 

The latest syntax doesn't produce a warning and seems to run all the demos correctly so I committed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/961ecaf9fb57).

Rik <rik5>
Group administrator
Wed 16 Jul 2014 05:23:26 PM UTC, comment #14: 

I've got the same warning, but what is strange is that this warning disappears if you change the code this way:

units = units(:);
set (hax, {"units"}, units);


I'm not sure how get(hax,"units") works, but it seems the output is always a column vector. In that case we don't even need the first line in the code above.


sergey plotnikov <nul0m>
Wed 16 Jul 2014 04:28:38 PM UTC, comment #13: 

Maybe things have changed since this was coded because your example seems to work now.  However, If I make the change and then run demo ('legend') I now have warnings.  So something with the new syntax still isn't perfect.


 clf;
 plot (rand (2));
 title ('legend called with cellstr and string inputs for labels');
 h = legend ({'foo'}, 'bar');
 legend (h, 'location', 'northeastoutside');
 set (h, 'fontsize', 20);

warning: set: allowing n to match units value normalized
warning: set: allowing n to match units value normalized


Rik <rik5>
Group administrator
Wed 16 Jul 2014 04:20:04 PM UTC, comment #12: 

Look at the comment above the line in question.  It is Octave weirdness that is forcing this issue.


+      ## Crazy syntax because set() only seems to support row vectors
+      set (hax, repmat ({"units"}, [1 numel(hax)]), units(:)');


Rik <rik5>
Group administrator
Wed 16 Jul 2014 04:18:11 PM UTC, comment #11: 

I mean that the following works in Octave (at least for me):


set (hax, {"units"}, {"pixels"; "pixels"})


sergey plotnikov <nul0m>
Wed 16 Jul 2014 03:56:18 PM UTC, comment #10: 

But then.. why not:


set (hax, {"units"}, units(:));


Sorry if this is obvious. I've just supplied a patch for the bug #42554 where we need to take into account the same possibility.

sergey plotnikov <nul0m>
Wed 16 Jul 2014 03:23:39 PM UTC, comment #9: 

Because there may be more than one value in the variable "units" and Octave was not auto-expanding the property {"units"} to match the number af values in the variable.

This works


set (hax, "units", "pixels")


because Octave loops internally over every handle in hax and applies the one-to-one mapping of Property/Value pair.

This doesn't work


set (hax, {"units"}, {"pixels", "pixels"})


because the number of properties doesn't match the number of values.  At some point it would be nice to update the set routine in C++ to deal with this.  But it doesn't happen very often so the workaround of repmat is okay for now.


Rik <rik5>
Group administrator
Wed 16 Jul 2014 10:00:47 AM UTC, comment #8: 

Just out of interest.. Why did you use repmat() when changing "units" back? Are there any drawback in writing line 1093 as simple as:

set (hax, {"units"}, units);


sergey plotnikov <nul0m>
Thu 15 May 2014 07:11:14 AM UTC, comment #7: 

If patch for bug #42362 is applied, this works for me too.

Stefan Mahr <dac922>
Thu 15 May 2014 03:30:09 AM UTC, comment #6: 

This changeset fixes the problem with plotyy for me (http://hg.savannah.gnu.org/hgweb/octave/rev/5f37573a6868).

Rik <rik5>
Group administrator
Wed 14 May 2014 10:26:58 PM UTC, comment #5: 

As mentioned in bug 42362 this bug should be reopened, since it's not possible to call plotyy again after setting legend.

Stefan Mahr <dac922>
Wed 09 Apr 2014 04:16:44 AM UTC, comment #4: 

I was working along similar lines to Pantxo and created a changeset that solves the problem.  I checked it in here (http://hg.savannah.gnu.org/hgweb/octave/rev/8c0646dd9e5a).  Closing report.

Rik <rik5>
Group administrator
Tue 08 Apr 2014 08:49:10 PM UTC, comment #3: 

I attached a patch.

(file #31142)

Pantxo Diribarne <pantxo>
Group Member
Thu 27 Mar 2014 03:17:10 PM UTC, comment #2: 

plotyy and legend are both complicated functions that put multiple axes objects on the same figure so I'm not surprised that there's a bit of a problem with interactions between the two.  I overhauled plotyy on the development branch so any fixes should be done on that branch which uses the newest versions of plotyy.m and legend.m.  I'm marking the release as "dev" to encourage that.

Rik <rik5>
Group administrator
Thu 27 Mar 2014 01:02:24 PM UTC, comment #1: 

Confirmed, and for completeness, here is the error I see with 3.8.1:


error: 'kids' undefined near line 32 column 17
error: evaluating argument list element number 1
error: called from:
error:   /usr/share/octave/3.8.1/m/plot/appearance/__getlegenddata__.m at line 32, column 10
error:   /usr/share/octave/3.8.1/m/plot/appearance/legend.m at line 1055, column 17


This didn't work under 3.6.4 either, although with a different error:


warning: legend: plot data is empty; setting key labels has no effect
error: legend: expecting argument to be a character string
error: called from:
error:   /usr/share/octave/3.6.4/m/plot/legend.m at line 384, column 11
error:   /usr/share/octave/3.6.4/m/plot/legend.m at line 813, column 9


Mike Miller <mtmiller>
Group Member
Thu 27 Mar 2014 10:43:12 AM UTC, original submission:  

For some reason I wasn't able to change neither loacation nor orientation of legend created for plotyy chart.

Just check out the following piece of code:

plotyy (1:10,1:10,1:10,sin(1:10));
lh = legend ("x","sin(x)");
set (lh,"location","south")


sergey plotnikov <nul0m>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31142:  legendupdate41970.patch added by pantxo (1KiB - application/x-download)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dac922 (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by nul0m (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-09 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-04-08 pantxo Attached File- Added legendupdate41970.patch, #31142
    2014-03-27 rik5 Release3.8.1 dev
    2014-03-27 mtmiller Item GroupSegfault, Bus Error, etc. Incorrect Result
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code