Page 1 of 1

py4vasp (problem with 'plot' from 'py4vasp' )

Posted: Fri Jan 13, 2023 9:59 pm
by rfaccio
Dear all
Sorry to bother you with a python problem, but I haven't been able to fix it and I really need to use "plot" from py4vasp.
The problem is the following, when importing plot from py4vasp, for example:
import numpy as np
from py4vasp import plot

t1, beef = np.loadtxt("./BEEF.dat",
usecols=[1,3], unpack=True)

plot(t1, beef,
xlabel="Time step",
ylabel="Bayesian error",
title="Bayesian error estimate of forces (max) (eV Angst^-1)"
ImportError: cannot import name 'plot' from 'py4vasp' (/opt/intel/oneapi/intelpython/latest/lib/python3.7/site-packages/py4vasp/__init__.py)


Y tried several installations (e.g.: fresh or inclusive under virtual-env) in different nodes (Ubuntu 20.04.4 LTS) but the same problem occurs.
Any hint?
Best
Ricardo Faccio

Re: py4vasp (problem with 'plot' from 'py4vasp' )

Posted: Sat Jan 14, 2023 5:33 pm
by rfaccio
Dear all
I found the error, searching in the Vaspwiki the solution is to use plotly instead of plot from py4vasp:
import plotly.express as px
Now it works.
Sorry and thanks again.
Best
Ricardo

Re: py4vasp (problem with 'plot' from 'py4vasp' )

Posted: Mon Jan 16, 2023 8:41 am
by andreas.singraber
Hello!

Indeed py4vasp relies on plotly (currently version 5.9.0) for generating plots, it is one of its requirements. Glad you already found the problem, thanks for posting an update!

Best,
Andreas Singraber