octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55864] semilogy plot ticks could be too dense


From: Eddy
Subject: [Octave-bug-tracker] [bug #55864] semilogy plot ticks could be too dense or too sparse
Date: Fri, 8 Mar 2019 08:38:27 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

URL:
  <https://savannah.gnu.org/bugs/?55864>

                 Summary: semilogy plot ticks could be too dense or too sparse
                 Project: GNU Octave
            Submitted by: count
            Submitted on: 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: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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
<https://github.com/bewantbe/audio-analyzer-for-android/blob/6cc84dc789811cd3d39aaebe2635a367b7eceacf/audioSpectrumAnalyzer/src/main/java/github/bewantbe/audio_analyzer_for_android/GridLabel.java#L165>).

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 08 Mar 2019 01:38:25 PM UTC  Name: semilogy_demo.png  Size: 139KiB  
By: count
demo of the fix of log ticks
<http://savannah.gnu.org/bugs/download.php?file_id=46466>
-------------------------------------------------------
Date: Fri 08 Mar 2019 01:38:25 PM UTC  Name: bug_demo_fix.m  Size: 1KiB   By:
count
demo of the fix of log ticks
<http://savannah.gnu.org/bugs/download.php?file_id=46467>
-------------------------------------------------------
Date: Fri 08 Mar 2019 01:38:25 PM UTC  Name: calc_axis_ticks.m  Size: 6KiB  
By: count
demo of the fix of log ticks
<http://savannah.gnu.org/bugs/download.php?file_id=46468>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55864>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]