Skip to content

Instantly share code, notes, and snippets.

@FisherKK
Created August 13, 2018 22:02
Show Gist options
  • Save FisherKK/55e4a1d52df1951fdb2ba4a7ba89ffa2 to your computer and use it in GitHub Desktop.
Save FisherKK/55e4a1d52df1951fdb2ba4a7ba89ffa2 to your computer and use it in GitHub Desktop.
matplotlib.rcParams.update({'font.size': 14})
plt.figure(figsize=(8, 5))
plt.scatter(df_data["size"], df_data["price"],
edgecolor='black', linewidth='1', s=70, alpha=0.7, c="#3176f7")
plt.plot(np.arange(0, 120, 0.1), [predict([x], model_parameters) for x in np.arange(0, 120, 0.1)], c="red")
plt.text(90, 700, "y = 7.1x + 10", color="r", fontsize=14, rotation=25)
plt.xlabel("Size [m^2]")
plt.ylabel("Price [k zł]")
plt.ylim(-100, 1000)
plt.xlim(0, 120)
plt.title("y = wx + b, [w={:.1f}, b={:.1f}]".format(model_parameters["w"][0], model_parameters["b"]))
plt.yticks(np.arange(0, 1000, 100))
plt.xticks(np.arange(0, 120, 10))
plt.grid(color='blue', linestyle='--', linewidth=1, alpha=0.2)
plt.gca().spines["top"].set_visible(False)
plt.gca().spines["right"].set_visible(False)
plt.gca().spines["bottom"].set_visible(False)
plt.gca().spines["left"].set_visible(False);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment