Seaborn plots in jupyter notebook showing in same cell

Viewed 38

I have multiple cells in a jupyter notebook each containing a plot. When I execute these cells I expect to see the plot below each cell however I am seeing the plots overwriting each other on each execution. Does anyone know if its a bug or am I doing something wrong?

First cell code

tips = pd.read_csv(r"D:\code_and_data\pydata-book-3rd-edition\examples\tips.csv")

party_counts = pd.crosstab(tips["day"], tips["size"])
party_counts = party_counts.reindex(index=["Thur", "Fri", "Sat", "Sun"])
  
party_pcts = party_counts.div(party_counts.sum(axis="columns"),axis="index")

party_pcts.plot.bar()

Second cell code

tips['tip_pct'] = tips['tip']/(tips['total_bill'] - tips['tip'])

tips.head()

tips["tip_pct"].plot.hist(bins=50)

enter image description here

0 Answers
Related