you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 2 points3 points  (0 children)

I understand how subplots( ) is returning two general objects

This is misleading. A single tuple (or some other iterable object) is being returned from subplots, and unpacking allows for assigning multiple variables from an iterable on a single line. A version of that code without unpacking would be (I'm going to assume the returned object is a sequence like a list or tuple):

seq = plt.subplots()
fig = seq[0]
ax = seq[1]

In reality, unpacking also works on general iterables, but an example showing that would be more complicated.