Skip to content

Commit

Permalink
Rename label and xlabel
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-schlipf committed Oct 2, 2023
1 parent 05a5a34 commit 2454692
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/py4vasp/_data/workfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ def to_graph(self):
two lattice vectors is on the y axis.
"""
data = self.to_dict()
series = graph.Series(
data["distance"], data["average_potential"], data["direction"]
)
series = graph.Series(data["distance"], data["average_potential"], "potential")
return graph.Graph(
series=series, xlabel="distance (Å)", ylabel="average potential (eV)"
series=series, xlabel=f"distance along {data['direction']} (Å)", ylabel="average potential (eV)"
)
4 changes: 2 additions & 2 deletions tests/data/test_workfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def test_read(workfunction, Assert):

def test_plot(workfunction, Assert):
graph = workfunction.plot()
assert graph.xlabel == "distance (Å)"
assert graph.xlabel == f"distance along {workfunction.ref.lattice_vector} (Å)"
assert graph.ylabel == "average potential (eV)"
Assert.allclose(graph.series.x, workfunction.ref.distance)
Assert.allclose(graph.series.y, workfunction.ref.average_potential)
assert graph.series.name == workfunction.ref.lattice_vector
assert graph.series.name == "potential"


@patch("py4vasp._data.workfunction.Workfunction.to_graph")
Expand Down

0 comments on commit 2454692

Please sign in to comment.