履歴: プログラミング/julia/グラフの書き方

各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 15 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます

日時タイトル文字数追加削除内容差分基準
2026/8/25 10:02:05プログラミング/julia/グラフの書き方 最新版16,566+1 -31表示差分—
2026/8/25 10:02:05プログラミング/julia/グラフの書き方 18,217+5 -1表示表示中選択
2022/2/18 21:21:27プログラミング/julia/グラフの書き方 18,068+31 -0表示差分選択
2018/5/11 2:15:44プログラミング/julia/グラフの書き方 16,422+1 -1表示差分選択
2018/5/11 2:15:44プログラミング/julia/グラフの書き方 16,413+19 -11表示差分選択
2018/4/13 11:11:37プログラミング/julia/グラフの書き方 16,289+9 -0表示差分選択
2018/4/11 13:57:14プログラミング/julia/グラフの書き方 16,061+20 -1表示差分選択
2018/4/6 8:43:24プログラミング/julia/グラフの書き方 15,565+82 -15表示差分選択
2018/4/6 8:12:48プログラミング/julia/グラフの書き方 13,784+40 -18表示差分基準
2018/4/5 18:38:44プログラミング/julia/グラフの書き方 13,188+39 -24表示差分選択
2018/4/5 17:40:09プログラミング/julia/グラフの書き方 13,433+259 -29表示差分選択
2018/4/5 12:09:20プログラミング/julia/グラフの書き方 5,346+92 -0表示差分選択
2018/4/4 8:59:33プログラミング/julia/グラフの書き方 3,560+83 -0表示差分選択
2018/4/3 16:11:57プログラミング/julia/グラフの書き方 656+15 -0表示差分選択
2018/4/3 12:17:57プログラミング/julia/グラフの書き方 321— —表示—選択

基準: プログラミング/julia/グラフの書き方 (2018/4/6 8:12:48) → 比較: プログラミング/julia/グラフの書き方 (2026/8/25 10:02:05)

