Closed
Description
Bug report
Bug summary
Unable to set label color or other text properties
Code for reproduction
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
fig, ax = plt.subplots(figsize=(5,6),dpi=200)
#hiding the axis numbers
ax.axes.xaxis.set_visible(False)
ax.axes.yaxis.set_visible(False)
#setting the axis dimensions
ax.set_xlim((-250, 250))
ax.set_ylim((422.5, -47.5))
#setting the background color as black ('k') for a better visualization
ax.set_facecolor('k')
fig.set_facecolor('k')
cbaxes = inset_axes(ax, width="5%",
height="50%",
loc='lower left',
bbox_to_anchor=(.7, 0.07, 5, .08),
bbox_transform=ax.transAxes,
borderpad=0,
)
bar_palette = mpl.cm.inferno
bar = mpl.colorbar.ColorbarBase(cbaxes, cmap=bar_palette, orientation='horizontal')
# creating ticks
bar.set_ticks([0,1])
bar.set_ticklabels(ticklabels=['Low', 'High'], color='white')
Actual outcome
TypeError: set_ticklabels() got an unexpected keyword argument 'color'
Expected outcome
I need the labels to be white because the background is black
IMPORTANT
If you put 'white' instead of 'k' in ax.set_facecolor('k') and remove color='white' from bar.set_ticklabels
you can see that the labels are properly created, but they are black and apparently there is no way to make them
change.
Matplotlib version
- Operating system: Mac OS Big Sur
- Matplotlib version: 3.4.0
- Matplotlib backend : module://ipykernel.pylab.backend_inline
- Python version: 3.9.2
Thanks to anyone who can help!