Question
In Matplotlib, when labeling axes of a graph, is it good to include units in the axis label, like seconds, years, etc?
Answer
There is no strict rule to including units for axes, but it can be good to include the units somewhere in the graph labels or title.
The units of the x and y values should be provided somehow, either in the context of the graph title or explicitly in the labels. This way, if someone viewed the graph, they should be able to infer what the x and y values stand for.
For example, in the exercise, we don’t specify on the x label that “Time” is in years. However, this is implied by the graph title “My Last Twelve Years of Coffee Drinking”, and we can see that the x axis values are from 0 to 12 for each year.
Graphs should provide everything that they need to, so as long as other people can infer the units of the x and y axes clearly, then it can be up to you on how to apply that.