Object-oriented way of using matplotlib – 5. Customizing Plots, Ticks

In the previous posts, we’ve tasted some differences between MATLAB styles and OO styles. We could learn how to add subplots in different ways. In this post, you can learn how to customize the various stuffs of a plot such as legend, tick and colorbar.

The main references are come from the official matplotlib website, “matplotlib.org” and  the book, 『Python Data Science Handbook: Essential Tools for Working with Data, Jake VanderPlas, O’REILLY, 2017』.

5. Customizing Plots

b. Customizing Ticks

Ticks are part of axis ( different from ‘axes’ ). You can adjust the ticks by Locator and Formatter objects. A plot has two axes (plural of axis), X and Y. So, Each axes (subplot) has xaxis object and yaxis object. You can assign major tick by set_major_locator(), while assigning minor tick by set_minor_locator().

Here is some example.
The full source code is here. [Link]