LoginSignup
1
1

More than 5 years have passed since last update.

Juliaでインタラクティブプロット(Multi Cursor編)

Posted at

本稿ではJuliaによるmatplotlibを使ったインタラクティブプロット(Multi Cursor編)について紹介します.
基本的には本家サイトにあるmatplotlib.widgetsのサンプルソースの移植版です.

multi_cursor.jl
#Translated from python to julia (reffer to https://matplotlib.org/examples/widgets/multicursor.html)
#Julia v0.6.2
#PyCall v3.6.4

using PyCall
using PyPlot

const MultiCursor = matplotlib[:widgets][:MultiCursor]

t = 0:0.01:2.0
s1 = sin.(2*π*t)
s2 = sin.(4*π*t)
fig = figure()
ax1 = fig[:add_subplot](211)
ax1[:plot](t, s1)

ax2 = fig[:add_subplot](212, sharex=ax1)
ax2[:plot](t, s2)

multi = MultiCursor(fig[:canvas], (ax1, ax2), color="r", lw=1)
show()

スクリーンショット 2018-05-10 22.17.46.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1