I have a function, foo(x), which is defined only on the negative real axis. The range is quite wide and I want to plot it in log-scale, say from x=-1.0e7 to x=-1.0e-7. How can I “transform” the axis in Makie to allow this “negative” logscale? I can transform y=-x by myself, of course, but then the plot is from +1.0e-7 to +1.0e+7, i.e. mirrored left-right… I cannot re-mirror it by setting the xlims (no output); I guess that the transform is flipping because of negative values in log scale.
You can re-mirror by setting ax.xreversed = true? The tick labels will be positive of course, one could change that via formatting but it’s a little annoying I guess. Another option would be to add negative_log as an axis scale function. Here’s how you’d do that, it’s not really documented because it’s not something people often do. I’m hijacking the functionality for normal log ticks by running the tick finding on the positive mirror values and converting back.
ERROR: Found invalid x-limits (-10000.0f0, 0.0f0) for scale neglog10 which is defined on the interval -Inf..0.0 (open)
seems like the float32 conversion lets the max value round up to 0, which is not allowed for log scale. There’s an open PR to fix such issues by switching to Float64, at least for CairoMakie.