bugGNU Octave - Bugs: bug #55864, semilogy plot ticks could be too...

 
 

bug #55864: semilogy plot ticks could be too dense or too sparse

Submitter:  Eddy <count>
Submitted:  Fri 08 Mar 2019 01:38:25 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 10 Mar 2019 03:21:50 PM UTC, comment #1: 

Found a related issue:

bug #55640: Feature Request: Adjust tick locations and labels based on text extents and size of axes

If the workaround here could be implemented, or better, further provide user the ability to control (set () ?) the density of ticks/grids, then #55640 would be largely solved.

I attached an updated Octave scripts for computing the ticks and bounds (calc_axis_ticks.m), and also the demo file bug_demo_fix.m that solve the too dense or too sparse problem. (See bug #55876 for some flaw)

addlistener(gca, 'xlim', ...) seems not work well, so the true solution still need in the C++ part.

(file #46488, file #46489, file #46490)

Eddy <count>
Fri 08 Mar 2019 01:38:25 PM UTC, original submission:  

When semilogy plot hugely scaled data, or tiny scaled data, the ticks can be too dense or too sparse.


% Large scale range. Labels too dense.
figure (1);  semilogy (logspace (-50, 1, 100))

% small scale range. Labels too sparse.
figure (2);  semilogy (logspace (3, 3.7, 100))

% tiny scaling range, typically happens when zoom in. Labels too sparse.
figure (3);  semilogy (linspace (1, 1.01, 100))


This, of course, happens to semilogx and loglog also. It would be nice to fix all these, because it make the plot not very readable sometimes.

I write a Octave script to compute these ticks more pretty (attachment calc_axis_ticks.m). (BTW, the algorithm was adopted from my open source code).

The script can be used like this (see full version in attachment bug_demo_fix.m)


% Large scale range
figure(11)
semilogy (logspace (-50, 1, 100))
fix_axes_ticks (gca, 'y');


The resulting figure is attached: semilogy_demo.png. Figure 1,2,3 is original one, figure 11, 12, 13 is the fixed one.

I see a line in axes::properties::calc_ticks_and_lims, libinterp/corefcn/graphics.cc.


  tick_sep = 1;  // Tick is every order of magnitude (bug #39449)


Not sure if this feature request can be obtained easily by tuning that tick_sep.

Eddy <count>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46488:  calc_axis_ticks.m added by count (6KiB - text/x-objcsrc - updated algo and demo of fixing logscale ticks)
file #46489:  fix_axes_ticks.m added by count (4KiB - text/x-objcsrc - updated algo and demo of fixing logscale ticks)
file #46490:  bug_demo_fix.m added by count (329B - text/x-objcsrc - updated algo and demo of fixing logscale ticks)
file #46466:  semilogy_demo.png added by count (139KiB - image/png - demo of the fix of log ticks)
file #46467:  bug_demo_fix.m added by count (1KiB - text/x-objcsrc - demo of the fix of log ticks)
file #46468:  calc_axis_ticks.m added by count (6KiB - text/x-objcsrc - demo of the fix of log ticks)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by count (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
    2019-03-10 count Attached File- Added calc_axis_ticks.m, #46488
        Attached File- Added fix_axes_ticks.m, #46489
        Attached File- Added bug_demo_fix.m, #46490
    2019-03-08 count Attached File- Added semilogy_demo.png, #46466
        Attached File- Added bug_demo_fix.m, #46467
        Attached File- Added calc_axis_ticks.m, #46468

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code