Skip to content
Snippets Groups Projects
Commit 14bf6cfd authored by Germain Clavier's avatar Germain Clavier
Browse files

Added OldStyle file and new qp version with colour gradient.

parent 1b2f5552
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
An old journal style plotting configuration file
'''
import numpy as np
import re
from matplotlib import pyplot as plt
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import sys
plt.rc('axes', linewidth=2)
label_fontsize = 20
ticks_fontsize = 20
linewidth = 3
axes_linewidth = 1
major_tick_length = 15
minor_tick_length = major_tick_length//2
no_tick = 0
# print(plt.rcParams.keys())
# sys.exit()
plt.rcParams['font.family'] = 'Latin Modern Math'
plt.rcParams['font.weight'] = 'normal'
plt.rcParams['font.variant'] = 'small-caps' # Unfortunately, this does not work yet with matplotlib
plt.rcParams['axes.linewidth'] = axes_linewidth
plt.rcParams['lines.linewidth'] = linewidth
plt.rcParams['axes.labelsize'] = label_fontsize
plt.rcParams['legend.fontsize'] = label_fontsize
plt.rcParams['xtick.major.size'] = major_tick_length
plt.rcParams['xtick.minor.visible'] = True
plt.rcParams['xtick.minor.size'] = minor_tick_length
plt.rcParams['xtick.labelsize'] = ticks_fontsize
plt.rcParams['ytick.labelsize'] = ticks_fontsize
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['xtick.top'] = True
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['ytick.right'] = True
plt.rcParams['ytick.major.size'] = major_tick_length
plt.rcParams['ytick.minor.visible'] = True
plt.rcParams['ytick.minor.size'] = minor_tick_length
plt.rcParams['xtick.major.width'] = axes_linewidth
plt.rcParams['ytick.major.width'] = axes_linewidth
plt.rcParams['xtick.minor.width'] = axes_linewidth
plt.rcParams['ytick.minor.width'] = axes_linewidth
plt.rcParams['lines.markerfacecolor'] = 'white'
plt.rcParams['lines.markeredgecolor'] = 'black'
nlinestyle = 4
linestyle_list = ['-', '--', '-.', ':']
color_list = ['#000000', '#888888', '#CCCCCC']
marker_list = ['o', 's', 'v', '^']
plt.rcParams['axes.prop_cycle'] = plt.cycler(color=color_list) * (plt.cycler(linestyle=linestyle_list) + plt.cycler(marker=marker_list))
##### SOME EXAMPLES FOR TESTING PURPOSE ####
##### WITH SOME PERSONAL ADVICES
# 1) Better to set font and stuff for each axes
# 2) The bigger the better
##### Plotting linear data
npoints = 10
for i in range(12):
data = np.linspace(0, 1, 10)
plt.plot((i+1)*data, label=" ".join(['data', str(i+1)]))
ax = plt.gca() # Get current axes to set properties
ax.legend(frameon=False) # Fat font, no frame
ax.set_xlabel(r"PIF ($\int_{-\infty}^{3} \frac{x}{l_0}$)")
ax.set_ylabel("POUET")
##### Plotting heatmap
# data = np.random.rand(20, 20)
# plt.pcolormesh(data, cmap=GCcmap, rasterized=True) # Data is output from ListedColormap
# plt.colorbar(ax = plt.gca()) # Puts the colorbar on the side
##### Show result
plt.show()
......@@ -11,12 +11,12 @@ import sys
import re
import GCcolors
import povray as pov
from itertools import cycle
import numpy as np
from scipy.signal import savgol_filter
import matplotlib as mpl
from matplotlib import pyplot as plt
# plt.rcParams.update({'lines.markeredgewidth': 4})
plt.rcParams.update({'font.size': 22, 'lines.linewidth': 3.})
......@@ -310,7 +310,7 @@ def main():
help='File name followed by columns and optionally lines to skip.')
parser.add_argument('-n', '--names', dest='names',
nargs='+', action='append',
default=[],
default=[''],
help='Names for the legend.')
parser.add_argument('-l', '--loglog', dest='is_log_xy',
action='store_true',
......@@ -401,11 +401,13 @@ def main():
'steelblue', 'blue', 'darkblue', 'indigo']
elif grad:
colors = []
g = pov.gradient(name='aquatic')
col1 = np.array([2., 242., 245.])/255.
col2 = np.array([252., 44., 255.])/255.
for i in range(grad):
x = i/grad
c = g.extract(x)
color = (c.r, c.g, c.b)
x = i/(grad-1)
# c = g.extract(x)
# color = (c.r, c.g, c.b)
color = (1-x)*col1 + x*col2
colors.append(color)
else:
colors = GCcolors.color_list
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment