set_ylim()
noun
say it: “SET WHY-lim” /ˈsɛt ˈwaɪˌlɪm/
A matplotlib method that sets the lowest and highest values shown on a chart's up-and-down axis.
What does set_ylim() do in matplotlib?
set_ylim() is the matplotlib Axes method that sets where a chart's y-axis starts and ends. set_ylim(bottom=0)
starts it at zero and leaves the top to matplotlib; set_ylim(0, 100) fixes both ends, as a chart of percentages
often wants.
ax.bar(rate.index, rate.values)
ax.set_ylim(0, 100) # the y-axis runs from 0% to 100%
In a sentence
- “He used set_ylim() to run the percent axis from 0 to 100.”
- “set_ylim() with bottom=0 made the bars start at zero.”
Level: Journeyman · More Python terms at this level
Updated