以下のグラフ表記の最後のline,=ax.plot()のline部分にカンマを置く意味がわかりません。
line,でなくともlineで動作すると思うのですが、line,にする意味についてどうしてもわからず、今までなんとなくうやむやにしていました。
すみませんが、カンマがないと困るときなどの件についてアドバイスをいただけますと幸いです。カンマがないと困ることがあるのでしょうか。
以下迷路の図を設定するプログラムを本よりプログラムを書き出したものです。
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4#迷路を作成する 5fig=plt.figure(figsize=(5,5)) 6ax=plt.gca() 7#赤い線を描く 8plt.plot([1,1],[0,1],color="red",linewidth=2) 9plt.plot([1,2],[2,2],color="red",linewidth=2) 10plt.plot([2,2],[2,1],color="red",linewidth=2) 11plt.plot([2,3],[1,1],color="red",linewidth=2) 12#状態を示す文字s0-s8を描く 13plt.text(0.5,2.5,"S0",size=14,ha="center") 14plt.text(1.5,2.5,"S1",size=14,ha="center") 15plt.text(2.5,2.5,"S2",size=14,ha="center") 16plt.text(0.5,1.5,"S3",size=14,ha="center") 17plt.text(1.5,1.5,"S4",size=14,ha="center") 18plt.text(2.5,1.5,"S5",size=14,ha="center") 19plt.text(0.5,0.5,"S6",size=14,ha="center") 20plt.text(1.5,0.5,"S7",size=14,ha="center") 21plt.text(2.5,0.5,"S8",size=14,ha="center") 22plt.text(0.5,2.3,"start",ha="center") 23plt.text(2.5,0.3,"GOAL",ha="center") 24 25#描画範囲の設定と目盛りを消す設定 26ax.set_xlim(0,3) 27ax.set_ylim(0,3) 28plt.tick_params(axis="both",which="both",bottom="off",top="off", 29 labelbottom="off",right="off",left="off",labelleft="off") 30#現在地s0 に緑丸を描画する 31line,=ax.plot([0.5],[2.5],marker="o",color="g",markersize=60) 32

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/25 15:30
2019/01/25 15:35 編集
2019/01/25 15:33
2019/01/25 15:46
2019/01/25 15:53
2019/01/25 15:53
2019/01/25 16:34
2019/01/25 16:45
2019/01/25 22:42
2019/01/26 03:28
2019/01/26 05:46
2019/01/26 05:58
2019/01/26 06:47