Skip to content

Instantly share code, notes, and snippets.

@metab0t
Last active May 6, 2020 13:01
Show Gist options
  • Save metab0t/2f24f74323e24733954189dee8178093 to your computer and use it in GitHub Desktop.
Save metab0t/2f24f74323e24733954189dee8178093 to your computer and use it in GitHub Desktop.
[Snippets for matplotlib plotting] Here are some snippets I use with matplotlib #Python #matplotlib
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
matplotlib.rcParams["font.family"] = "Sarasa Gothic SC"
plt.style.use("seaborn-poster")
fig, ax = plt.subplots(figsize=(15,7.5), facecolor="w", edgecolor="k")
fig.savefig("xx.png", dpi=300, bbox_inches="tight")
#https://stackoverflow.com/a/10129461
ax2 = ax.twinx()
lines, labels = ax.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax.legend(lines + lines2, labels + labels2, loc=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment