numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
18 stars 6 forks source link

'hist' shall use categories, if available #26

Closed numeredev closed 1 year ago

numeredev commented 1 year ago

DESCRIPTION

Is your change request related to a problem? Please describe. If we create a histogram with hist from a categorical column, we get the same result as if we would create the histogram from a value column filled with the category IDs.

Describe the solution you'd like The command hist shall make use of categories, if they are available, and additionally shall use them for x labels of the created graph and the summary table.

Describe possible alternatives you've considered A minimal alternative is to use TAB().binsof(), but that requires a bit more steps. Enabling this feature for hist would make the results a bit more understandable.

Additional context Add any other context or screenshots about the feature request here.

(Do not write below this line)


DEVS' SECTION

ANALYSIS

Main changes are to be done in static void createHist1D(...). Here, we have to detect the number of bins and their numerical values from the category interval if all columns are categorical (overriding the bin calculation method for categorical columns).

In static void createOutputForHist1D() and static void createPlotForHist1D() we have to create the labels from the categories. Note that this only applies, if all columns share their categories (otherwise we simply don't know which label to use). Implement the change whereever the axis values are used (if all conditions apply, probably replacing static std::string prepareTicksForHist1d()).

IMPLEMENTATION STEPS

(see also our Wiki for implementation guidelines)

DOCUMENTATION STEPS

(see also our Wiki for further information)

PULL REQUEST