I currently have three seperate scatterplots showing with the same x and y axis (with the 3rd dimension being the color coding) but they all follow each other downards, one graph below the other. Here is the code I use for that (in this case I have 3 scatterplots:
fig, ax = plt.subplots(figsize=(10,10))
plt.xlim(0,2000000)
plt.ylim(0,250000)
ax.scatter(Sales_Force.Revenues[hello], Sales_Force.Amount[hello],
alpha=0.05, color='g')
ax.set_title("Revenue vs Amount for Booked")
ax.set_xlabel("Revenue", size = 10)
ax.set_ylabel("Amount", size = 10)
plt.xticks(fontsize=10)
plt.show()
Afterwards, I have 2 other versions of almost identical code replacing the "hello" with 2 other words, hence creating me 3 separate scatterplots. My question is, how (and preferably in as simple of a modification as possible, if possible) can I alter my code in order to keep the exact same plots but them being next to each other side by side instead of one below another?
I also tried doing this based on another answer I saw on stackoverflow. I tried this:
fig, axes = plt.subplots(1,2)
plt.xlim(0,2000000)
plt.ylim(0,250000)
ax1.scatter(Sales_Force_Before_Merger.Revenues[hello],
Sales_Force_Before_Merger.Amount[hello], alpha=0.05, color='g')
ax1.set_title("Revenue vs Amount for Booked Before Merger")
ax1.set_xlabel("Revenue", size = 10)
ax1.set_ylabel("Amount", size = 10)
ax1.plt.xticks(fontsize=10)
ax1.plt.show(ax=axes[0])
plt.xlim(0,2000000)
plt.ylim(0,250000)
ax2.scatter(Sales_Force_Before_Merger.Revenues[goodbye],
Sales_Force_Before_Merger.Amount[goodbye], alpha=0.05, color='r')
ax2.set_title("Revenue vs Amount for Booked Before Merger")
ax2.set_xlabel("Revenue", size = 10)
ax2.set_ylabel("Amount", size = 10)
ax2.plt.xticks(fontsize=10)
ax2.plt.show(ax=axes[1])
After I do this I get an error message stating:
AttributeError: 'AxesSubplot' object has no attribute 'plt'
and have two graphs showing with nothing in them (some minor modification might have populated one of the 2 plots) and additionally, both the non populated scatterplots also have different x and y value ticks showing even though they are supposed to be showing the same data.