Skip to content

silx.gui.plot3d: Global size parameters now scales symbols with array sizes#4539

Open
loichuder wants to merge 1 commit intomainfrom
scatter3d-size-scaling
Open

silx.gui.plot3d: Global size parameters now scales symbols with array sizes#4539
loichuder wants to merge 1 commit intomainfrom
scatter3d-size-scaling

Conversation

@loichuder
Copy link
Copy Markdown
Member

  • The use of generative AI is disclosed and described (see AI policy)
  • The PR title is formatted as: <Module or Topic>: <Action> <Summary> (see contributing guidelines)

#4538 (comment)

"""Overrides supported ComplexMode"""


class SymbolMixIn(_SymbolMixIn):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is it fine to implement it here in SymbolMixIn ? Or must I drill deeper in the hierarchy of classes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is OK for me. I already hesitated to add the symbol size here as well instead of the base class in plot.
If we add multiple sizes support to 2d scatters, this will have to move to plot but that shouldn't break anything

Copy link
Copy Markdown
Member

@t20100 t20100 left a comment

Choose a reason for hiding this comment

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

It is OK for me, but this adds a second way to set the symbol size. I'm wondering if it would not be best to have a different approach:

  • Revert code to keep get|setSymbolSize with a unique value
  • Add get|setSymbolSizeData to pass an array of values or None to disable which gets normalized to range [1, getSymbolSize()] for display

What do you think?

def __init__(self):
super().__init__()
self.__primitive = None
self.__scaleFactor = 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
self.__scaleFactor = 1
self.__scaleFactor = 1.0

super().setSymbolSize(size, copy)
self._syncPointsPrimitive()

def setSizeScaleFactor(self, scaleFactor: float):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I propose to name it getSymbolSizeScaleFactor or getSymbolSizeScale. It's a bit long but makes it unambiguous which size it is.

Can you add a getter for it as well?

"""Overrides supported ComplexMode"""


class SymbolMixIn(_SymbolMixIn):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is OK for me. I already hesitated to add the symbol size here as well instead of the base class in plot.
If we add multiple sizes support to 2d scatters, this will have to move to plot but that shouldn't break anything

@loichuder
Copy link
Copy Markdown
Member Author

  • Add get|setSymbolSizeData to pass an array of values or None to disable which gets normalized to range [1, getSymbolSize()] for display

That could work as well! The only problem is that the smallest marker will always have the size 1 so we will scale the difference between marker sizes rather than the global marker size, no?

@t20100
Copy link
Copy Markdown
Member

t20100 commented Apr 1, 2026

What about making setSizeScaleFactor private for now and add this to the coming release and eventually rework this afterwards or make it public if no better approach?

@loichuder
Copy link
Copy Markdown
Member Author

What about making setSizeScaleFactor private for now and add this to the coming release and eventually rework this afterwards or make it public if no better approach?

I am okay if this does not go in the release. It is not essential and needs a rework as we discussed.

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.

2 participants