Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogTicks works poorly with pseudolog10 #4856

Open
Moelf opened this issue Mar 8, 2025 · 4 comments
Open

LogTicks works poorly with pseudolog10 #4856

Moelf opened this issue Mar 8, 2025 · 4 comments
Labels

Comments

@Moelf
Copy link
Contributor

Moelf commented Mar 8, 2025

scatter(10.0 .^ (-1:7),
    axis=(; yticks=LogTicks(-1:8), yscale=Makie.pseudolog10)
)

Image

@Moelf Moelf added the bug label Mar 8, 2025
@asinghvi17
Copy link
Member

I guess it's applying the wrong function...might need a specialized tick finder

@Moelf
Copy link
Contributor Author

Moelf commented Mar 8, 2025

I will investigate

@Moelf
Copy link
Contributor Author

Moelf commented Mar 8, 2025

diff --git a/src/makielayout/lineaxis.jl b/src/makielayout/lineaxis.jl
index d6db1b4e6..fd1532b4c 100644
--- a/src/makielayout/lineaxis.jl
+++ b/src/makielayout/lineaxis.jl
@@ -593,6 +593,7 @@ function get_ticks(tickfunction::Function, _, formatter, vmin, vmax)
     return tickvalues, ticklabels
 end

+_logbase(::typeof(pseudolog10)) = "10"
 _logbase(::typeof(log10)) = "10"
 _logbase(::typeof(log2)) = "2"
 _logbase(::typeof(log)) = "e"
@@ -603,7 +604,7 @@ function get_ticks(::Automatic, scale::LogFunctions, any_formatter, vmin, vmax)
 end

 # log ticks just use the normal pipeline but with log'd limits, then transform the labels
-function get_ticks(l::LogTicks, scale::LogFunctions, ::Automatic, vmin, vmax)
+function get_ticks(l::LogTicks, scale::Union{LogFunctions, typeof(pseudolog10)}, ::Automatic, vmin, vmax)
     ticks_scaled = get_tickvalues(l.linear_ticks, identity, scale(vmin), scale(vmax))

     ticks = Makie.inverse_transform(scale).(ticks_scaled)

does this seem reasonable?

Image

@Moelf
Copy link
Contributor Author

Moelf commented Mar 8, 2025

I don't know if I should add symlog10 and pseudolog10 into the Union of LogFunctions, let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants