Menu

#587 set command to specify minor tics on logarithmic axes

open
nobody
None
5
2025-05-07
2025-05-03
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 - 2025-05-03

    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.

     
    • Ethan Merritt

      Ethan Merritt - 2025-05-07

      The plots in version 2 of the emulation script still look very wrong to me. When the spacing between major tics is more than one log unit, e.g. 10^0 10^2 10^4 10^6, it makes no sense to place multiple sets of minor tics between them. It does make some sense to place a single minor tic at each of the skipped major tics, (in this case 10^1 10^3 10^5). That is the final plot in your emulation script, but that's also what the program does now.

      I think the proposed new command is addressing a need that doesn't really exist. I can't think of any type of real-world data presentation that would need them. Can you point to an example of one, maybe a figure in a published paper or textbook?

       
      • Hiroki Motoyoshi

        As you said, this may be a rarely used feature, but, as for me, there are cases where minor tics are too densely packed, and users may want to emphasize only the value 5, for example. The key point of this proposal is that minor tics should be placed precisely at the user-specified positions. Since the implementation would likely be complex, and I've also found that it's easy to achieve the same result using the method in the emulation script, I think it would be understandable if the proposal were rejected.

        At the root of this proposal is the inadequacy of "mytics". It gives the impression that one can control the minor tics on a log scale, but in reality, it provides no meaningful functionality. For instance, if you use set mytics 2, it generates only one minor tic between 1 and 10, but the position is 5.5—which can easily be mistaken for 5.0 unless you look very closely. With that in mind, I think it would be better if "mytics" on a log scale simply acted as an on/off switch, regardless of what values are provided as the frequency value.

         
      • Hiroki Motoyoshi

        I think the proposed new command is addressing a need that doesn't really exist. I can't think of any type of real-world data presentation that would need them. Can you point to an example of one, maybe a figure in a published paper or textbook?

        For example,

        Particle Data Group Collaboration 2024, 'Review of particle physics', Physical Review D, vol. 110, no. 3, 030001. https://doi.org/10.1103/PhysRevD.110.030001 [Open Access]

        -> Fig. 11.4 (P.228), Fig. 19.2 (P.390), Fig. 37.1 (P.680) Fig 37.3 (P.681) Fig.37.6 (P.682)

        gnuplot IN ACTION (Second edition) Philipp K. Janert.

        -> Fig in P.43, Fig. 13.7 (P.298)

         

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.