thehand0
thehand0

Reputation: 1163

Is there a way to change the alpha value of the x/y ticks in matplotlib?

I am wanting to change the alpha value of the color of the x ticks. I understand how to change the color of the xticks (see below), but am not sure how to change the alpha value. Is this possible? Any help would be much appreciated.

ax.tick_params(axis='x', which=u'both',length=3, color="red")

Thanks in advance.

Upvotes: 1

Views: 1523

Answers (1)

Quang Hoang
Quang Hoang

Reputation: 150805

You can pass a 4-tuple, where the last one represents alpha channel:

ax.tick_params(axis='x', which=u'both',length=3, color=[1,0,0,0.5])

Or you can pass a hex code:

ax.tick_params(axis='x', which=u'both',length=5, color='#FF000080')

Output:

enter image description here

Upvotes: 4

Related Questions