Matplotlib.pyplot ticks:

In Python, Matplotlib is a visualization library for plotting 2D arrays for Data Science. It is a multiplatform data visualization library which is built on NumPy arrays and also design to work with SciPy stack. It came into existence in 2002 by John hunter.

Matplotlib has several plots like line, bar, scatter, histogram, etc.

Ticks are there for showing specific points on coordinate axes. It can either be a number or a string. When a graph is plot, the axes itself adjust and take the default ticks. Let us learn customization of these ticks as per our requirements.

Parameters:

Matplotlib.pyplot ticks in Python for Data Science - PST Analytics

Example 1: Default plot

OUTPUT:

Example 2: Playing along with ticks

Customization of ticks can be done in the following ways.

Matplotlib.pyplot ticks in Python for Data Science - PST Analytics

OUTPUT:

Example 3: Changing values of ticks

OUTPUT:

Matplotlib.pyplot ticks in Python for Data Science - PST Analytics

To learn more about visualisation in python for data science, you can check this and this as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.