0
0

More than 1 year has passed since last update.

VSCode で Julia の plot をするときの注意

Last updated at Posted at 2022-11-17

困ったけど日本語でググっても出なかったのでメモ

環境

  • windows10
  • VSCode
  • Julia-1.3.7

本文

using Plots

plot(sin)

のように書くと plot ができるが,

using Plots

plot(sin)
println("hoge")

のように plot の後に print をすると plot が表示されない

また,

using Plots

plot(sin)
plot(cos)

のように書くと $\cos$ のグラフしか表示されない

この対処法だが, display 関数を使うと上手くいくみたい

そもそも plot 関数は自動的に呼ばれた瞬間に出力はされていないらしい

using Plots

display(plot(sin))
println("hoge")
using Plots

display(plot(sin))
display(plot(cos))

のように書くことで, 期待する出力を得られる

なんでこっちがデフォルトじゃないんだ! とは思ったがまぁ確かに plot! で書き換えたり複数をまとめて出力したいときに困りそう

using Plots

p = plot(sin)

display(p)
display(p)

みたいな書き方もできる

0
0
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
0
0