ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
67 stars 24 forks source link

legend overlay with multiple plots in jupyter notebook #367

Open mcMunich opened 2 years ago

mcMunich commented 2 years ago

Before submitting the issue

Description of the bug

Legend overlap If I create 2 plots in pydpf the second plot legend appears to just get laid over the original and both are visible. image This is happening in a Anaconda jupyter notebook (py version 3.8.13)

Steps To Reproduce

run code:

from ansys.dpf import post
import time
myData = r'...\file.rst'
solution = post.load_solution(myData )
t1 = time.time()
displacement = solution.displacement()
norm = displacement.norm
norm.plot_contour()

t1 = time.time()
stress = solution.stress()
stress.xx.plot_contour(show_edges=False)

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

Installed packages

(python38) C:\Users\mcapella>python -m pip freeze aiohttp==3.8.1 aiosignal==1.2.0 alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work ansys-api-mapdl==0.5.1 ansys-corba==0.1.1 ansys-dpf-core==0.4.1 ansys-dpf-post==0.2.2 ansys-grpc-dpf==0.4.0 ansys-mapdl-core==0.61.6 ansys-mapdl-reader==0.51.11 appdirs==1.4.4 argon2-cffi @ file:///opt/conda/conda-bld/argon2-cffi_1645000214183/work argon2-cffi-bindings @ file:///C:/ci/argon2-cffi-bindings_1644569878360/work arrow @ file:///opt/conda/conda-bld/arrow_1649166651673/work astroid @ file:///C:/ci/astroid_1628063293445/work asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work async-timeout==4.0.2 atomicwrites==1.4.0 attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work autobahn==22.4.2 Automat==20.2.0 autopep8 @ file:///opt/conda/conda-bld/autopep8_1639166893812/work Babel @ file:///tmp/build/80754af9/babel_1620871417480/work backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work bcrypt @ file:///C:/ci/bcrypt_1597936263757/work beautifulsoup4 @ file:///C:/ci/beautifulsoup4_1650274792587/work binaryornot @ file:///tmp/build/80754af9/binaryornot_1617751525010/work black==19.10b0 bleach @ file:///opt/conda/conda-bld/bleach_1641577558959/work brotlipy==0.7.0 cachetools==5.1.0 certifi==2019.11.28 cffi @ file:///C:/ci_310/cffi_1642682485096/work chardet @ file:///C:/ci/chardet_1607690654534/work charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work click @ file:///C:/ci/click_1646056799533/work cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1632508026186/work colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work constantly==15.1.0 cookiecutter @ file:///opt/conda/conda-bld/cookiecutter_1649151442564/work cryptography @ file:///C:/ci/cryptography_1652101772384/work cycler==0.11.0 debugpy @ file:///C:/ci/debugpy_1637073815078/work decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work diff-match-patch @ file:///Users/ktietz/demo/mc3/conda-bld/diff-match-patch_1630511840874/work docutils @ file:///C:/ci/docutils_1620828260973/work entrypoints @ file:///C:/ci/entrypoints_1649926621247/work executing @ file:///opt/conda/conda-bld/executing_1646925071911/work fastjsonschema @ file:///tmp/build/80754af9/python-fastjsonschema_1620414857593/work/dist flake8 @ file:///tmp/build/80754af9/flake8_1620776156532/work fonttools==4.33.3 frozenlist==1.3.0 geomdl==5.3.1 google-api-core==2.7.3 google-api-python-client==2.48.0 google-auth==2.6.6 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.1 grpcio==1.46.1 httplib2==0.20.4 hyperlink==21.0.0 idna @ file:///tmp/build/80754af9/idna_1637925883363/work imageio==2.19.2 imagesize @ file:///tmp/build/80754af9/imagesize_1637939814114/work importlib-metadata @ file:///C:/ci/importlib-metadata_1648544472910/work importlib-resources @ file:///tmp/build/80754af9/importlib_resources_1625135880749/work incremental==21.3.0 inflection==0.5.1 intervaltree @ file:///Users/ktietz/demo/mc3/conda-bld/intervaltree_1630511889664/work ipycanvas==0.12.0 ipyevents==2.0.1 ipykernel @ file:///C:/ci/ipykernel_1647000978151/work/dist/ipykernel-6.9.1-py3-none-any.whl ipython @ file:///C:/ci/ipython_1651601994376/work ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work ipyvtklink==0.2.2 ipywidgets==7.7.0 isort @ file:///tmp/build/80754af9/isort_1628603791788/work jedi @ file:///C:/ci/jedi_1644315425835/work Jinja2 @ file:///opt/conda/conda-bld/jinja2_1647436528585/work jinja2-time @ file:///opt/conda/conda-bld/jinja2-time_1649251842261/work jsonschema @ file:///C:/ci/jsonschema_1650026220037/work jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1616770841739/work jupyter-core @ file:///C:/ci/jupyter_core_1651656285178/work jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work jupyterlab-widgets==1.1.0 keyring @ file:///C:/ci/keyring_1638531661481/work kiwisolver==1.4.2 lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1616529307648/work littleutils==0.2.2 MarkupSafe @ file:///C:/ci/markupsafe_1621528314575/work matplotlib==3.5.2 matplotlib-inline @ file:///tmp/build/80754af9/matplotlib-inline_1628242447089/work mccabe==0.6.1 mistune==0.8.4 multidict==6.0.2 mypy-extensions==0.4.3 nbclient @ file:///C:/ci/nbclient_1650290386732/work nbconvert @ file:///C:/ci/nbconvert_1649741005454/work nbformat @ file:///C:/ci/nbformat_1649845101866/work nest-asyncio @ file:///C:/ci/nest-asyncio_1649829929372/work notebook @ file:///C:/ci/notebook_1651648658345/work numpy==1.22.3 numpydoc @ file:///opt/conda/conda-bld/numpydoc_1643788541039/work outdated==0.2.1 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pandocfilters @ file:///opt/conda/conda-bld/pandocfilters_1643405455980/work paramiko @ file:///opt/conda/conda-bld/paramiko_1640109032755/work parso @ file:///opt/conda/conda-bld/parso_1641458642106/work pathspec==0.7.0 pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work Pillow==9.1.1 pluggy @ file:///C:/ci/pluggy_1648042776090/work poyo @ file:///tmp/build/80754af9/poyo_1617751526755/work progressbar2==4.0.0 prometheus-client @ file:///opt/conda/conda-bld/prometheus_client_1643788673601/work prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1633440160888/work protobuf==3.20.1 psutil @ file:///C:/ci/psutil_1612298324802/work ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work py-cpuinfo==5.0.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycodestyle @ file:///tmp/build/80754af9/pycodestyle_1615748559966/work pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1621600989141/work pyflakes @ file:///tmp/build/80754af9/pyflakes_1617200973297/work Pygments @ file:///opt/conda/conda-bld/pygments_1644249106324/work pyiges==0.2.1 pylint @ file:///C:/ci/pylint_1627536881874/work pyls-spyder==0.4.0 PyNaCl @ file:///C:/ci/pynacl_1595000047588/work pyOpenSSL @ file:///opt/conda/conda-bld/pyopenssl_1643788558760/work pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pyrsistent @ file:///C:/ci/pyrsistent_1636111468851/work PySocks @ file:///C:/ci/pysocks_1605287845585/work python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work python-lsp-black @ file:///tmp/build/80754af9/python-lsp-black_1634232156041/work python-lsp-jsonrpc==1.0.0 python-lsp-server==1.2.4 python-slugify @ file:///tmp/build/80754af9/python-slugify_1620405669636/work python-utils==3.2.2 pytz==2021.3 pyvista==0.34.1 pywin32==302 pywin32-ctypes==0.2.0 pywinpty @ file:///C:/ci_310/pywinpty_1644230983541/work/target/wheels/pywinpty-2.0.2-cp38-none-win_amd64.whl PyYAML==6.0 pyzmq @ file:///C:/ci/pyzmq_1638435185959/work QDarkStyle @ file:///tmp/build/80754af9/qdarkstyle_1617386714626/work qstylizer @ file:///tmp/build/80754af9/qstylizer_1617713584600/work/dist/qstylizer-0.1.10-py2.py3-none-any.whl QtAwesome @ file:///tmp/build/80754af9/qtawesome_1637160816833/work qtconsole @ file:///opt/conda/conda-bld/qtconsole_1649078897110/work QtPy @ file:///opt/conda/conda-bld/qtpy_1649073884068/work regex @ file:///C:/ci/regex_1648447923622/work requests @ file:///opt/conda/conda-bld/requests_1641824580448/work rope @ file:///opt/conda/conda-bld/rope_1643788605236/work rsa==4.8 Rtree @ file:///C:/ci/rtree_1618421009405/work scipy==1.8.0 scooby==0.5.12 Send2Trash @ file:///tmp/build/80754af9/send2trash_1632406701022/work sip==4.19.13 six @ file:///tmp/build/80754af9/six_1644875935023/work snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1637937080595/work sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1623949099177/work soupsieve @ file:///tmp/build/80754af9/soupsieve_1636706018808/work Sphinx @ file:///opt/conda/conda-bld/sphinx_1643644169832/work sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work sphinxcontrib-htmlhelp @ file:///tmp/build/80754af9/sphinxcontrib-htmlhelp_1623945626792/work sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work sphinxcontrib-serializinghtml @ file:///tmp/build/80754af9/sphinxcontrib-serializinghtml_1624451540180/work spyder @ file:///C:/ci/spyder_1636481183311/work spyder-kernels @ file:///C:/ci/spyder-kernels_1634237040526/work stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work terminado @ file:///C:/ci/terminado_1644322757089/work testpath @ file:///tmp/build/80754af9/testpath_1624638946665/work text-unidecode @ file:///Users/ktietz/demo/mc3/conda-bld/text-unidecode_1629401354553/work textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work tinycss @ file:///tmp/build/80754af9/tinycss_1617713798712/work toml @ file:///tmp/build/80754af9/toml_1616166611790/work tornado @ file:///C:/ci/tornado_1606942392901/work tqdm==4.64.0 traitlets @ file:///tmp/build/80754af9/traitlets_1636710298902/work Twisted==22.4.0 twisted-iocpsupport==1.0.2 txaio==22.2.1 typed-ast @ file:///C:/ci/typed-ast_1624953785070/work typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work ujson @ file:///C:/ci/ujson_1648044264644/work Unidecode @ file:///tmp/build/80754af9/unidecode_1614712377438/work uritemplate==4.1.1 urllib3 @ file:///C:/ci/urllib3_1650640043075/work vtk==9.0.3 watchdog @ file:///C:/ci/watchdog_1638349261759/work wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work webencodings==0.5.1 widgetsnbextension==3.6.0 win-inet-pton @ file:///C:/ci/win_inet_pton_1605306167264/work wincertstore==0.2 wrapt==1.12.1 wslink==1.6.4 yapf @ file:///tmp/build/80754af9/yapf_1615749224965/work yarl==1.7.2 zipp @ file:///C:/ci/zipp_1652274073489/work zope.interface==5.4.0

mcMunich commented 2 years ago

If I rerun the jupyter notebook cell (which closes the image before replotting) then the issue does not appear. So the issue might be specific to starting with Kernel - Restart & Run All. When they run sequentially (launch everything) the issue appears.

PProfizi commented 2 years ago

Hi @mcMunich, I see you are using ansys-dpf-core 0.4.1, would it be possible to update to 0.4.2 and see if the problem persists? I integrated changes in 0.4.2 that remind me of this exact type of problem.