LoginSignup
0
0

matplotlibで色の名前を追加する方法

Posted at

概要

下記3行を実行することで, 任意の色をmatplotlibで指定できるようになります.
(一例として"#FF00FF"という色を"hogehoge"という名前で追加しました.)

from matplotlib import colors
colors._colors_full_map = {**dict(colors._colors_full_map), **{"hogehoge":"#FF00FF"}}
colors._colors_full_map = colors._ColorMapping(colors._colors_full_map)
from matplotlib import pyplot as plt
plt.plot([0,1], c='hogehoge')
plt.show()

test.png

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