Skip to content

Conversation

@pjaap
Copy link
Member

@pjaap pjaap commented Jan 9, 2026

For plotting doping profiles, we need logarithmic scales but also zero values.

Matplotlib and Makie offer "symmetric log scaling" for this: https://matplotlib.org/stable/gallery/scales/symlog_demo.html and pseudolog10 https://docs.makie.org/stable/reference/blocks/axis#yscale

This can be added to GridVisualize by a few lines of code.

PlutoVista and Plots do not support this. A warning is generated (and the scaling is set to :identity) if the user sets :symlog.

@j-fu
Copy link
Member

j-fu commented Jan 9, 2026

Good idea!

Is Matplotlibs symlog the same as pseudolog10 ?

As for plutovista, we could think about some approximation to this, a good solution would require an implementation in Plotly.js.

@pjaap
Copy link
Member Author

pjaap commented Jan 9, 2026

Pseudolog10 is sign(x) * log10(abs(x) + 1) and differs from symlog which requires an argument where to switch from linear to log.

I like the idea of an argumentless variant. But for consistency, we can also use Makie's Symlog10, which should be the same as in Matplotlib.

The default parameter is 10, where we switch from linear to log. Should this be a possible user input like :symlogthreshold? I'm not sure if this makes things better

@j-fu
Copy link
Member

j-fu commented Jan 9, 2026

I think it should be the same for makie and for pyplot. Also, an additional parameter seems to make sense. Are there examples what people use in publications ? Does matlab have something like this ?

@pjaap
Copy link
Member Author

pjaap commented Jan 9, 2026

ok, I'll change it to Symlog10 and add a custom threshold parameter with default 10.

Regarding MATLAB: no idea. There is "symlog" https://de.mathworks.com/matlabcentral/fileexchange/57902-symlog, but this is ironically not Matplotlib's symlog but rather pseudolog10 ...

@pjaap pjaap merged commit 72f8677 into main Jan 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants