Why we use plt in general not the name of the object? [closed]

This is maybe not really a question of programming, but one about culture.

The pyplot API is modelled after the plotting functions in MATLAB, and therefore, it has a lot of imperative style as heritage.

However, that API is a bit clumsy at times, as you suggest. It is recommended to instead use the object oriented API: Read more in the official docs: https://matplotlib.org/api/index.html?highlight=pylab

PS.
One can also take note that there is a deprecated API called pylab as well, which is even more similar to the MATLAB environment. You can find examples of it when looking at really old tutorials on numpy and matplotlib, but it is generally phased out…. It is further described in the above linked documentation.

Leave a Comment