-
Notifications
You must be signed in to change notification settings - Fork 25
ptable_scatters
allow 3rd data dimension for colormap
#155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@janosh Please review this. One thing left though, we might need to set a good default for the Lines 295 to 304 in 523101b
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @DanielYang59, great work as usual! 🚀 just 2 minor comments
…z into ptable-scatter-cmap
forgot to reply to this question earlier. how about we copy the VESTA and JMOL color palettes over from elem_colors: Literal["vesta", "jmol"] |
former replaces CountMode in ptable.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @DanielYang59, this looks great!
Thanks for the final beautiful touch :) |
@@ -299,21 +299,21 @@ def elem_colors(self) -> dict[str, ColorType]: | |||
@elem_colors.setter | |||
def elem_colors( | |||
self, | |||
elem_colors: Literal["vesta", "jmol"] | dict[str, ColorType] = "vesta", | |||
elem_colors: ElemColors | dict[str, ColorType] | None = ElemColors.vesta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why do we need None
here? which would resolve to vesta
anyway?
Lines 308 to 309 in 9e6be47
if elem_colors in ("vesta", None): | |
self._elem_colors = ELEM_COLORS_VESTA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i imagine someone who wants to set the colors back to default and doesn't know what the default is might just try
projector.elem_colors = None
and see what happens. maybe that's just me in which case i'm open to changing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i imagine someone who wants to set the colors back to default and doesn't know what the default is might just try
projector.elem_colors = Noneand see what happens.
I think if a user don't read the docstring/manual at all, they may not image setting None
would set the colors to default in the first place (they might expect the default to be a dict
mapping). On the other hand, if they read the docstring, they would know how to set the colors, so I think None
adds to ambiguity here :)
Also it might be easier for them to remove/comment out the argument to set it to default, instead of passing a None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair, feel free to remove the None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay!
* remove TODO tag * add placeholder docstrings * enable color * enable unit test * set default cmap to None * [partly] fix homo-nuclear-mace-medium. * fix absent element handling * update TODO tag * tweak comments * clarify ChildPlotters doc string * rename PTableProjector instances plotter->projector * update usage of `child_kwargs` * update scatter example data * add ptable_scatters to main readme * add new ElemCountMode, ElemColorMode enums former replaces CountMode in ptable.py * copy elementari colors * remove `jmol_colors` need double check * fix type alias * fix jmol colors for structure_viz * scale rgb values to 0-1 range * rename _colors.py to colors.py * replace pymatviz.colors.Color with matplotlib.typing.ColorType * add ElemColors enum and test PTableProjector.elem_colors * add 2nd example for ptable-scatters to readme showing parabolas * compress SVGs --------- Co-authored-by: Janosh Riebesell <[email protected]>
Summary
ptable_scatters
allow 3rd data dimension for colormap, to closeptable_scatters
allow 3rd data dimension for colormap #141.examples/diatomics/homo-nuclear-mace-medium.svg
PTableProjector
propertyelem_colors
:pymatviz/pymatviz/ptable.py
Lines 300 to 304 in aaa7aa1
text_color
aselement-types
could overwrite defaultelem_type_color
:pymatviz/pymatviz/ptable.py
Line 405 in 523101b