The minor ticks should respect the spacing of the current stretch.
I noticed that using LogNorm, the ticks used to be spaced incorrectly in Matplotlib 2.2 but this was fixed in Matplotlib 3.0. However, the minor ticks are still broken for custom normalizations as shown above.
changed the title [-]Issue with minor tick spacing in colorbar with custom Normalize classes[/-][+]Issue with minor tick spacing in colorbar with custom Normalize classe[/+]on Nov 14, 2018
changed the title [-]Issue with minor tick spacing in colorbar with custom Normalize classe[/-][+]Issue with minor tick spacing in colorbar with custom Normalize class[/+]on Nov 14, 2018
Just to be clear, it does work for major ticks, just not minor ticks.
It probably never worked for minor ticks, so it's not a regression, but it does seem like a bug compared to the expected behavior.
Just out of curiosity, since this does work for the major ticks, I'm curious why it would be difficult to extend this to minor ticks? (that is, the machinery is already in place for major ticks?).
If there is a reason this would be challenging, I wonder whether one solution would be to extend the code here:
OK, so this is basically an issue with the fact that there are no arbitrary norms/scales allowed for axes at present. A few have been made to work (LogNorm, SymLogNorm, etc), but the general solution hasn't been done.
In this case I assume the best outcome would be a stretched axes, with the major tick marks appearing to be constant in space, and minor ticks between, like a Log norm is presently handled. Thats not possible and would require adding to the axis API.
I'm going to close this in lieu of #12665 which boils down to the same issue, but its an excellent use case of the same functionality discussed there. Feel free to carry on the conversation there if you have input. I think we can/should try and add this, as also discussed in #11859
Activity
jklymak commented on Nov 14, 2018
Did this ever work? Making axes work for random normalizations is non-trivial, and probably requires some under-the-hood manipulation of scales....
astrofrog commented on Nov 14, 2018
Just to be clear, it does work for major ticks, just not minor ticks.
It probably never worked for minor ticks, so it's not a regression, but it does seem like a bug compared to the expected behavior.
Just out of curiosity, since this does work for the major ticks, I'm curious why it would be difficult to extend this to minor ticks? (that is, the machinery is already in place for major ticks?).
If there is a reason this would be challenging, I wonder whether one solution would be to extend the code here:
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colorbar.py#L490
to allow Normalize sub-classes to provide their own custom locators?
astrofrog commented on Nov 14, 2018
It does seem like there is a minor tick auto-locator:
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colorbar.py#L1222
But for some reason this isn't working here (I tried calling minorticks_on)
jklymak commented on Nov 15, 2018
OK, so this is basically an issue with the fact that there are no arbitrary norms/scales allowed for axes at present. A few have been made to work (LogNorm, SymLogNorm, etc), but the general solution hasn't been done.
In this case I assume the best outcome would be a stretched axes, with the major tick marks appearing to be constant in space, and minor ticks between, like a Log norm is presently handled. Thats not possible and would require adding to the axis API.
I'm going to close this in lieu of #12665 which boils down to the same issue, but its an excellent use case of the same functionality discussed there. Feel free to carry on the conversation there if you have input. I think we can/should try and add this, as also discussed in #11859
Thanks!