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
[ENH]: Indicating change of scale for symlog #29335
I appreciate that matplotlib provides various scales, including symlog.
However, I see the problem that it is not quite clear in the axis labels what happens.
Proposed solution
I propose to (at least optionally) insert automatically a break (like // ) on the axis at the transitions between lin and log scales.
Fundamentally, I believe this is a good idea. It's a bit difficult to implement though. Conceptually, we only have the locator, which determines tick positions. We don't have any infrastructure/API to handle the additional markers. Any automatism would need architectural changes.
A simple workaround would be a dedicated mark_symlog_linear_range() method that the user must call explicitly. It would add appropriate markers statically, but wouldn't update with a change of scale. - Possibly an example with such a function would be a good first step.
Dear Tim,
many thanks for the prompt reply.
Having such a method would indeed be great!
Kind regards,
Steffen
From: Tim Hoffmann ***@***.***>
Sent: Dienstag, 17. Dezember 2024 12:09
To: matplotlib/matplotlib ***@***.***>
Cc: Beirle, Steffen ***@***.***>; Author ***@***.***>
Subject: Re: [matplotlib/matplotlib] [ENH]: Indicating change of scale for symlog (Issue #29335)
Fundamentally, I believe this is a good idea. It's a bit difficult to implement though. Conceptually, we only have the locator, which determines tick positions. We don't have any infrastructure/API to handle the additional markers. Any automatism would need architectural changes.
A simple workaround would be a dedicated mark_symlog_linear_range() method that the user must call explicitly. It would add appropriate markers statically, but wouldn't update with a change of scale.
—
Reply to this email directly, view it on GitHub<#29335 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKY34PZAEUVYO3QM6IQIBX32GAA53AVCNFSM6AAAAABTYCONOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBYGE3DSNZRGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
defmark_symlog_linear_range(axis):
trafo=axis.get_transform()
ifnothasattr(trafo, "linthresh"):
raiseValueError("mark_symlog_linear_range() can only be applied to Axis with symmetrical log scale")
ifaxis.axis_name=='x':
axis.axes.axvspan(-trafo.linthresh, trafo.linthresh, -0.02, 0.0, clip_on=False, color='lightgray')
elifaxis.axis_name=='y':
axis.axes.axhspan(-trafo.linthresh, trafo.linthresh, -0.02, 0.0, clip_on=False, color='lightgray')
else:
raiseValueError("mark_symlog_linear_range() only works on x-axis and y-axis")
Usually people want the linear region to be imperceptible. If folks want the split in scales to be obvious there are lots of ways to do that which will depend on the reason for making it clear. Perhaps @timhoffm example above could be added to the examples page, but I don't think we could or should provide a universal method for indicating this.
Symlog should really be discouraged compared to asinh.
The linear region is a necessary deviation from the log scaling to be able to map data in a range (-x0, x0) onto a finite region. I agree with @jklymak that the linear range should typically a tiny fraction of the view range. It should be chosen to be slightly smaller than the absolute value of all “interesting data”.
We should better explain why it is necessary and how to use it, rather than adding tooling to visualize it. This explanation should likely go into https://matplotlib.org/devdocs/gallery/scales/symlog_demo.html and be cross-linked from https://matplotlib.org/devdocs/api/scale_api.html#matplotlib.scale.SymmetricalLogScale.
Activity
timhoffm commentedon Dec 17, 2024
Fundamentally, I believe this is a good idea. It's a bit difficult to implement though. Conceptually, we only have the locator, which determines tick positions. We don't have any infrastructure/API to handle the additional markers. Any automatism would need architectural changes.
A simple workaround would be a dedicated
mark_symlog_linear_range()method that the user must call explicitly. It would add appropriate markers statically, but wouldn't update with a change of scale. - Possibly an example with such a function would be a good first step.SteffenBeirle commentedon Dec 17, 2024
timhoffm commentedon Dec 17, 2024
One quick solution would be something like this:
Which then could be used as
jklymak commentedon Dec 17, 2024
Usually people want the linear region to be imperceptible. If folks want the split in scales to be obvious there are lots of ways to do that which will depend on the reason for making it clear. Perhaps @timhoffm example above could be added to the examples page, but I don't think we could or should provide a universal method for indicating this.
Symlog should really be discouraged compared to asinh.
timhoffm commentedon Dec 17, 2024
The linear region is a necessary deviation from the log scaling to be able to map data in a range (-x0, x0) onto a finite region. I agree with @jklymak that the linear range should typically a tiny fraction of the view range. It should be chosen to be slightly smaller than the absolute value of all “interesting data”.
We should better explain why it is necessary and how to use it, rather than adding tooling to visualize it. This explanation should likely go into https://matplotlib.org/devdocs/gallery/scales/symlog_demo.html and be cross-linked from https://matplotlib.org/devdocs/api/scale_api.html#matplotlib.scale.SymmetricalLogScale.
SteffenBeirle commentedon Dec 19, 2024
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale
DOC: Explain parameters linthresh and linscale of symlog scale (#29347)