Skip to content

Updating Ternary and Quaternary Plots #3948

Merged
shyuep merged 15 commits intomaterialsproject:masterfrom
JoshuaNgXY:JoshuaNgXY-patch-2
Aug 9, 2024
Merged

Updating Ternary and Quaternary Plots #3948
shyuep merged 15 commits intomaterialsproject:masterfrom
JoshuaNgXY:JoshuaNgXY-patch-2

Conversation

@JoshuaNgXY
Copy link
Copy Markdown
Contributor

@JoshuaNgXY JoshuaNgXY commented Jul 22, 2024

Summary

The atomic concentrations of each material in the ternary graph are added to the 2D and 3D ternary graphs for readability. A toggle is added to the quaternary graph hull surfaces.

Extra labels added to hovertext of the Voltage graph for readability.

Adding atomic concentrations:

  • Atomic concentrations are added to the hovertext of the stable and unstable markers within the get_marker_props() for both the ternary and quaternary graphs.

Adding Toggle to Quaternary Graph Hull Surfaces:

  • 3D Mesh objects for the hull surfaces are added to a legend group named facets. The first 3D Mesh object is used to display the whole group in the legend, and is renamed to Hull Surfaces (toggle to access points easier).
  • This fixes a bug where datapoints encased within the hull surface could not be accessed by toggling the surfaces.
  • Added text before the formation energy and energy above hull values to make it more clear what was being shown.

Adds marker labels to 3D ternary plots

Adds additional spacing to 2D and 3D hovertext so it is easier to read.

Signed-off-by: JoshuaNgXY <jxng@lbl.gov>
Signed-off-by: JoshuaNgXY <jxng@lbl.gov>
@JoshuaNgXY JoshuaNgXY marked this pull request as draft July 22, 2024 21:20
pre-commit-ci Bot and others added 2 commits July 22, 2024 21:20
Variable name update

Signed-off-by: JoshuaNgXY <jxng@lbl.gov>
@JoshuaNgXY JoshuaNgXY marked this pull request as ready for review July 22, 2024 21:23
@shyuep shyuep enabled auto-merge (squash) July 23, 2024 21:21
Updated hovertext to specify "Formation energy" and "Energy above hull".

Updated Quaternary plot to have labels for atomic concentration of elements.

Added a label to quaternary plot which allows users to toggle the hull surfaces so that the inner points can be accessed.

Signed-off-by: JoshuaNgXY <jxng@lbl.gov>
auto-merge was automatically disabled July 23, 2024 23:39

Head branch was pushed to by a user without write access

@JoshuaNgXY JoshuaNgXY changed the title Updating Ternary Plots Updating Ternary and Quaternary Plots Jul 23, 2024
Small variable name change to fix pre-commit

Signed-off-by: JoshuaNgXY <jxng@lbl.gov>
@mkhorton
Copy link
Copy Markdown
Member

Thanks for this PR @JoshuaNgXY! Since it deals with plotting can you add some screenshots?

@JoshuaNgXY
Copy link
Copy Markdown
Contributor Author

Sure, here are the before and after for the ternary and quaternary plots.

Ternary Plot Update:

Old

image

New

image

Quaternary Plot Update:

Old

image

New

image

@yang-ruoxi
Copy link
Copy Markdown
Member

@JoshuaNgXY is working with MP to update the PD plotting functionality. If you think it's good to go then we can then update the dependencies. Thank you @mkhorton @janosh !

@janosh janosh force-pushed the master branch 2 times, most recently from e3fbc67 to 41e6d99 Compare August 3, 2024 19:01
Added labels for the x value to points on the voltage graph so they are easier to read.

Signed-off-by: JoshuaNgXY <joshuang@g.ucla.edu>
@JoshuaNgXY
Copy link
Copy Markdown
Contributor Author

Battery Voltage Graph has added labels to the hovertext to display the x location and the corresponding x-axis title.
Before:
image

After:
image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformatting the Battery hovertext to include more information about the x-axis.

color=next(fillcolors),
legendgroup="facets",
)
]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the legendgroup to the facets of the quaternary graph. The first facet is used as the entry to the legend and defines the name which appears in the legend.

if e_above_hull > self.show_unstable:
continue
label += f" ({e_above_hull:+} eV/atom)"
label += f" Energy Above Hull: ({e_above_hull:+} eV/atom)"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alongside 3008, small format change

label += "<br>"
total_sum_el = sum(entry.composition[el] for el, _axis in zip(self._pd.elements, range(self._dim)))
for el, _axis in zip(self._pd.elements, range(self._dim)):
label += f"<br> {el}: {round(entry.composition[el]/total_sum_el, 6)}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating Ternary hovertext

label += "<br>"
total_sum_el = sum(entry.composition[el] for el, _axis in zip(self._pd.elements, range(self._dim)))
for el, _axis in zip(self._pd.elements, range(self._dim)):
label += f"<br> {el}: {round(entry.composition[el]/total_sum_el, 6)}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating Quaternary Hovertext

JoshuaNgXY and others added 4 commits August 8, 2024 14:39
Trying to fix tests

Signed-off-by: JoshuaNgXY <joshuang@g.ucla.edu>
Barebones fix to pass tests

Signed-off-by: JoshuaNgXY <joshuang@g.ucla.edu>
@shyuep shyuep merged commit 289d281 into materialsproject:master Aug 9, 2024
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

Successfully merging this pull request may close these issues.

4 participants