python - match plot color with ticks color -
i making plot bars, including twin axis.
i want ticks have same color bars, means, including parameter "alpha".
however cannot give them paramenter.
any solution?
here piece of relevant code:
# drawing bar plot: rects1 = ax1.bar(x_axis, y_values, bar_width, color='magenta', alpha = 0.4) # playing color bars ax1.set_ylabel('charge value [nc]', color='magenta', alpha = 0.4) # ticks , copy color here not work tl in ax1.get_yticklabels(): tl.set_color(color='magenta', alpha = 0.4)
the traceback:
tl.set_color(color='magenta', alpha = 0.4) typeerror: set_color() got unexpected keyword argument 'alpha'
set_color
, name indicates, sets color. set alpha level use set_alpha
:
for tl in ax1.get_yticklabels(): tl.set_color('magenta') tl.set_alpha(0.4)
Comments
Post a Comment