-1

I have two bar charts created in python- pyplot showing different data. I do not want to combine them into one chart. I want both charts to sit side by side in Jupyter Notebooks for a slide presentation. How can I do this? I am sure there is a simple way besides taking screenshots of the charts and uploading them.

plt.bar(dep_means.keys(), dep_means.values())
plt.ylabel('Average depression levels')
plt.xlabel('Time from first exposure to dog')
plt.xticks(rotation=45)
plt.title('Effect of Dogs on Depression Levels')
plt.show()


plt.bar(dep_means_ctrl.keys(), dep_means_ctrl.values())
plt.ylabel('Average depression levels')
plt.xlabel('Time from first exposure to control treatment')
plt.xticks(rotation=45)
plt.title('Effect of Control Treatment on Depression Levels')

plt.show()
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
  • 1
    `fig, (ax1, ax2) = plt.subplots(ncols=2)`. `ax1.bar()`, `ax1.set_ylabel()` ... `ax2.bar()`, `ax1.set_ylabel()`... – BigBen Aug 31 '23 at 16:59

0 Answers0