Plotting issue with notebooks
There is a plotting issue that might be an issue for some users. When I run lp.plot_output(output) I get the graphs correctly. The problem comes at the second run. I change some parameters, the simulation runs fine but after that the plots do not show anymore. The only solution I found is to restart the kernel and import the libraries from scratch. Is it an issue with liionpack or with jupyter notebook, visual studio code?
@hectormara This is the new ticket for your discussion
Can you share some information about your setup?
- Were you using the develop branch or the version from pip? Release v0.3.11 has a bug which was fixed on develop, but not yet released as v0.3.12
- Are you running windows, linux, or Mac?
- Can you share which notebook you were using when you saw the issue?
Thank you. I was using liionpack 0.3.10 from pip under windows.
The code is this:
import liionpack as lp
import pybamm
# Generate the netlist
netlist = lp.setup_circuit(Np=4, Ns=3, Rb=1e-3, Rc=1e-2)
# Define some additional variables to output
output_variables = [
'X-averaged negative particle surface concentration [mol.m-3]',
'X-averaged positive particle surface concentration [mol.m-3]',
]
amperes = input("Enter the current: ")
# Cycling experiment, using PyBaMM
experiment = pybamm.Experiment([
"Charge at " + amperes + " A for 30 minutes",
"Rest for 15 minutes",
"Discharge at 5 A for 30 minutes",
"Rest for 30 minutes"],
period="10 seconds")
# PyBaMM battery parameters
parameter_values = pybamm.ParameterValues("Chen2020")
# Solve the pack problem
output = lp.solve(netlist=netlist,
parameter_values=parameter_values,
experiment=experiment,
output_variables=output_variables,
initial_soc=0.5)
# Display the results
lp.plot_output(output)
The same happens with the function lp.compare_solution_output. Any suggestions?
There is a quick workaround. After the "plot_output" function write plt.show(). At the beginning write `import matplotlib.pyplot as plt
fig, ax = plt.subplots() ax.clear() `