@@ -1,3 +1,4 @@
+#author("2026-08-25T01:02:05+00:00","","")
[[プログラミング/julia]]
* 目次 [#feeedfdd]
@@ -85,41 +86,108 @@
** 表示例 [#fb42c0f4]
それぞれの表示はこんな感じ。~
-- Plotly の円グラフの表示がおかしい
-- PyPlot の円グラフが楕円になってしまっている
+- PyPlot は一番問題が少ないが、出力は png なので拡大すると粗い
+- GD は Surface プロットができない
+- Plotly は layout でグラフを複数並べると円グラフや3Dグラフの表示がおかしくなる
+-- 単体なら問題ない
+- PGFPlots は Surface, Pie, WireFrame, HeatMap プロットができない
-&ref(test-julia-plots.png,,50%);
+共通コードはこちら:~
+ 各種グラフを書くためのコードサンプルになるはず。
+ LANG:julia
+ using Plots
+
+ data1d=rand(10)
+ data1d2=rand(10)
+ data1d3=rand(10)
+ data2d=[rand()/5 + exp(-(x^2+y^2)/100) for x in -10:10, y in -10:10]
+ data1dp=0:2pi/10:2pi;
+
+ function example(no3d=false,forpgf=false)
+ plot(
+ plot(data1d),
+ plot(data1d,xscale=:log10,yscale=:log10),
+ plot(data1d,seriestype=:steppre),
+ plot(data1d,seriestype=:step),
+ plot(data1d,seriestype=:scatter),
+ plot(data1d,seriestype=:bar),
+ forpgf ? plot() : plot(data1d,seriestype=:pie),
+ plot(data2d,seriestype=:contour,legend=:none),
+ plot(data2d,seriestype=:contour,fill=true,legend=:none),
+ no3d ? plot() : plot(data2d,seriestype=:surface,legend=:none),
+ forpgf ? plot() : plot(data2d,seriestype=:wireframe),
+ forpgf ? plot() : plot(data2d,seriestype=:heatmap,legend=:none),
+ plot(data1dp,data1d,proj=:polar),
+ plot(data1d,data1d2,data1d2,seriestype=:scatter3d),
+ plot(data1d,data1d2,data1d2),
+ plot([0,1,0,-1],[-1,0,1,0],seriestype=:shape),
+ layout=(4,4),size=(800,800),legend=:none
+ )
+ end
+
+*** PyPlot [#w98b3df9]
+
+&ref(test-julia-pyplot.png,,50%);
+
+*** GR [#td670520]
+
+&ref(test-julia-gr.png,,50%);
+
+*** Plotly [#md3b9bb9]
+
+&ref(test-julia-plotly.png,,50%);
+
+あまりにひどいので、表示のおかしなものをすべて取り去ったところこうなった。
+
+&ref(test-julia-plotly2.png,,50%);
+
+複数グラフを layout で並べて表示するのが不得意なだけで、
+ここでおかしかったものも単体で表示する分にはまともに表示される。
+
+対数スケールの軸がキレイに表示されているのは Plotly だけだった。
+*** PGFPlots [#ad69e624]
+
+&ref(test-julia-pgfplots.png,,50%);
+
+*** svg vs png [#ob14598b]
+
GR のグラフは拡大してもキレイ
-&ref(test-julia-plots-gr.png,border,50%);
+&ref(test-julia-plots-gr.png,border);
-PyPlot のグラフはぼやける
+PyPlot のグラフは拡大するとぼやける
-&ref(test-julia-plots-pyplot.png,border,50%);
+&ref(test-julia-plots-pyplot.png,border);
-Plotly のグラフはインタラクティブに編集できる。
+*** Plotly のグラフはインタラクティブに編集できるが・・・ [#dd1ca975]
+ぐりぐり動く。
+
&attachref(test-julia-plots-plotly.gif,border,50%);
-でもブラウザ上でリロードするだけで、Plotly のグラフは
+&attachref(test-julia-plots-plotly2.gif,border);
- Javascript error adding output!
- ReferenceError: Plotly is not defined
- See your browser Javascript console for more details.
+でも、ブラウザ上でリロードするだけで、
-などというエラーが出て表示されなくなってしまう。
+>COLOR(RED){Javascript error adding output!}
+>COLOR(RED){ReferenceError: Plotly is not defined}
+>COLOR(RED){See your browser Javascript console for more details.}
+などというエラーが出てグラフが表示されなくなってしまう。
+
Gist 上でも無理。
-#gist(osamutake/da4856f49e025e4646214a0ce690ba06);
+#gist(osamutake/88c0d0676fe659df23769d2bdbcc21b6);
nbviewer でもダメだった。
-http://nbviewer.jupyter.org/gist/osamutake/da4856f49e025e4646214a0ce690ba06
+http://nbviewer.jupyter.org/gist/osamutake/88c0d0676fe659df23769d2bdbcc21b6
-** gist から nbviewer への飛び方 [#j586e609]
+*** gist から nbviewer への飛び方 [#j586e609]
+ちょっとオフトピだけど・・・
+
gist 上で .ipynb を見たとき、右上に θ マークが表示されている場合があり、
そこにカーソルを合わせると nbviewer へのリンクが出るのだけれど、
@@ -144,6 +212,8 @@
* バックエンドライブラリのインストール [#t3742bc9]
+結構いろいろ大変。~
+先人達の足跡を探すのに非常に時間がかかる。。。
** GR のインストール [#b191daad]
LANG:console
@@ -306,15 +376,6 @@
と言われ、PyCall を build する必要があった。
-@gif を使ってアニメーションをしようとしたところ、
-
- could not spawn `ffmpeg -v 0 -i /tmp/tmpsIoz72/%06d.png -vf palettegen=stats_mode=diff -y /tmp/tmpsIoz72/palette.bmp`: no such file or directory (ENOENT)
-
-と言われた
-
- LANG:console
- $ sudo apt-get install ffmpeg
-
*** 正しい手順 [#e720f643]
LANG:console
@@ -443,6 +504,52 @@
こうかな。
+* Plots.plot に関数を与えるだけでグラフを書ける [#a6b4f0f6]
+
+あまり用例を見ないのだけれど、直接関数を与えてグラフが書ける。とても便利。
+
+&ref(plot-function1.png);
+
+&ref(plot-function2.png);
+
+ただ今のところ、グラフがカクカクになってしまったときにサンプリング点数を増やす方法が分からなくて困ってる。
+* @manipulate でインタラクティブにパラメータを変えられる [#a67f1d22]
+
+Interact モジュールと widget/extension を使う。
+
+実際には、あらかじめパラメータを変えたグラフをすべて用意しておき、
+入力値に従って切り替えて表示しているっぽい。
+
+&ref(プログラミング/julia/インストール/jupyter-interact.gif,border,50%);
+
+* @gif で手軽に GIF アニメが作れる [#x1fb558d]
+
+@gif を使ってアニメーションをしようとしたところ、
+
+ could not spawn `ffmpeg -v 0 -i /tmp/tmpsIoz72/%06d.png -vf palettegen=stats_mode=diff -y /tmp/tmpsIoz72/palette.bmp`: no such file or directory (ENOENT)
+
+と言われた
+
+ LANG:console
+ $ sudo apt-get install ffmpeg
+
+
+* @recipe について [#a636756b]
+
+勉強せねば。
+
+https://github.com/JuliaPlots/PlotDocs.jl/blob/master/docs/src/recipes.md
+
+* 関数のグラフをキレイに描くためのモジュールを作った [#pbbb38b8]
+
+http://nbviewer.jupyter.org/gist/osamutake/9fa7918013c1af17c50666bafb3469d0
+
+なんか、表示されなくなってしまったので gist への直リンクをこちらに。
+
+https://gist.github.com/osamutake/9fa7918013c1af17c50666bafb3469d0
+
+&ref(funcplot.png,,50%);
+
* このあたりを見る? [#v8a20489]
Plots/GR: グラフ package のおすすめ~
@@ -463,7 +570,38 @@
PlotThemes~
https://github.com/JuliaPlots/PlotThemes.jl
-
+PGFPlots.ipynb~
+http://nbviewer.jupyter.org/github/sisl/PGFPlots.jl/blob/master/doc/PGFPlots.ipynb
* コメント・質問 [#xbcaa13f]
#article_kcaptcha
+**Research on tutorials you can use for your site [#i6449b0a]
+>[[Vinay Tomar]] (&timetag(2022-02-18T12:21:27+09:00, 2022-02-18 (金) 21:21:27);)~
+~
+Hey,~
+~
+I’ve been an avid reader of https://dora.bk.tsukuba.ac.jp/~takeuchi/?%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%2Fjulia%2F%E3%82%B0%E3%83%A9%E3%83%95%E3%81%AE%E6%9B%B8%E3%81%8D%E6%96%B9 for quite some time now – and I really love how detailed and well-researched your guides are.~
+~
+I can only imagine the time you spent working on those.~
+Anyway, I noticed that you’ve been writing a lot about python lately. I have a resource on learning Python that talks about exactly that.~
+~
+Guru99 has a huge list of software learning library across topics like Linux, Java ,PHP ,SQL ,Ethical Hacking, python any more with new courses added every month.~
+~
+In this Python for beginners tutorial, you will learn Python installation, variables, Data structure, loops, strings, functions, file handling, Python SciPy, Python JSON, Python with MySQL, matrix, Python List, Python Regex, PyTest, PyQt, multithreading, Python interview questions, and many more interesting Python concepts.~
+~
+You can see the full Python tutorial here: https://www.guru99.com/python-tutorials.html ~
+~
+I think mentioning it would bring some extra value for your readers and give them a wider view of Python.~
+~
+As a thankyou, I would be glad to share your page with our 31k Facebook/Twitter/Linkedin Followers.~
+Or~
+I am happy to do Cross-Promotion.~
+~
+Let me know your thoughts. Thanks.~
+Regards,~
+Vinay~
+PS: I am real a person... here is a number to contact me +1 302 308 5151~
+
+//
+
+#comment_kcaptcha