Skip to content

Commit 3a0e734

Browse files
authored
Add color_scale param to allow for linear, logarithmic, arcsinh scaling of property values in cluster_compositions (#288)
* add color_scale param to allow for linear, logarithmic, and arcsinh scaling of property values in cluster_compositions - via private function _generate_colorbar_ticks to create custom tick values and labels based on selected color scale - updated hover tooltips to display original property values instead of transformed values for non-linear scales - unit tests to validate color scale and hover text formatting in various scenarios * rename fig attribute in cluster_compositions from _pymatviz_meta to _pymatviz * use log scale in cluster_compositions_matbench.py for matbench_dielectric
1 parent 52259e9 commit 3a0e734

File tree

5 files changed

+1821
-91
lines changed

5 files changed

+1821
-91
lines changed

assets/scripts/cluster/composition/cluster_compositions_matbench.py

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def process_dataset(
6464
embed_method: EmbeddingMethod,
6565
projection: ProjectionMethod,
6666
n_components: int,
67+
**kwargs: Any,
6768
) -> go.Figure:
6869
"""Process a single dataset and create clustering visualizations.
6970
@@ -74,6 +75,7 @@ def process_dataset(
7475
embed_method (EmbeddingMethod): Method to convert compositions to vectors
7576
projection (ProjectionMethod): Method to reduce dimensionality
7677
n_components (int): Number of dimensions for projection (2 or 3)
78+
kwargs: Passed to cluster_compositions()
7779
7880
Returns:
7981
fig: Plotly figure
@@ -139,6 +141,7 @@ def process_dataset(
139141
width=1000,
140142
height=600,
141143
show_chem_sys="shape" if len(compositions) < 1000 else None,
144+
**kwargs,
142145
)
143146

144147
# Update title and margins
@@ -211,6 +214,7 @@ def process_dataset(
211214
embed_method=embed_method,
212215
projection=proj_method,
213216
n_components=n_components,
217+
color_scale="log" if data_name == "matbench_dielectric" else "linear",
214218
)
215219
fig.update_layout(coloraxis_colorbar=cbar_args)
216220

0 commit comments

Comments
 (0)