# myPltSyle.py # private settings for matplotlib (G. Quast, May 2017) # ''' modify figure and axes properties Args: * fig: a matplotlib.pyplot.figure object * ax: a matplotlib.pyplot.axes object As an alternative, consider a (suitably modified) version of the file matplotlibrc in the current working directory; global preferences can be set by including a matplotlibrc file in the directory ~/.config/matplotlib/ .. moduleauthor:: Guenter Quast ''' # pyhton2 - python3 compatibility from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals # bg from cycler import cycler import matplotlib.pyplot as plt # general plotting options def my_axStyle(fig, ax): ax.tick_params(\ reset=True, axis='x', # changes apply to the y-axis which='major', # both major and minor ticks are affected bottom='on', # ticks along the left edge are on top='off', # ticks along the right edge are off width=3, length=5, colors='darkblue', labelsize='large') ax.tick_params(\ axis='x', # changes apply to the y-axis which='minor', # both major and minor ticks are affected bottom='on', # ticks along the left edge are on top='off', # ticks along the right edge are off width=2, length=3, colors='darkblue') ax.tick_params(\ reset=True, axis='y', # changes apply to the y-axis which='major', # both major and minor ticks are affected left='on', # ticks along the left edge are off right='off', # labels along the right edge are off width=3, length=5, colors='darkblue', labelsize='large' ) ax.tick_params(\ axis='y', # changes apply to the y-axis which='minor', # both major and minor ticks are affected left='on', # ticks along the left edge are off right='off', # labels along the right edge are off width=2, length=3, colors='darkblue') ax.ticklabel_format(\ axis='both', style='sci', scilimits=(-2,3), useOffset=False ) ax.set_frame_on(True) # border lines ax.locator_params(nbins=6) # number of axis labels # for multipel lines: define sequence of colors and line styles ax.set_prop_cycle( cycler('linestyle',['-','--','-.']) * cycler('color',['black','blue','steelblue', 'cyan','green','orange','darkred', 'magenta','gold']) ) # arrangement of sub-plots - reserve a bit more hight than default fig.subplots_adjust(top=0.92, bottom=0.1, left=0.1, right=0.95, wspace=0.2, hspace=0.3) # fig.tight_layout() # eventually use compact format