Skip to content

Add matplotlib style file for plots #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions util/project.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Increase default linewidth
lines.linewidth: 2.0 # line width in points

# Increase default legend line-length
legend.handlelength: 3.5 # the length of the legend lines

# Default marker size
lines.markersize: 6 # marker size, in points

# set legend location
legend.loc: best

# Set default font size, everything scales with this
font.size: 20.0

# Relative font sizing for various things (axes, ticks, legend and titles)
axes.titlesize: medium # font size of the axes title
axes.labelsize: medium # font size of the x and y labels
xtick.labelsize: x-small # font size of the tick labels
ytick.labelsize: x-small # font size of the tick labels
legend.fontsize: 10
figure.titlesize: large # size of the figure title (``Figure.suptitle()``)
figure.labelsize: large # size of the figure label (``Figure.sup[x|y]label()``)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm using an older version of matplotlib (v3.5.1) or something. Mine complains that

Bad key figure.labelsize in file project.mplstyle, line 23 ('figure.labelsize:   large   # size of the figure label (``Figure.sup[x|y]label()``)')

But it works if I comment this out

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking! Yes, it seems like I have v3.10.x and higher. I can poke at this to see if there might be backward compatible options for the label sizes.


# Use latex for rendering, set font to computer modern
text.usetex: True # use latex for all text handling
mathtext.fontset: cm # change from 'dejavusans' (default)
font.family: cm # Make the default font consistent

# Set a default group for line colors and dash styles
axes.prop_cycle: cycler('color', [ "#EE2E2F", "#185AA9", "#008C48", "#F47D23", "#662C91", "#A21D21", "#B43894", "#010202"]) + cycler('linestyle', [ [], [10, 5], [10, 4, 3, 4], [3, 3], [10, 4, 3, 4, 3, 4], [3, 2,6,2], [3,4,1,4], [1,1] ])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a complaint from matplotlib that

Bad value in file 'project.mplstyle', line 31 ('axes.prop_cycle: cycler('color', [ "#EE2E2F", "185AA9", "008C48", "F47D23", "662C91", "A21D21", "B43894", "010202"]) + cycler('linestyle', [ [], [10, 5], [10, 4, 3, 4], [3, 3], [10, 4, 3, 4, 3, 4], [3, 2,6,2], [3,4,1,4], [1,1] ])'): Key axes.prop_cycle: 'cycler('color', [ "' is not a valid cycler construction: EOL while scanning string literal (, line 1)

I think this got fixed in later versions, but it is interpreting the # in #EE2E2F as a comment, so it's not reading the rest of the line. However, by removing the # marks, my version of matplotlib still knows to read those as colors.


# Some explicit figure details
figure.dpi: 300 # figure dots per inch
figure.autolayout: True # When True, automatically adjust subplot
# parameters to make the plot fit the figure
# using `tight_layout`
savefig.format: pdf # {png, ps, pdf, svg}
savefig.bbox: tight # {tight, standard}, note this might have issues with animations
Loading