Skip to content

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

@martinscripts

Description

@martinscripts

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions