lab-cosmo / chemiscope

An interactive structure/property explorer for materials and molecules
http://chemiscope.org
BSD 3-Clause "New" or "Revised" License
133 stars 34 forks source link

Log-scale option in coloring the data points #267

Closed SanggyuChong closed 1 month ago

SanggyuChong commented 1 year ago

Hello,

It would be great if an option to take the log of the data for the coloring of data points is available within Chemiscope. Currently, it seems that the user has to save the log of the data manually for this to take place. I was told that this feature was available before -- has there been some decisions against this? Thanks!

Best, Raymond

Luthaf commented 1 year ago

That would be fine with me. We would need to change the _colors function https://github.com/lab-cosmo/chemiscope/blob/634136b3d09cc32c9b951d1eb76293b2a872ec9a/src/map/map.ts#L1050

to look more like the _sizes function, likely with a calculateColors function on the map options.

ceriottm commented 1 year ago

I am reopening this as there are a number of bugs that need to be addressed. For starters, if log is called for a properties that has negative or zero values, it yields an error. That might be a reasonable thing to do, but it should be possible e.g. to set a minimum value >0 and then show this properly. In general, there are a number of quirks related to setting the extremes of the plot range, that make this option basically unusable. The zeolite dataset with volume as a color option is a good example of the problems that occur.

ceriottm commented 1 year ago

I would try to copy / reuse the behavior and option layout of the Cartesian axes

SanggyuChong commented 1 year ago

Ok, it does seem that there are some additional bugs to be fixed and design decisions to be made.

I will follow up with @angerossi and get these taken care of. Thanks all.

ceriottm commented 1 year ago

I think that the most important thing is to make sure the behavior (and the UI) is consistent with what happens for Cartesian axes. Adding a symlog function would be nice and perhaps not too hard if we use the same code.

ceriottm commented 1 year ago

Any progress on fixing the color options for good? It seems to be subtly broken in many different ways.

ayyrossi commented 1 year ago

I have had a meeting with @SanggyuChong and I am currently busy correcting the implementation. It will be finished shortly after the Easter break.

Luthaf commented 1 year ago

The ticks should become log scale as well in the color bar, but it doesn't and just displays raw exponent values. Behavior of the cartesian axes when log is invoked should be adopted here as well.

Is this even possible in plotly?

ceriottm commented 1 year ago

@SanggyuChong we were discussing this today, right? Is this still a problem or can we close the issue?

ceriottm commented 1 year ago

possibly relevant stackoverflow https://stackoverflow.com/questions/68368745/logarithmic-heatmap-in-plotly

ceriottm commented 11 months ago

also https://community.plotly.com/t/logarithmic-normalization-for-colorscale-colorbar/44183

Luthaf commented 1 month ago

Fixed by #280