bugGNU Octave - Bugs: bug #65671, barh baseline stays horizontal,...

 
 

bug #65671: barh baseline stays horizontal, breaks horizontal stacked plots

Submitter:  Leonardo <pocker>
Submitted:  Thu 02 May 2024 10:53:38 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 20 May 2024 03:08:50 AM UTC, comment #11: 

added the nargin < 1 print_usage check to barh that had been previously added to bar, pushed as:
http://hg.savannah.gnu.org/hgweb/octave/rev/e3ae86170488

and added and expanded set of BISTS for bar and barh, pushed as:
http://hg.savannah.gnu.org/hgweb/octave/rev/f5b433492c16

adding the tests pointed out a few other issues, currently as xfail BISTs.  will look to see if any of those are easy fixes and then will push the fix to `__bar__.m` for horizontal / baseline issues.

Also note that bug #65734 was added to capture some specific issues with axis limits/labels not being updated properly with changes to bar plots.


Nicholas Jankowski <nrjank>
Group Member
Tue 07 May 2024 06:38:22 PM UTC, comment #10: 


comment #9:

> working patch attached that seems to fix both the vertical baseline and stacked bar issue mentioned in comment #1.


Looks good to me.


> (built against default. might not be bad to push against stable to fix the broken horizontal stacked bar issue from comment #1.


I am all for it.

Dmitri.
--



Dmitri A. Sergatskov <dasergatskov>
Tue 07 May 2024 06:10:02 PM UTC, comment #9: 

working patch attached that seems to fix both the vertical baseline and stacked bar issue mentioned in comment #1.  This patch adds 'horizontal' bargroup property checks when needed flip appropriate x/y related items tied to baseline and related listeners. 

both it and bar needs actual tests (for this and base functionality), but demo bar and demo barh look good now. (without the patch the barh demo baseline issues are apparent, probably should have noticed when first fixing stacked and adding that demo.) 

I think i have the listeners right, some check the baseline where x  and y are plot x and y, others check bargroup data where xdata is always the position/categorical data and y is always the bar length for both vertical and horizontal graphs.  I tried manually set()'ing a number of different features and couldn't break it, but could use some others more familiar with these objects to test out things i may not have thought of.

in the meantime i'll try to generate some plot-property/value checks to implement tests for bar/barh. 

(built against default. might not be bad to push against stable to fix the broken horizontal stacked bar issue from comment #1. if not will probably split BISTs into a patch against stable.)

Nicholas Jankowski <nrjank>
Group Member
Sat 04 May 2024 05:48:50 PM UTC, comment #8: 

i started looking at a switch.  its fairly simple enough to create a vbaseline instead of an hbaseline, just reversing all of the x/y related items based on the value of vertical.  the listeners, however, will ned to be redone to check/set the appropriate one, or create separate listeners for h or v baselines

Nicholas Jankowski <nrjank>
Group Member
Sat 04 May 2024 03:33:12 PM UTC, comment #7: 

My first thought was that this was going to be related to the "BaseValue" property.  I seem to remember it was troublesome to implement.

Rik <rik5>
Group administrator
Thu 02 May 2024 10:34:51 PM UTC, comment #6: 

A current work-around for OP problem is to do:

A = [1 2 3;4 5 6];
barh(A, "basevalue", [])
axis off


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 02 May 2024 10:29:24 PM UTC, comment #5: 

Adding to my my comments. It looks to me that "baseline" (and "basevalue") is always refers to canonical X and Y axes.

And that also explain messed up "stacked"
example. Here is another test. Try the following code with and without specifying "basevalue":


y = [8 15 33; 30 35 40; 50 55 62];
barh(y,'BaseValue',35)


Dmitri.
--


Dmitri A. Sergatskov <dasergatskov>
Thu 02 May 2024 01:37:52 PM UTC, comment #4: 

confirming the stacked barh issue.  should definitely open a report to address that. made some changes to stacked a few versions ago, maybe missed impact on barh

Nicholas Jankowski <nrjank>
Group Member
Thu 02 May 2024 01:35:26 PM UTC, comment #3: 

attached comparison images from octave 9.1 and matlab 2024a using the comment #0 script without the printing.  matlab keeps a vertical base bar while octave appears to keep the horizontal bar. that would be fine for bar but not barh.


Nicholas Jankowski <nrjank>
Group Member
Thu 02 May 2024 12:10:24 PM UTC, comment #2: 

It looks to me that barh() swaps X and Y axis, but the code does not adjust consistently.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 02 May 2024 11:52:00 AM UTC, comment #1: 

Confirm. Not sure what would matlab do in that case, does it plot
a vertical line at 0?

I noticed some other issues with brh(). E.g.:

x = [1980 1990 2000];
y = [15 20 -5; 10 -17 21; -10 5 15];
barh(x,y,'stacked')


looks all messed up, but perhaps it should be a different bug report.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 02 May 2024 10:53:38 AM UTC, original submission:  

Hi.

If I run the code


A = [1 2 3;4 5 6];
barh(A)
axis off
print -dpdf example.pdf


there is a black line at the bottom of the figure (on screen and the pdf, see attached pdf)

How to remove that black line?

Running octave 9.1.0 compiled from source.

Kind regards,
Leonardo

Leonardo <pocker>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #56022:  barh_baseline_bug65671.diff added by nrjank (5KiB - application/octet-stream - working patch referred to in comment #9)
file #55999:  bug65671_comparison.PNG added by nrjank (41KiB - image/png - matlab octave comparison)
file #55997:  example.pdf added by pocker (3KiB - application/pdf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by pocker (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-05-07 nrjank Attached File- Added barh_baseline_bug65671.diff, #56022
    2024-05-07 nrjank StatusConfirmed In Progress
        SummaryBlack line with barh command barh baseline stays horizontal, breaks horizontal stacked plots
    2024-05-02 nrjank CategoryOctave Function Plotting
    2024-05-02 nrjank StatusNone Confirmed
    2024-05-02 nrjank Operating SystemGNU/Linux Any
    2024-05-02 nrjank Attached File- Added bug65671_comparison.PNG, #55999
    2024-05-02 pocker Attached File- Added example.pdf, #55997

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code