Closed abubelinha closed 1 year ago
It's been a long time since I've messed with the algorithm so I don't recall whether unsorted data might actually produce something wrong or not. But it will certainly fail to choose rectangles that are as square as possible. In fact, from the example images you showed in your other issue, it was very clear that the inputs had not been sorted based on the shape of the rectangles.
Either way, I'm not sure whether you could guarantee that the relative positioning of the squares varies continuously as you change the scores. If I had to guess, it probably won't be continuous.
But it will certainly fail to choose rectangles that are as square as possible
Thanks. I had not thought about that. Actually I was not concerned about having square shapes: only about areas being of the right sizes. In my case, I am interested in an arbitrary order of boxes, so people can quickly find a box without prior knowledge of its area (numeric value). For example, representing country population with countries alphabetically arranged in the graph by their names (not by their population).
Either way, I'm not sure whether you could guarantee that the relative positioning of the squares varies continuously as you change the scores. If I had to guess, it probably won't be continuous.
That's the point: it won't be continuous if boxes are arranged by their dynamic numerical values (in 10 years, many countries will change their positions in population ranking order). But if you draw them in an arbitrary order (alphabetical or whatever you chose), then you could in theory create a nice animation ... as far as squarify keeps using the chosen order. See what I mean?
A small issue, just to clarify one sentence in the example provided: I had already made some apparently successful test-plots of unsorted data, before realizing of this sentence in the example provided:
As my unsorted plot looks OK, I guess that "must" was just a statement of the intended layout for that example (not mandatory for squarify to work properly).
As for my plot layout, I am guessing too that squarify will always create boxes in the provided order, from lower left corner upwards, and them from left to right. Correct? Or may squarify sometimes change that order to achieve the best fit of boxes?
It is interesting to know if our provided order permits to control layout of consecutively generated graphs, with slight differences in values, in order to later generate a nice-looking animated graphs. This example (historic population comparisons between countries ) illustrates what I mean:
Taken from https://wilkox.org/treemapify/#animated-treemaps