I have come across the function set_xlabel in matplot lib and it looks similar to the xlabel function.
Is there any significant difference between those two functions?
If there any, state situations where we can use them?
Asked
Active
Viewed 155 times
0

Varun Kumar
- 153
- 11
-
2xlabel provides you with the label (that is already there on the plot) while set_xlabel sets the label. If there is no label on the plot, sxlabel returns an empty string. – Vinod Kumar Nov 03 '20 at 10:06
1 Answers
1
Basically there is no difference. But xlabel
is a method of pyplot
as you can read from this and set_xlabel
must be used when you are using Axes
here.
You can read the difference between using one or another in this thread, for example. What is the difference between drawing plots using plot, axes or figure in matplotlib?

User
- 806
- 1
- 11
- 28