1

I want to create a custom style for matplotlib. I saved this file in a local folder libstyle/my_style.mplstyle. The current content of the file is:

### AXES
axes.grid: True
axes.autolimit_mode: round_numbers

### FONT
font.family: sans-serif
font.sans-serif: Arial

where I setup font, grid and axes limits. I plan to use this style with the call:

plt.style.use(r'libstyle/my_style.mplstyle')

I would like to set a default color for each of the four spines like in the image:

enter image description here

Following this answer, I already know I can add to any python script these lines:

ax.spines['top'].set_color('red')
ax.spines['right'].set_color('blue')
ax.spines['bottom'].set_color('green')
ax.spines['left'].set_color('orange')

But I would like to move all aesthetic configuration from python scripts to my_style.mplstyle file.
The point is that I don't know which parameter in my_style.mplstyle I have to edit in order to specify the color of a single spine. I followed this documentation, but didn't find anything about spines color.
Is there a way to set up spines color (one color for each of the four spines) in a .mplstyle?
Thanks in advance.

Zephyr
  • 11,891
  • 53
  • 45
  • 80
  • As far as I know it's not possible to set the color of individual spines in a style sheet (you can set all through `axes.edgecolor`). [See this SO answer for an explanation](https://stackoverflow.com/a/3509553/2694260). – Jason Aug 20 '21 at 09:37

0 Answers0