I want to plot x/y data (lines) using a symlog scale. I wrote 2 functions to convert the data points and one to adapt the ticks. So basically I can do:
using Plots
x = collect(-10:0.01:10)
y = collect(-10:0.01:10)
plot(x, symlog(y,-3.0), yformatter=x->symlogformatter(x, -3.0))
How can I extend the plot function to use the argument yscale = SymLog(-3)
?
The two crude functions look like this:
function symlog(x,n=-3)
result = zeros(size(x,1))
for i in 1:size(x,1)
result[i] = sign(x[i])*(log10(1+abs(x[i])/(10^n)))
end
result
end
function symlogformatter(x,n)
if sign(x) == 0
"10^$(n)"
else
s = sign(x)==1 ? "+" : "-"
nexp = sign(x)*(abs(x) + n)
if sign(x) == -1
nexp = -nexp
end
s*"10^$(nexp)"
end
end