裏 RjpWiki

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

Julia: 東京から世界までの距離

2022年08月31日 | Julia

東京から世界までの距離

定数値が何箇所にも出るのとか,plot!() を何回も書くのとかを書き直して,場所も追加変更してみた。

using GMT

# Tokyo
lon  = 139.76
lat  = 35.68
Gdist = gmt("grdmath -Rg -I1 $lon $lat SDIST")

coast(region=:global, land=:lightgreen, ocean=:blue, area=1000,
     frame=(grid=30, title="Distances from Tokyo to the World"),
     shore=:thinnest, proj=(name=:Hammer, center=90),
     figsize=20, portrait=false)
grdcontour!(Gdist, annot=(int=1000, labels=(curved=true, unit="\" km\"",
            font="white")), labels=(line="Z-/Z+",), smooth=8, cont=500,
            pen=((contour=true, pen="thinnest,white,-"),
            (annot=true, pen="thin,white")) )

# Location info for any other cities + label justification
cities = [30.50 50.45; 9.42 0.38; 0 -90; 282.95  -12.1; 151.21 -33.87; 237.67 47.58; 28.20 -25.75; 12.5 41.99];
just_names = ["LT KYIV", "RM LIBREVILLE", "RM SOUTH POLE", "LM LIMA", "LM SYDNEY", "RT SEATTLE", "LM PRETORIA", "RM ROME"];
D = text_record(cities, just_names)

# For each of the cities, plot great circle arc to Rome with gmt psxy
for i in 1:size(cities, 1)
    plot!([lon lat; cities[i, 1] cities[i, 2]], lw=:thickest, lc=:red)
end

# Plot red squares at cities and plot names:
plot!(cities, marker=:square, ms=0.2, fill=:red, markerline=:thinnest)
text!(D, offset=(away=true, shift=(0.15, 0)), font=(12, "Courier-Bold", :red),
      justify=true, no_clip=true)

# Place a yellow star at Tokyo
plot!([lon lat], marker=:star, ms=0.5, fill=:yellow, ml=:thin)

# Sample the distance grid at the cities and use the distance in km for labels
dist = grdtrack(Gdist, D);
text!(round.(dist), offset=(0, -0.5), noclip=true, fill=:white, pen=true, clearance=0.05,
      font=(12,"Helvetica-Bold"), justify=:CT, zvalues="%.0f", show=true)


コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 【数学のひっかけ問題】三角... | トップ | Octave でトーラスを描いてみた »
最新の画像もっと見る

コメントを投稿

Julia」カテゴリの最新記事