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

matplotlib.pyplot.savefig() breaks after useing model.linearize() #224

Open
martinscripts opened this issue Aug 14, 2024 · 0 comments
Open

Comments

@martinscripts
Copy link

Description

I can't use pyplot.savefig() from matplotlib.pyplot after linearizing a model with OMPython.

Steps to Reproduce

from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
model_path=omc.sendExpression("getInstallationDirectoryPath()") + "/share/doc/omc/testmodels/"
from OMPython import ModelicaSystem
import matplotlib.pyplot as plt

mod1 = ModelicaSystem(model_path + "BouncingBall.mo","BouncingBall")

plt.plot([1,2,3])
plt.savefig('test_before.png')
plt.show()

mod1.linearize()

plt.plot([1,2,3])
plt.savefig('test_after.png')
plt.show()

The test_before.png will be saved, the test_after.png will not.
If you remove mod1.linearize(), both will be saved.

Expected Behavior

savefig should work in both cases.

Screenshots

Version and OS

  • Python Version 3.10.11
  • OMPython Version 3.6.0
  • OpenModelica Version 1.18
  • OS: win10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant