Here is the code for gr()
using Plots
gr()
function getLogTicks(vector,count=1)
function poststr(expnum)
n = Int64(expnum) ÷ 3
if n == 0
return ""
elseif n == 1
return "k"
else
return "×\$10^{$(n*3)}\$"
end
end
min = ceil(log10(minimum(vector)))
max = floor(log10(maximum(vector)))
major = [ [k*n for k = 1:count] for n in 10 .^ collect(min:max) ]
major = hcat(major...)
major = vec(major)
major = filter(x->x<=maximum(vector),major)
majorText = ["$(Int64(j*10^(i%3)))$(poststr(i))" for i=min:max for j=1:count]
majorText = majorText[1:length(major)]
minor = [j*10^i for i=(min-1):(max+1) for j=(count+1):9]
minor = minor[findall(minimum(vector) .<= minor .<= maximum(vector))]
([major; minor], [majorText; fill("", length(minor))])
end
yticks_scale = getLogTicks( collect(1:2000) )
plot(1:2000,1:2000,yaxis=:log10, yticks=yticks_scale)
with the resultant graph
But when I change it from “gr()” to “pyplot()”, I get the following
using Plots
pyplot()
function getLogTicks(vector,count=1)
function poststr(expnum)
n = Int64(expnum) ÷ 3
if n == 0
return ""
elseif n == 1
return "k"
else
return "×\$10^{$(n*3)}\$"
end
end
min = ceil(log10(minimum(vector)))
max = floor(log10(maximum(vector)))
major = [ [k*n for k = 1:count] for n in 10 .^ collect(min:max) ]
major = hcat(major...)
major = vec(major)
major = filter(x->x<=maximum(vector),major)
majorText = ["$(Int64(j*10^(i%3)))$(poststr(i))" for i=min:max for j=1:count]
majorText = majorText[1:length(major)]
minor = [j*10^i for i=(min-1):(max+1) for j=(count+1):9]
minor = minor[findall(minimum(vector) .<= minor .<= maximum(vector))]
([major; minor], [majorText; fill("", length(minor))])
end
yticks_scale = getLogTicks( collect(1:2000) )
plot(1:2000,1:2000,yaxis=:log10, yticks=yticks_scale)
with the resultant graph
What did I do wrong?