裏 RjpWiki

Julia ときどき R, Python によるコンピュータプログラム,コンピュータ・サイエンス,統計学

Julia で青海波を描く

2021年08月10日 | ブログラミング

Julia で青海波を描く

plotter.jl を include
https://blog.goo.ne.jp/r-de-r/e/bd71a52a09801335d56f7c47d879bfe3

include("plotter.jl")

function seigaiha(nx=6, ny=6; r=1, color=:deepskyblue2, width=720, height=360)
    function unit(x, y)
        for i = 6r:-r:1
            col = i % 2 == 1 ? :white : color
            plotcircle(x, y, i, startangle=0, endangle=180, col=col, fcol=col)
        end
    end
    plotbegin(w=width, h=height)
    for j = 2ny:-1:0
        for i = 0:nx
            unit(i*12r + (j % 2)*6r, j*3r)
        end
    end
    x1, y1 = 0, 3r
    x2, y2 = 12nx*r, (6ny+3)r
    plotlimit(x1, y1, x2, y2)
    println("(width, height) = ($(x2 - x1), $(Int(y2 - y1)))")
    plotend()
    savefig("parts.pdf")
end

seigaiha()
savefig("fig1.png")

コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 描画関数を組み合わせて「麻... | トップ | Julia で亀甲ベースの格子模... »
最新の画像もっと見る

コメントを投稿

ブログラミング」カテゴリの最新記事