Last active
July 13, 2020 20:56
-
-
Save lpillmann/1228e6251113f89d02bb2660e5fb2e3d to your computer and use it in GitHub Desktop.
Custom Matplotlib setup to make charts readable, to use with pandas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
# Heuristics to make labels always readable, for dpi = 100 (default) | |
fig_w, fig_h = 10, 6 # Figure dimensions (in inches) | |
font_size = fig_w + fig_h # Font size (in pts.) | |
matplotlib.rcParams.update({ | |
'figure.figsize': (fig_w, fig_h), | |
'font.size': font_size, | |
'font.family': 'monospace', # Optional (default: sans-serif) | |
'figure.facecolor': 'white', # White background behind ticks (avoid Chrome's black background issue) | |
#'xtick.labelsize': 'medium', # Adjust relative label sizes | |
#'ytick.labelsize': 'medium', | |
#'legend.fontsize': 'medium', | |
#'legend.framealpha': 1.0 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment