mirror of
https://codeberg.org/Yael-II/Matplotlib-Style.git
synced 2026-03-15 05:46:26 +01:00
2025-11-21: Added colours, continued manchot_plot default rc parameters
This commit is contained in:
@@ -28,5 +28,6 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see www.gnu.org/licenses/.
|
||||
"""
|
||||
|
||||
from .manchot_plot import *
|
||||
from .colours import *
|
||||
|
||||
|
||||
93
src/manchot_plot/colours.py
Normal file
93
src/manchot_plot/colours.py
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
#!/usr/bin/env python
|
||||
#[TLP:AMBER] LIMITED DISTRIBUTION: WORK IN PROGRESS
|
||||
"""
|
||||
manchot_plot.py
|
||||
|
||||
@ Author: Moussouni, Yaël (PhD student; yael.moussouni@astro.unistra.fr)
|
||||
@ Institution: Université de Strasbourg, CNRS, Observatoire astronomique
|
||||
de Strasbourg, UMR 7550, F-67000 Strasbourg, France
|
||||
@ Date: 2025-11-21
|
||||
|
||||
Licence:
|
||||
Python Matplotlib Style
|
||||
Copyright (C) 2025 Yaël Moussouni (yael.moussouni@astro.unistra.fr)
|
||||
|
||||
manchot_plot.py
|
||||
Copyright (C) 2025 Yaël Moussouni (yael.moussouni@astro.unistra.fr)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see www.gnu.org/licenses/.
|
||||
"""
|
||||
|
||||
# Default palette
|
||||
colour_blue = "#113847"
|
||||
colour_light_blue = "#88AAC6"
|
||||
colour_red = "#4D251D"
|
||||
colour_yellow = "#BD9A5A"
|
||||
colour_green = "#3F4738"
|
||||
colour_violet = "#5F2C51"
|
||||
colour_cyan = "#1D627E"
|
||||
colour_orange = "#9B4D40"
|
||||
|
||||
colour_purple = colour_violet
|
||||
|
||||
# Bright palette
|
||||
bright_white = "#DDDDDD"
|
||||
bright_black = "#121212"
|
||||
|
||||
bright_blue = "#06518E"
|
||||
bright_light_blue = "#009EDB"
|
||||
bright_red = "#ED1C24"
|
||||
bright_yellow = "#E8BD0F"
|
||||
bright_green = "#3B795E"
|
||||
bright_violet = "#C95BCF"
|
||||
bright_cyan = "#216576"
|
||||
bright_light_cyan = "#1E8C9D"
|
||||
bright_orange = "#EB6D1A"
|
||||
bright_purple = bright_violet
|
||||
|
||||
# Blue palette
|
||||
blues_1 = "#D6E3EC"
|
||||
blues_2 = "#88AAC6" # light blue
|
||||
blues_3 = "#4A5B65"
|
||||
blues_4 = "#21475A"
|
||||
blues_5 = "#113847" # blue
|
||||
|
||||
# Grey palette
|
||||
greys_1 = "#CED8DB" # white
|
||||
greys_2 = "#A4B0B4"
|
||||
greys_3 = "#7A888C" # grey
|
||||
greys_4 = "#596569"
|
||||
greys_5 = "#171F22" # black
|
||||
|
||||
colour_white = greys_1
|
||||
colour_grey = greys_3
|
||||
colour_black = greys_5
|
||||
|
||||
# bluegreen palette
|
||||
bluegreen_1 = "#C2D0DB"
|
||||
bluegreen_2 = "#6C8B90"
|
||||
bluegreen_3 = "#4D6C5B"
|
||||
bluegreen_4 = "#3A5662"
|
||||
bluegreen_5 = "#31504B"
|
||||
|
||||
# tree palette
|
||||
tree_1 = "#CFDED7"
|
||||
tree_2 = "#806655" # brown
|
||||
tree_3 = "#3F4738" # green
|
||||
tree_4 = "#113847" # blue
|
||||
tree_5 = "#122921" # dark green
|
||||
|
||||
colour_brown = tree_2
|
||||
colour_dark_green = tree_5
|
||||
@@ -32,6 +32,7 @@ import os
|
||||
|
||||
import matplotlib as mpl
|
||||
import numpy as np
|
||||
import colours as c
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
@@ -51,9 +52,20 @@ class ManchotRC:
|
||||
self.n_cols = 1
|
||||
self.aspect = 3/2
|
||||
|
||||
# Colours
|
||||
self.colour_fg = "#000000"
|
||||
self.colour_bg = "#FFFFFF"
|
||||
self.colours = [c.bright_blue, c.bright_yellow]
|
||||
|
||||
self.axes_facecolor = self.colour_bg
|
||||
self.axes_edgecolor = self.colour_fg
|
||||
self.axes_labelcolor = self.colour_fg
|
||||
self.axes_prop_cycle = cycler(color=self.colours)
|
||||
|
||||
# Figure
|
||||
self.figure_dpi = 150
|
||||
self.savefig_dpi = 300
|
||||
self.savefig_transparent = True
|
||||
|
||||
# Font
|
||||
self.font_family = "serif"
|
||||
@@ -64,6 +76,11 @@ class ManchotRC:
|
||||
self.text_usetex = True
|
||||
self.latex_preamble = ""
|
||||
|
||||
# Axes
|
||||
|
||||
self.axes_titlesize = "large"
|
||||
self.axes_labelsize = "medium"
|
||||
|
||||
# Compute
|
||||
self._compute()
|
||||
return None
|
||||
@@ -75,10 +92,17 @@ class ManchotRC:
|
||||
figsize_x = self.paper[0]/self.n_cols - margin
|
||||
figsize_y = figsize_x / self.aspect
|
||||
|
||||
# Colours
|
||||
self.context["axes.facecolor"] = self.axes_facecolor
|
||||
self.context["axes.edgecolor"] = self.axes_edgecolor
|
||||
self.context["axes.labelcolor"] = self.axes_labelcolor
|
||||
self.context["axes.prop_cycle"] = self.axes_prop_cycle
|
||||
|
||||
# Figure
|
||||
self.context["figure.figsize"] = (figsize_x, figsize_y)
|
||||
self.context["figure.dpi"] = self.figure_dpi
|
||||
self.context["savefig.dpi"] = self.savefig_dpi
|
||||
self.context["savefig.transparent"] = self.savefig_transparent
|
||||
|
||||
# Font
|
||||
self.context["font.family"] = self.font_family
|
||||
@@ -99,6 +123,7 @@ if __name__ == "__main__":
|
||||
with plt.style.context(rc.context):
|
||||
fig, ax = plt.subplots(1)
|
||||
ax.plot([0,1,2,3,4], [2,1,4,3,6])
|
||||
ax.plot([0,1,2,3,4], [4,3,1,2,4])
|
||||
ax.set_xlabel("$x\\ \\mathrm{[cm]}$")
|
||||
ax.set_ylabel("$y\\ \\mathrm{[cm]}$")
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user