Menu

#587 set command to specify minor tics on logarithmic axes

open
nobody
None
5
3 days ago
3 days ago
No

The current set mytics command, which specifies minor tic frequency, is not particularly well-suited for use with logarithmic axes. Therefore, I propose introducing a new command specifically designed for finer control of minor tics on log-scale axes.

Proposed Syntax

        set mylogtics m1 m2 m3 ...
  • This command would generate minor tics at positions such as 'm1* 10^k', 'm2 * 10^k', 'm3 * 10^k' between each major tic at '10^k' and '10^(k+1)'.
  • If a major tic exists at the same position as a generated minor tic, the major tic takes precedence.
  • If called without arguments, it defaults to set mylogtics 1 2 3 4 5 6 7 8 9.
  • The tic scale(length) at the position correspond to "1" in mylogtics is the same as that of the major tics (if this is unacceptable as a specification, it should be the same scale (length) as the minor tics instead).
  • This command only takes effect when the corresponding axis is in 'logscale' mode (e.g., set ytics logscale) and overrides the set mytics setting.
  • When set ytics nologscale is specified, the 'mylogtics' setting is ignored, and the mytics setting is used instead.
  • For other axis: mxlogtics, mylogtics, mzlogtics, ....

There might be a more suitable name than "mylogtics".

Example

For example, with the setting:

set yrange [1:1000]
set mylogtics 1 5

Minor tics would be placed at: 1, 5, 10, 50, 100, 500, and 1000.

In matplotlib, the keyword argument subs in LogLocator has the role of minor tick setting like above description. https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.LogLocator

I have prepared a script that emulates the behavior of the proposed set mylogtics command.
I would appreciate it if you could review it and let me know whether you find it useful.

1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 3 days ago

    I personally consider example plots 1, 2, and 3 in the emulation script to be terrible - to the point that I would consider it a bug if the program produced such a plot. The presence of minor tics with no corresponding major tics was, in fact, one of the complaints in Bug 2717.

    Plot 4 is fine. But you can get that exact plot now with the script below.

    set format x "10^{%L}" 
    set format y "10^{%L}" 
    set xtics border out scale 2,1 mirror
    set ytics border out scale 2,1 mirror
    
    set log xy
    set ytics 1000 
    set xrange [ 1.00000 : 1.00000e+12 ] noreverse
    plot x
    
     
  • Hiroki Motoyoshi

    Thank you for reply.

    The presence of minor tics with no corresponding major tics was, in fact, one of the complaints in Bug 2717.

    Well, I guess that’s true.

    • The length of the "1" tic in mylogtics is the same as that of the major tics

    OK, this is not a very important point. I may have been asking for too much, so I’ll take it back.

    Reviced Proposed Syntax Ver.2

    set mylogtics m1 m2 m3 ...
    
    • This command would generate minor tics at positions such as 'm1* 10^k', 'm2 * 10^k', 'm3 * 10^k' between each major tic at '10^k' and '10^(k+1)'.
    • If a major tic exists at the same position as a generated minor tic, the major tic takes precedence.
    • If called without arguments, it defaults to set mylogtics 1 2 3 4 5 6 7 8 9.
    • This command only takes effect when the corresponding axis is in 'logscale' mode (e.g., set ytics logscale) and overrides the set mytics setting.
    • When set ytics nologscale is specified, the 'mylogtics' setting is ignored, and the mytics setting is used instead.
    • For other axis: mxlogtics, mylogtics, mzlogtics, ....

    The modified emulation_script is also attached.

    I would be grateful if you could continue to give it some thought.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.