I don't know about the formatters, but this doesn't look right. You have rho = 1 / m * 1000 = 1000 / m and m = 1 / rho / 1000 = 1e-3 / rho; those are not the inverse of each other.
I don't know about the formatters, but this doesn't look right. You have rho = 1 / m * 1000 = 1000 / m and m = 1 / rho / 1000 = 1e-3 / rho; those are not the inverse of each other.
Well spotted, i changed it - it doesn't change the outcome though.
Hi, I am on a new year resolution to start contributing to open source, and this looked like a good place to start :)
This bug happens because the default formatters for log scale override the formatters that have been set here explicitly (ScalarFormatter and NullFormatter).
The _secondary_axes.draw method calls self._set_scale, which calls self.set_xscale, which calls _set_scale method below:
Sorry, @lepuchi, it seems this fell through somehow. Your contribution is very welcome. Please feel free to open a pull request with the envisionned changes, which would make it easier to see them in action. There might be a few edge cases to consider, e.g. what happens if the scale of the original axes changes? So adding test cases would be helpful.
Activity
QuLogic commented on Nov 7, 2019
I don't know about the formatters, but this doesn't look right. You have rho = 1 / m * 1000 = 1000 / m and m = 1 / rho / 1000 = 1e-3 / rho; those are not the inverse of each other.
fmikulasch commented on Nov 7, 2019
Well spotted, i changed it - it doesn't change the outcome though.
sujanasowrirajan commented on Jan 7, 2020
Hi, I am on a new year resolution to start contributing to open source, and this looked like a good place to start :)
This bug happens because the default formatters for log scale override the formatters that have been set here explicitly (ScalarFormatter and NullFormatter).
The _secondary_axes.draw method calls self._set_scale, which calls self.set_xscale, which calls _set_scale method below:
def _set_scale(self, value, **kwargs): self._scale = mscale.scale_factory(value, self, **kwargs) self._scale.set_default_locators_and_formatters(self) # Overrides existing formatters and locators self.isDefault_majloc = True self.isDefault_minloc = True self.isDefault_majfmt = True self.isDefault_minfmt = TrueI think we should set default values only if formatters/locators do not already exist, something like:
def _set_scale(self, value, **kwargs): self._scale = mscale.scale_factory(value, self, **kwargs) major_formatter = self.get_major_formatter() minor_formatter = self.get_minor_formatter() major_locator = self.get_major_locator() minor_locator = self.get_minor_locator() self._scale.set_default_locators_and_formatters(self) if major_formatter: self.set_major_formatter(major_formatter) else: self.isDefault_majloc = True if minor_formatter: self.set_minor_formatter(minor_formatter) else: self.isDefault_minloc = True if major_locator: self.set_major_locator(major_locator) else: self.isDefault_majfmt = True if minor_locator: self.set_minor_locator(minor_locator) else: self.isDefault_minfmt = TrueWlodarski commented on Feb 22, 2020
Thank you @lepuchi
This bug was making me crazy. I applied your tentative correction and a software that was behaving capriciously suddenly works like expected.
ImportanceOfBeingErnest commented on Feb 22, 2020
Sorry, @lepuchi, it seems this fell through somehow. Your contribution is very welcome. Please feel free to open a pull request with the envisionned changes, which would make it easier to see them in action. There might be a few edge cases to consider, e.g. what happens if the scale of the original axes changes? So adding test cases would be helpful.
jklymak commented on Feb 22, 2020
I'd have to think about this. The logic is a bit convoluted because the parent and child have to know about each other's scale.
jklymak commented on Feb 25, 2020
Does #14592 address this?
ImportanceOfBeingErnest commented on Feb 25, 2020
#14592 indeed addresses this issue.
jklymak commented on Feb 25, 2020
Closing because #14592 is merged, but if #14592 does not actually fix the problem please re-open.