Allow passing fig and ax to plot_cv()
This commit is contained in:
parent
940e794a1c
commit
f23d140453
1 changed files with 9 additions and 4 deletions
|
|
@ -209,7 +209,6 @@ def plot_gc_interactive(data, options):
|
||||||
def plot_cv(data, options):
|
def plot_cv(data, options):
|
||||||
|
|
||||||
# Update options
|
# Update options
|
||||||
required_options = ['force_reload', 'x_vals', 'y_vals', 'which_cycles', 'limit', 'exclude_cycles', 'show_plot', 'charge', 'discharge', 'colours', 'differentiate_charge_discharge', 'gradient', 'interactive', 'interactive_session_active', 'rc_params', 'format_params', 'save_gif', 'save_path', 'fps']
|
|
||||||
default_options = {
|
default_options = {
|
||||||
'force_reload': False,
|
'force_reload': False,
|
||||||
'x_vals': 'voltage', 'y_vals': 'current',
|
'x_vals': 'voltage', 'y_vals': 'current',
|
||||||
|
|
@ -227,10 +226,13 @@ def plot_cv(data, options):
|
||||||
'format_params': {},
|
'format_params': {},
|
||||||
'save_gif': False,
|
'save_gif': False,
|
||||||
'save_path': 'animation.gif',
|
'save_path': 'animation.gif',
|
||||||
'fps': 1
|
'fps': 1,
|
||||||
|
'plot_every': 1,
|
||||||
|
'fig': None,
|
||||||
|
'ax': None
|
||||||
}
|
}
|
||||||
|
|
||||||
options = aux.update_options(options=options, required_options=required_options, default_options=default_options)
|
options = aux.update_options(options=options, default_options=default_options)
|
||||||
|
|
||||||
|
|
||||||
# Read data if not already loaded
|
# Read data if not already loaded
|
||||||
|
|
@ -245,7 +247,10 @@ def plot_cv(data, options):
|
||||||
|
|
||||||
if options['show_plot']:
|
if options['show_plot']:
|
||||||
# Prepare plot
|
# Prepare plot
|
||||||
|
if not options['fig'] and not options['ax']:
|
||||||
fig, ax = btp.prepare_plot(options=options)
|
fig, ax = btp.prepare_plot(options=options)
|
||||||
|
else:
|
||||||
|
fig, ax = options['fig'], options['ax']
|
||||||
|
|
||||||
for i, cycle in enumerate(options['which_cycles']):
|
for i, cycle in enumerate(options['which_cycles']):
|
||||||
if options['charge']:
|
if options['charge']:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue