bugGNU Octave - Bugs: bug #53214, area.m needs update to implement...


bug #53214: area.m needs update to implement ShowBaseline and other properties

Submitter:  Marshall <marsian>
Submitted:  Sat 24 Feb 2018 01:44:54 AM UTC
Category:  Plotting Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Marsian Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

( Jump to the original submission )

Sun 21 Nov 2021 11:47:26 PM UTC, comment #12: 

For the x limits, a possible workaround is to add the following code under the "if (! ishold ())" block.

axis (hax, "tight")
set (hax, "ylimmode", "auto")

Rik <rik5>
Project Administrator
Thu 26 Aug 2021 02:01:16 AM UTC, comment #11: 

forgot to add - the main bug item has been fixed.  it would be nice to have the xlim match, but this could be closed and that could be made a new bug report, as it applies to more than just area.m.  alternatively this bug report could be retitled appropriately with the item group changed to Matlab Compatibility.

Nicholas Jankowski <nrjank>
Project Member
Thu 26 Aug 2021 01:58:55 AM UTC, comment #10: 

in area.m, then patch.m, the axis limits are set in the call to _go_patch_ (line 176)

in plot.m, then _plt_.m, the axis limits are set in the call to _go_line_ (line 435)

both are compiled functions in  libinterp/corefcn/graphics.cc, both are passed x-data consisting of [1:10].  so both are internally deciding to set the left limit to 0 rather than the lowest value. As before patch hands off the job it has set the xlim to [-1 1], it seems to be a case of resetting axes min to 0, rather than just neglecting to update it to x_data_min.

not set up to step through compiled functions to verify, but taking a quick peek at graphics.cc, both call GO_BODY(patch/line).  that's where i get lost in the 14k line file, so someone familiar will maybe need to see where it's not setting the left xlim to be 1.  

I would suggest both plot and area get a compatibility test added such as:

## test default plot limits
%! h = plot(rand(10))
%! assert(xlim(gca),[1 10])

Nicholas Jankowski <nrjank>
Project Member
Thu 26 Aug 2021 12:33:34 AM UTC, comment #9: 

as noted in comment #6, the origin incompatibility also appears in plot, which makes sense as area is just plot with area below the curve filled in. now, are plot and area just doing the same thing, or do they pull from the same code. will peek.

http://file.savannah.gnu.org/file/plot_origin_compare.png?file_id=51820" />

Nicholas Jankowski <nrjank>
Project Member
Thu 26 Aug 2021 12:24:42 AM UTC, comment #8: 

comparing 6.3.0 with matlab, outputs look identical except for the axes limits.

http://file.savannah.gnu.org/file/facealpha_compare.png?file_id=51819" />

Nicholas Jankowski <nrjank>
Project Member
Thu 26 Aug 2021 12:04:01 AM UTC, comment #7: 

Using 6.1.0

Following the code from comment #2

hold on
hold off

No errors are produced.
The figure xlim is still [0,10]

http://file.savannah.gnu.org/file/rand.png?file_id=51818" />

Wed 28 Feb 2018 01:14:14 AM UTC, comment #6: 

Yes, Matlab sets x limits at [1,10]. See the attached figure. It also happens with plot...

http://file.savannah.gnu.org/file/area10.PNG?file_id=43410" />

Marshall <marsian>
Tue 27 Feb 2018 10:04:22 PM UTC, comment #5: 

Since you have access to Matlab, what does

area (rand (10))

look like?  Octave sets the x limits at [0, 10] which seems silly.  It looks like it would be better to set the limits at [1, 10] and closely hug the data.

Rik <rik5>
Project Administrator
Tue 27 Feb 2018 09:56:52 PM UTC, comment #4: 

This works great for me!

Marshall <marsian>
Mon 26 Feb 2018 05:48:02 PM UTC, comment #3: 

The area.m function has not been updated now that patch implements facealpha.  In fact, there are several unimplemented properties.

I see that BaseLine and ShowBaseline are unimplemented, although BaseValue is.  Also, XDataSource, YDataSource, and XDataMode are likewise not implemented.

This was a pretty easy fix so I added support for EdgeAlpha and FaceAlpha in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/1cacfebaed3e).

Rik <rik5>
Project Administrator
Mon 26 Feb 2018 03:30:12 PM UTC, comment #2: 


>> area(rand(10),'facealpha',0.5)

hold on
hold off
error: set: unknown hggroup property facealpha
error: called from
    area>__area__ at line 188 column 7
    area at line 117 column 10

It fails on the first call above. If working properly, it would continue to the second area call and would appear with some transparency. I know transparency has been implemented with some of the other functions now in dev (patch, surface, ...), so allowing transparency for area would be ideal. If transparency can't be added, at the very least it shouldn't error out.

Marshall <marsian>
Sun 25 Feb 2018 05:32:41 PM UTC, comment #1: 

Which commands are you running to produce the error? Which error are you seeing exactly?

I won't be able to look into this during the next two weeks or so. But might have a look at this later if no one else wants to check earlier.

Markus M├╝tzel <mmuetzel>
Project Member
Sat 24 Feb 2018 01:44:54 AM UTC, original submission:  

Use of the 'area' function with the facealpha property causes an error. At the very least the option shouldn't cause an error for matlab compatibility, but even better would be to implement it.

I'm using a dev version on Win 10 compiled on Feb 1st, and I don't think any changes since then would have fixed this.

Marshall <marsian>


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

Attach Files:

Attached Files
file #51820:  plot_origin_compare.png added by nrjank (163KiB - image/png)
file #51819:  facealpha_compare.png added by nrjank (219KiB - image/png)
file #51818:  rand.png added by None (134KiB - image/png)
file #43410:  area10.PNG added by marsian (23KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by marsian (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 project members can vote.





    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-26 nrjank Attached File- Added plot_origin_compare.png, #51820
    2021-08-26 nrjank Attached File- Added facealpha_compare.png, #51819
    2021-08-26 None Attached File- Added rand.png, #51818
    2019-01-12 jwe Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Item GroupMatlab Compatibility Feature Request
    2018-02-28 marsian Attached File- Added area10.PNG, #43410
    2018-02-26 rik5 StatusNeed Info Confirmed
        Summaryfacealpha property causes error when used with area() area.m needs update to implement ShowBaseline and other properties
    2018-02-25 mmuetzel StatusNone Need Info

    Back to the top

    Powered by Savane 3.11