1

I want to be able to find specific setting/need in Matplotlib using only it's site (docs) without web search etc. For example, I know wanted to change size of label of y-axis. I tried search on the site for label size and clicked top search result (not just because it was top, but is was about axes, not present term in search but exactly missing term of what I was looking for): https://matplotlib.org/api/axis_api.html?highlight=label%20size.

There I was able to find size word for ticks only. It would be strange if the tool did not have option to change axis label size and web search found the solution: How do I set the figure title and axes labels font size in Matplotlib? : plt.ylabel('ylabel', fontsize=16).

How can I find that solution (or some working other) via usage of Matplotlib docs site/tree?

Alex Martian
  • 3,423
  • 7
  • 36
  • 71

1 Answers1

2

The logic would be this: You identify which object you want to change. So in case of an axis label, you know that you can create such label via plt.xlabel() or ax.set_xlabel(). You therefore navigate to this function's/method's documentation page: On the homepage you click on modules and then either on matplotlib.pyplot or matplotlib.axes. In the list of functions/methods you scroll down to the function/method you're looking for.
Alternatively you can use the search for xlabel to arrive there.

In the docs of that method you find which parameters are allowed. It says

Other Parameters: **kwargs : Text properties
Text properties control the appearance of the label.

You click on Text and find a list of parameters. You go through them and identify that fontsize will likely be the parameter that sets the fontsize.

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712