Skip to content
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

Make use of LaTeX labels configurable #1

Merged
merged 1 commit into from
Mar 2, 2020
Merged
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
21 changes: 11 additions & 10 deletions scm/etc/scripts/gmtb_scm_plotting_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

mpl.rcParams['savefig.dpi'] = 150
mpl.rcParams['legend.handlelength'] = 5
latex_labels = False

def calc_skill_score(data, experiment, R_0, k):
sigma_data = np.std(data)
Expand All @@ -25,7 +26,7 @@ def calc_skill_score(data, experiment, R_0, k):

def plot_profile(z, values, x_label, y_label, filename, xticks=[], yticks=[], y_inverted = False, y_log = False, y_lim = []):
#xticks = [x_start, x_end, x_num]
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

fig = plt.figure()

Expand All @@ -52,7 +53,7 @@ def plot_profile(z, values, x_label, y_label, filename, xticks=[], yticks=[], y_

def plot_profile_multi(z, values, labels, x_label, y_label, filename, obs_z=None, obs_values=None, xticks=[], yticks=[], y_inverted = False, y_log = False, y_lim = [], conversion_factor=1.0, freeze_axis=None, line_type=None, color_index=None, skill_scores=False, zero_line=False):
#xticks = [x_start, x_end, x_num]
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

if np.count_nonzero(values) == 0:
print 'The plot for {} will not be created due to all zero values'.format(x_label)
Expand Down Expand Up @@ -226,7 +227,7 @@ def plot_profile_multi(z, values, labels, x_label, y_label, filename, obs_z=None

def plot_profile_compare(z, values, LES_values, LES_z, x_label, y_label, filename, xticks=[], yticks=[], y_inverted = False, y_log = False, x_lim = [], y_lim = []):
#xticks = [x_start, x_end, x_num]
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

fig = plt.figure()

Expand Down Expand Up @@ -260,7 +261,7 @@ def plot_profile_compare(z, values, LES_values, LES_z, x_label, y_label, filenam
plt.close()

def plot_time_series(time, values, x_label, y_label, filename):
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

fig = plt.figure()

Expand All @@ -272,7 +273,7 @@ def plot_time_series(time, values, x_label, y_label, filename):
plt.close()

def plot_time_series_compare(time, values, LES_time, LES_values, x_label, y_label, filename):
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

fig = plt.figure()

Expand All @@ -291,7 +292,7 @@ def plot_time_series_compare(time, values, LES_time, LES_values, x_label, y_labe
plt.close()

def plot_time_series_multi(time, values, labels, x_label, y_label, filename, obs_time=None, obs_values=None, obs_label=None, line_type=None, color_index=None, skill_scores=False, conversion_factor=1.0):
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

if np.count_nonzero(values) == 0:
print 'The plot for {} will not be created due to all zero values'.format(y_label)
Expand Down Expand Up @@ -405,7 +406,7 @@ def plot_time_series_multi(time, values, labels, x_label, y_label, filename, obs
def contour_plot_firl(x_dim, y_dim, values, min_val, max_val, title, x_label, y_label, filename, xticks=[], yticks=[], plot_mean = 0, annotation = 0, y_inverted = 0, y_log = False, y_lim = [], conversion_factor=1.0):
#os.environ['PATH'] = os.environ['PATH'] + ':/usr/texbin'
#plt.rc('ps', usedistiller='xpdf')
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

if np.count_nonzero(values) == 0:
print 'The plot for {} will not be created due to all zero values'.format(title)
Expand Down Expand Up @@ -485,7 +486,7 @@ def contour_plot_firl(x_dim, y_dim, values, min_val, max_val, title, x_label, y_

def plot_profile_multi_ens(z, values, labels, x_label, y_label, filename, obs_z=None, obs_values=None, xticks=[], yticks=[], y_inverted = False, y_log = False, y_lim = [], freeze_axis=None, line_type=None, color_index=None, skill_scores=False):
#xticks = [x_start, x_end, x_num]
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

#ensemble data processing
values_ens_processed = []
Expand Down Expand Up @@ -661,7 +662,7 @@ def plot_profile_multi_ens(z, values, labels, x_label, y_label, filename, obs_z=
plt.close()

def plot_time_series_multi_ens(time, values, labels, x_label, y_label, filename, obs_time=None, obs_values=None, obs_label=None, line_type=None, color_index=None, skill_scores=False):
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

fig = plt.figure()

Expand Down Expand Up @@ -806,7 +807,7 @@ def plot_time_series_multi_ens(time, values, labels, x_label, y_label, filename,
plt.close()

def plot_scatter_multi(x, y, x_label, y_label, filename, x_lim=[], y_lim=[], color_index=None):
plt.rc('text', usetex=True)
plt.rc('text', usetex=latex_labels)

colors = ['#e41a1c','#4daf4a','#377eb8','#984ea3','#ff7f00','#a65628','#f781bf','#ffff33']
if color_index is None:
Expand Down