BAMWelDX / weldx-widgets

This project provides widgets to perform common tasks using the weldx library
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Matplotlib CSM visualization should display units for axis labels #80

Open marscher opened 2 years ago

marscher commented 2 years ago

Assuming all LCS have the same units (is this case treated in CSM?) we should draw the unit for each axis label.

vhirtham commented 2 years ago

If we want to label the axes, we can simply iterate over all LCS, retrieve the coordinate unit and take the most common one for the plot. In this case, it wouldn't matter if all have the same or not. Additionally, we could add a unit parameter to the plot function so that the user can select his favorite unit. ;)

marscher commented 2 years ago

But shouldn't the least common unit be converted inside the LCS to the most common one? Otherwise there is a great potential for confusion. Agreed upon adding a unit parameter (which would then also trigger a convert).

vhirtham commented 2 years ago

Not sure why. As long as you "work" with the CSM all unit-related stuff is handled internally the moment it is relevant. If you extract an LCS, coordinates have still units attached. Only if you want to visualize it, a common unit is needed. But we can solve this the way I suggested.

CagtayFabry commented 2 years ago

we could also try enabling the matplotlib support of pint for our unit registry, ideally that would not require any conversion on our part but make it easy to set the desired output unit

marscher commented 2 years ago

This sounds like a very convenient solution. Thanks for pointing it out.