silx
silx copied to clipboard
How about a posibility to save the aspect ration option in SILX_style?
Working with 2d datasets in NeXus hdf5 with different units on the x- and y-axis I was wondering if there is a way to tell silx view to open a NXdata image view with the option "Do not keep data aspect ration" activated? By default it seems to keep the aspect ratio.
Would the the SILX_style
be an appropriate place?
https://github.com/silx-kit/silx/blob/360f890a617676a92f0bed6a28b718d09e70ec03/src/silx/io/nxdata/parse.py#L64
HI Linus,
Have you checked in the menu? I think there is a default aspect ration option. But i dont remember if it is applied for the NXdata.
Also, i think it was already discussed, but if the units dosen't match i think there is no need to apply by default the constraint on the aspect ratio.
This have to be checked with @t20100, but in this case, this could be set as the default behaviour in silx?
Yes that would make sense to enable "keep aspect ratio" only when the units of both axes are the same.
If that's not enough, we can also consider extending SILX_style
to include a toggle about the aspect ratio
Basic solution would be to add a keep_aspect_ratio
boolean.
But, I propose to add an aspect
(or aspect_ratio
) field which can be either equal
or auto
. It leaves more room for extensions than a boolean.
This is inspired from: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_aspect.html#matplotlib.axes.Axes.set_aspect
attn @loichuder @axelboc : What do you think? This needs to be sync between silx and h5web.
In h5web, the aspect ratio setting is saved when the user changes it which seem to alleviate the issue at hand.
Is it reset each time you load a dataset in silx ?
If we decide to extend SILX_style
, I would be more inclined towards having a aspect_ratio
field with set values rather than a boolean.
In h5web, the aspect ratio setting is saved when the user changes it which seem to alleviate the issue at hand.
Not completely since you can have multiple nxdata in the same file. But yeah, it makes it complicated to mix both.
Is it reset each time you load a dataset in silx ?
It is not saved as a preference when you restart the app. It is however kept when you change from one dataset to another and keep the same vis...
Seems to me like checking the units is enough, at least for now. If we implement this in H5Web, we'll have to review how the layout
option is persisted. I'll open an issue in the repo.
Proposition: Keep aspect ratio by default and disable it when axes have different @units
(i.e., keep aspect ratio for axes with the same @units
or without @units
- if an axis as @units
and the other not, it's different @units
) and see if that is enough before extending SILX_style
.
Would that be OK?