Data Visualization Guided Project- Stuck on xlim() and ylim() error

Screen Link:

My Code:


plt.subplot(1,2,1)
daytime['traffic_volume'].plot.hist()
plt.title('Daytime Traffic Volume')
plt.xlabel('Traffic Volume')
plt.ylabel('Frequency')
plt.xlim((0, 8000))
plt.ylim((0, 10000))


plt.subplot(1, 2,2)
nighttime['traffic_volume'].plot.hist()
plt.title('Nighttime Traffic Volume')
plt.xlabel('Traffic Volume')
plt.ylabel('Frequency')
plt.xlim((0, 8000))
plt.ylim((0, 10000))

plt.show()

What I expected to happen:
The plt.xlim() and plt.ylim() to bring the x- and the y-axis to the same ranges for both graphs.

What actually happened:

TypeError                                 Traceback (most recent call last)
<ipython-input-56-63a653bff496> in <module>
      6 plt.xlabel('Traffic Volume')
      7 plt.ylabel('Frequency')
----> 8 plt.xlim((0, 8000))
      9 plt.ylim((0, 10000))
     10 

TypeError: 'tuple' object is not callable

Are you working on the project on the Dataquest platform or on your local system? Because your code works for me on the platform.

This could be a version related issue if you’re working elsewhere. If so, try the function argument as just 0, 8000 and not as a tuple (0, 8000).

If the above doesn’t help, then it might be helpful if you shared the rest of the code before the one above as well.

Thanks! I am on the Dataquest platform. As it so happens, when I reloaded my notebook this morning, it ran nicely. Not sure what changed, but problem solved.