From b69a4b95210265c412300b1e6143bd33f922b79a Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Fri, 5 Aug 2022 11:01:09 +0200 Subject: [PATCH] Plot efficiencies without changing options --- nafuma/electrochemistry/plot.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/nafuma/electrochemistry/plot.py b/nafuma/electrochemistry/plot.py index 5cdf869..5039d0f 100644 --- a/nafuma/electrochemistry/plot.py +++ b/nafuma/electrochemistry/plot.py @@ -1,3 +1,4 @@ +from pickle import MARK import matplotlib.pyplot as plt from matplotlib.ticker import (MultipleLocator, FormatStrFormatter,AutoMinorLocator) @@ -142,14 +143,23 @@ def plot_gc(data, options=None): # FIXME To begin, the default is that y-values correspond to x-values. This should probably be implemented in more logical and consistent manner in the future. - if options['charge']: - yval = 'charge_' + options['x_vals'] - data['cycles'].loc[mask].plot(x='cycle', y=yval, ax=ax, color=colours[0][0], kind='scatter', marker="$\u25EF$", s=plt.rcParams['lines.markersize']) - # + if options['x_vals'] in ['coulombic_efficiency', 'energy_efficiency']: + data['cycles'].loc[mask].plot(x='cycle', y=options['x_vals'], ax=ax, color=colours[0][0], kind='scatter', marker="$\u25EF$", s=plt.rcParams['lines.markersize']) + if options['limit']: + ax.axhline(y=options['limit'], ls='--', c='black') + + else: + if options['charge']: + yval = 'charge_' + options['x_vals'] + data['cycles'].loc[mask].plot(x='cycle', y=yval, ax=ax, color=colours[0][0], kind='scatter', marker="$\u25EF$", s=plt.rcParams['lines.markersize']) - if options['discharge']: - yval = 'discharge_' + options['x_vals'] - data['cycles'].loc[mask].plot(x='cycle', y=yval, ax=ax, color=colours[0][1], kind='scatter', marker="$\u25EF$", s=plt.rcParams['lines.markersize']) + if options['discharge']: + yval = 'discharge_' + options['x_vals'] + data['cycles'].loc[mask].plot(x='cycle', y=yval, ax=ax, color=colours[0][1], kind='scatter', marker="$\u25EF$", s=plt.rcParams['lines.markersize']) + + + if options['limit']: + ax.axhline(y=options['limit'], ls='--', c='black') if options['interactive_session_active']: