Skip to content

Instantly share code, notes, and snippets.

@cereniyim
Created May 30, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cereniyim/f46e25618cdf10d27ba87219131ea8e5 to your computer and use it in GitHub Desktop.
Save cereniyim/f46e25618cdf10d27ba87219131ea8e5 to your computer and use it in GitHub Desktop.
Plot the distribution of two different array
def PlotPredictedVSActual(predictions, actuals):
figsize(20, 10)
plt.rcParams['font.size'] = 14
# histogram of predictions
ax = plt.subplot(121)
ax.hist(predictions,
bins=10,
color = "#971539",
edgecolor = 'white')
ax.set_xlabel("points", size=14)
ax.set_xticks(range(80, 101))
ax.set_ylabel("count", size=14)
ax.set_title("Predicted Distribution", size=16)
plt.grid(b=True, axis = 'y', alpha=0.3)
# histogram of actual values
ax2 = plt.subplot(122)
ax2.hist(actuals,
bins=20,
color = "#971539",
edgecolor = 'white')
ax2.set_xlabel("points", size=14)
ax2.set_xticks(range(80, 101))
ax2.set_ylabel("count", size=14)
ax2.set_title("Actual Distribution", size=16)
plt.grid(b=True, axis = 'y', alpha=0.3)
# plt.savefig("PredictionsVSActuals.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment