0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】Matplotlibで、折れ線グラフの線の色を指定する場合について

Posted at

plotメソッドで線の色を指定する場合は、plotメソッドの引数で指定します。

指定する方法は以下の3つがあります。

■ 「red」など、文字で指定。「赤」などの日本語での指定は不可。
■ 「#ff0000」など、16進数のカラーコードで指定。
■ 「(1.0, 0.0, 0.0)」など、RGBをタプルで指定。範囲は0〜255ではなく0〜1。

fig, ax = plt.subplots()
ax.plot([1, 3], [3, 1], color='red')
▶︎
image.png

「color='#ff000'」や「color=(1.0, 0.0, 0.0)」でも同じ結果になります。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?