プログラミング/julia/グラフの書き方 のバックアップ(No.3)

更新


プログラミング/julia

このあたりを見る?

Plots/GR: グラフ package のおすすめ
http://www.cas.cmc.osaka-u.ac.jp/~paoon/misc/julia/post/trouble-plots-package/

JupyterでJuliaを動かして回帰分析をやってみる。
https://qiita.com/kenmatsu4/items/b77ecec75418cbaa2212

jupyter notebookで触れるプロットを描く
http://ksknw.hatenablog.com/entry/2016/08/04/233103

Julia言語と Plots + GR で複素関数のgifアニメーションを作る
http://optie.hatenablog.com/entry/2018/03/29/210619

GR - examples
http://docs.juliaplots.org/latest/examples/gr/

PlotThemes
https://github.com/JuliaPlots/PlotThemes.jl

Plotly を使う?

https://qiita.com/deaikei/items/b71c1ca2c4c2a2c37526

$ python3 -m pip install numpy plotly

これとてもいいのだけれど、これを使った notebook のファイルサイズが非常に大きくなるみたい。

簡単なグラフでも5メガバイトとか。

で、gist へ保存ができなくなってしまった。

どうしたらいいか、考え中。

PyPlot を使う

matplotlib を使うので、

LANG:console
$ sudo python3 -m pip install matplotlib

とすれば、python から使うのは簡単だった。

julia から使うには、単に Pkg.add("PyPlot") しただけだと、

InitError: Failed to import required Python module matplotlib.

For automated matplotlib installation, try configuring PyCall to use the Conda.jl package's Python "Miniconda" distribution within Julia. Relaunch Julia and run:
    ENV["PYTHON"]=""
    Pkg.build("PyCall")
before trying again.

The pyimport exception was: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)

The Python package matplotlib could not be found by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.

PyCall is currently configured to use the Python version at:

python

and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the matplotlib module.

One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.

Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia.  As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the matplotlib module, you can use `pyimport_conda("matplotlib", PKG)`,
where PKG is the Anaconda package the contains the module matplotlib,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).

) <type 'exceptions.ImportError'>
ImportError('No module named matplotlib',)


during initialization of module PyPlot

Stacktrace:
 [1] pyimport_conda(::String, ::String, ::String) at /home/osamu/.julia/v0.6/PyCall/src/PyCall.jl:609
 [2] __init__() at /home/osamu/.julia/v0.6/PyPlot/src/init.jl:175
 [3] _include_from_serialized(::String) at ./loading.jl:157
 [4] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200
 [5] _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:236
 [6] _require(::Symbol) at ./loading.jl:441
 [7] require(::Symbol) at ./loading.jl:405
 [8] include_string(::String, ::String) at ./loading.jl:522

と言われ、PyCall を build する必要があった。

LANG:console
julia> Pkg.add("PyPlot")
julia> ENV["PYTHON"]=""
julia> Pkg.build("PyCall")

ENV["PYTHON"]="" はシステムの python を使うためのおまじないっぽい?

コメント・質問





Counter: 39938 (from 2010/06/03), today: 2, yesterday: 0