0

I'm building a plot on which I've hidden the top and right axes with: (following the official example at https://matplotlib.org/stable/gallery/axisartist/simple_axisline3.html#sphx-glr-gallery-axisartist-simple-axisline3-py)

import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import Axes
import numpy as np


fig = plt.figure()
ax = fig.add_subplot(axes_class=Axes)

ax.axis["right", "top"].set_visible(False)

x_range = np.linspace(10, 20)
ax.plot(x_range, x_range+10)

Following that, I'm trying to set a custom fontsize for my x and y axes labels. Normally it's simply done with:

ax.set_xlabel("A (unit A)", fontsize=50)
ax.set_ylabel("B (unit B)", fontsize=50)

However, no effect is to be seen on the fontsize. Please see the figure output. No error is returned.

I guess the Axes subclass I'm calling from mpl_toolkits has a different way of doing so, but I did not manage how to do it?

Thank you in advance for your help.

carotx
  • 1
  • 2
    I would not use a toolbox for this. You can do the same thing w a normal axes: https://stackoverflow.com/questions/925024/how-can-i-remove-the-top-and-right-axis-in-matplotlib – Jody Klymak Jul 08 '21 at 14:28
  • 1
    Thank you @JodyKlymak. spines instead of a toolbox is so simple. That's what I'm looking for. – carotx Jul 08 '21 at 14:49

0 Answers0