fig, ax = plt.subplots(figsize=(8,5))
What does the comma "," between the "fig, ax"? I mean how is this syntax used?
ax.spines['bottom'].set_position('zero')
What are "spines" and "set_position"?
fig, ax = plt.subplots(figsize=(8,5))
ax.spines['bottom'].set_position('zero')
Hi Kunthu,
fig, ax = plt.subplots(figsize=(8,5))
In plt.subplots, fig retruns the Figure. In this case, it will return a figure of dimension 8*5. ax returns array of Axes objects. It can be either a single Axes object or an array of Axes objects if more than one subplot was created.
You can create more subplots defining more Axes:
fig, (ax1, ax2) = plt.subplots(nrows, ncolumns, figsize=())
Refer this link for more detail:
ax.spines['bottom'].set_position('zero')
In this code, set_position sets the position of spines. Spines connects the axis tick marks and noting the boundaries of the data area. In this code, we are setting the position of xticks to zero. Refer this.
Hope this helps.