Skip to content

Instantly share code, notes, and snippets.

@hare1039
Last active January 3, 2023 12:26
Show Gist options
  • Save hare1039/43dc4c947eb540e8542a7f4345a03297 to your computer and use it in GitHub Desktop.
Save hare1039/43dc4c947eb540e8542a7f4345a03297 to your computer and use it in GitHub Desktop.
plt cheatsheet
import matplotlib.pyplot as plt
import statistics
import collections
d = collections.defaultdict(lambda: 0)
x = statistics.mean(data1)
sys.argv;
"{0: <5}".format("abc")
"{:.2f}".format(0.001)
fig, ax = plt.subplots() #2, 2, sharex=True, sharey=True
ax.set_xlabel()
ax.set_xlim()
ax2 = ax.twinx()
ax.plot(x, y_validloss, label="loss", color="blue", linewidth=4)
ax2.plot(x, y_validmse, label="MSE", color="red")
fig.suptitle("subtutile")
fig.legend()
plt.tight_layout()
plt.savefig(outname)
plt.clf()
with open("x.json") as fp:
data = json.load(fp)
with open("x2.json", "w") as fp:
json.dump(data, fp)
with open("stock3.pickle", "rb") as fp:
stock = pickle.load(fp)
with open("stock3.pickle", "wb") as handle:
pickle.dump(data, handle, protocol=pickle.HIGHEST_PROTOCOL)
if __name__ == "__main__":
sys.argv[1]
"{:.2f}.ckpt".format(testd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment