# Logscale for Y-axes works for gr() but not for pyplot()

**URL:** https://discourse.julialang.org/t/logscale-for-y-axes-works-for-gr-but-not-for-pyplot/43945
**Category:** New to Julia
**Created:** [July 30, 2020, 3:34am UTC](https://discourse.julialang.org/t/logscale-for-y-axes-works-for-gr-but-not-for-pyplot/43945 "2020-07-30T03:34:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)
#### Post date: [July 30, 2020, 3:34am UTC](https://discourse.julialang.org/t/logscale-for-y-axes-works-for-gr-but-not-for-pyplot/43945/1 "2020-07-30T03:34:02Z")

</div>

Here is the code for gr()

```julia
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

 ![Screen Shot 2020-07-30 at 1.29.01 PM](https://global.discourse-cdn.com/julialang/original/3X/5/4/542116895104c1a818c2f66f670bc41c593cc689.png)

But when I change it from “gr()” to “pyplot()”, I get the following

```julia
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

 ![Screen Shot 2020-07-30 at 1.26.52 PM](https://global.discourse-cdn.com/julialang/original/3X/7/1/71e408e463bf6a18e2207b3e0045723314d745da.png)

What did I do wrong?
