ujimushi(@旧sradjp(15364))の日記

旧スラドの日記の引越先です

How to not plot axis ticks on top and right in Plots.jl with GR backend?[勝手に回答]

今回も勝手に回答御用達サイトJulia Discourseから,How to not plot axis ticks on top and right in Plots.jl with GR backend?という質問です。

:boxのスタイルで,上と右のtickを消したい,ということのようです。

私が提案する解決策としては,:semiのスタイルから上辺と右辺のボーダー線を薄くしなければOKのような気がします。

いつもの関数書き換え手法をとります。

using Plots

@eval Plots begin
    gr_draw_border(sp, axis, segments, func = gr_polyline) =
        if sp[:framestyle] in (:box, :semi)
            # intensity = sp[:framestyle] === :semi ? 0.5 : 1
            intensity = 1
            GR.setclip(0)
            gr_set_line(intensity, :solid, axis[:foreground_color_border], sp)
            gr_set_transparency(axis[:foreground_color_border], intensity)
            func(coords(segments)...)
            GR.setclip(1)
        end
end

plot(1:10, 1:10, framestyle=:semi)
savefig("box-semi-style.png")