-- **Adam Hughes**
-- **2 / 27 / 2014**
-- **The George Washington University**
This notebook is intended to be run by other notebooks through the %run ipython magic. The running notebook will then be styled nicely, have the most common pyparty imports, have pre-set figure size and plotting backend (svg), and will suppress logging in certain cases.
Figure style should be updated later based on Damon McDougall's blog to reflect journal latex templates (see Related).
In [2]:
JOURNAL_TEXT = 9
# Plotting
LABELSIZE = JOURNAL_TEXT +1 #All plot text except legends (recommed JT -1)
LEGENDSIZE = LABELSIZE * 1.2
# Notebook Style (pyparty style, path or url to .css or None)
NBSTYLE = 'gwu'
# Logging
HIDE_LOG = True
In [3]:
from __future__ import division
from pyparty import Canvas, splot, showim
In [4]:
if NBSTYLE:
from pyparty.bundled import load_style
load_style(NBSTYLE);
You can find the matplotlibrc file path via:
.. >>> matplotlib.matplotlib_fname()
The computer modern font setting is default, so I am happy with it; however, changing the font as done in the commented block below seems to be buggy in the notebook. I can't change the font or its weight, but the size does seem to change correctly...
Caveats:
In [8]:
from matplotlib import rcParams
# # Figure/lines
rcParams['figure.figsize'] = (10, 6) # SET THIS BASED ON LATEX CONSDIERATIONS LATER!
#rcParams['figure.facecolor'] = '(1,0,0)'
rcParams['lines.linewidth'] = 2.0
# # Labels
rcParams['axes.labelsize'] = LABELSIZE
rcParams['xtick.labelsize'] = LABELSIZE
rcParams['ytick.labelsize'] = LABELSIZE
# # Legend
rcParams['legend.loc'] = 'upper right'
rcParams['legend.fontsize'] = LEGENDSIZE
rcParams['legend.fancybox'] = True
rcParams['legend.scatterpoints'] = 1 # Draw one scatter point in legend
rcParams['legend.markerscale'] = 1.5 # But make it large
# # Font and text
rcParams['font.family'] = 'serif'
rcParams['font.serif'] = ['Computer Modern'] # Also used by latex (this is default already)
#rcParams['font.weight'] = 'bold' # These don't work
#rcParams['font.style'] = 'oblique'
rcParams['font.size'] = LABELSIZE #Matplotlib title, labels
# Text and latex
rcParams['text.usetex'] = True # Slight differce in how math symbols; as well as text labeled
rcParams['text.color'] = 'black'
# # Image
rcParams['image.cmap'] = 'gray' #Default colormap for 1-channel images
# #Saving
rcParams['savefig.dpi'] = 200
rcParams['savefig.format'] = 'png'
rcParams['savefig.bbox'] = 'tight' #or standard
In [6]:
%config InlineBackend.figure_format = 'svg'
In [7]:
if HIDE_LOG:
import warnings #supress non-pyparty log msgs
warnings.filterwarnings('ignore')