You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add additional minor labels in log axis with a span less than two decades #4867
For plots with log axis that have limits of the order or less than two decades, only one label is shown:
Which does not give a very good idea of the values of the x axis. Adding labels to the minor ticks results in a mess, including non-helpful labels such as 10^{4.30}:
The decimals in the exponent can be resolved using LogFormatter, but it is not a nice representation for axis and requires changing the major formatter to match:
Finally, the only way to get them in a consistent manner with the major tick labels, while preserving all minor ticks, is to set them manually, which is far from ideal:
I think that there should be a LogFormatterMathtext with a subs options like the locator, and an option to factors instead of decimal exponents. I will take a look at the LogFormatterMathtext and try to modify it in the following days. If it looks good, I would propose to switch to it automatically for axis spanning less than two decades.
Note that this issue has been reported in a stackoverflow question where a custom formatter is proposed as an answer.
This is somewhat related to the issue #4730 because the lack of labels is particularly noticeable when the axis is around 0.1,1,10, where it would make a lot of sense to have labels at [0.1,0.2,2,5,20,50].
In my field (high energy astrophysics) they are extremely common: the
gamma-ray photon spectra of an astrophysical source will almost always
follow a powerlaw behaviour, and the energy detection band for a single
instrument is rarely larger than two decades (often less than one), so the
plotted spectra from a single instrument are always like this. It might be
a corner case, but I brought it up as it comes up very often in my use of
matplotlib.
This would be useful for the gammapy and naima packages, which deal with gamma-ray spectra
and use matplotlib for plotting.
Fair enough. I come from a soft-matter physics background where we are looking for power laws in noisy data, with less than 2 decades just about any powerlaw can be made to fit, hence my skepticism.
Fair enough. I come from a soft-matter physics background where we are
looking for power laws in noisy data, with less than 2 decades just about
any powerlaw can be made to fit, hence my skepticism.
Reply to this email directly or view it on GitHub: #4867 (comment)
Activity
tacaswell commentedon Aug 5, 2015
I am somewhat ambivalent on this as I am not convinced of the utility of log scaled axis with less than 2 decades of data.
zblz commentedon Aug 5, 2015
In my field (high energy astrophysics) they are extremely common: the
gamma-ray photon spectra of an astrophysical source will almost always
follow a powerlaw behaviour, and the energy detection band for a single
instrument is rarely larger than two decades (often less than one), so the
plotted spectra from a single instrument are always like this. It might be
a corner case, but I brought it up as it comes up very often in my use of
matplotlib.
This would be useful for the gammapy and
naima packages, which deal with gamma-ray spectra
and use matplotlib for plotting.
2015-08-05 14:46 GMT+01:00 Thomas A Caswell [email protected]:
tacaswell commentedon Aug 5, 2015
Fair enough. I come from a soft-matter physics background where we are looking for power laws in noisy data, with less than 2 decades just about any powerlaw can be made to fit, hence my skepticism.
efiring commentedon Aug 5, 2015
Another case where it would be nice to have labels for a short span of
a log scale is when one zooms in on a feature in a spectrum.
On 8/5/15, Thomas A Caswell [email protected] wrote:
QuLogic commentedon Dec 12, 2016
Is this fixed by the above PR?
efiring commentedon Dec 12, 2016
It was, but that was reverted by #7000, and then a modified version was restored by #7419.