Skip to content

Commit

Permalink
Show image by image command.
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiisoup committed Oct 16, 2017
1 parent 1e9a70e commit 982f696
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ codeship_settings.txt
# sphinx directories
_build
_static
savefig
7 changes: 7 additions & 0 deletions chapter2/src/tutorial2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ matplotlib パッケージの中の pyplot モジュールを plt という名
@savefig tutorial2_plot1.png width=4in
plt.plot(y)
.. image:: ../../savefig/tutorial2_plot1.png
:width: 4in
:target: ../../savefig/tutorial2_plot1.png

plt.plot の引数に1次元データを渡すことで、
横軸が要素番号、縦軸が要素の値のグラフを描画できる。
Expand All @@ -198,6 +201,10 @@ x軸を指定するには、
@savefig tutorial2_plot2.png width=4in
plt.plot(x, y, '-o')
.. image:: ../../savefig/tutorial2_plot2.png
:width: 4in
:target: ../../savefig/tutorial2_plot2.png

というように、x軸の値とy軸の値を引数として渡す。
なお、3つ目の引数には描画の様式を指定する。ここで、’-o’を渡すと、
丸印のマーカを線で繋いだグラフを描画できる。
5 changes: 5 additions & 0 deletions chapter2/src/tutorial3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ Jupyter-notebookなどの開発環境では、
@savefig tutorial3_plot1.png width=4in
plt.plot(x, y)
.. image:: ../../savefig/tutorial3_plot1.png
:width: 4in
:target: ../../savefig/tutorial3_plot1.png


のように、引数にオブジェクトを渡すことで実行できる。
2 changes: 1 addition & 1 deletion chapter2/src/tutorial4.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
スクリプトファイルを読み込む
スクリプトファイルを読み込む
==================================

.. ipython:: python
Expand Down
4 changes: 3 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['IPython.sphinxext.ipython_directive',
extensions = ['matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
'sphinx.ext.mathjax',
'sphinx.ext.autodoc',
Expand Down

0 comments on commit 982f696

Please sign in to comment.