wilkox / treemapify

🌳 Draw treemaps in ggplot2
http://wilkox.org/treemapify
213 stars 18 forks source link

Can the tile placement proceeds from other directions? #30

Closed Yuanchao-Xu closed 6 years ago

Yuanchao-Xu commented 6 years ago

Hi David,

In your description, it's said

placement proceeds from the bottom left corner, filling alternately rightwards then upwards until all tiles are placed.

I was wondering is there other direction for the placement, e.g., from top left?

Thanks

wilkox commented 6 years ago

Hi Yuanchao. It's not currently possible to control the starting position and direction of tile placement, but it wouldn't be hard to add this feature. Can I ask in what sort of situation you would want to change these parameters? Would you want the parameters to apply to the whole treemap, or to be able to control them independently for different subgroups?

Yuanchao-Xu commented 6 years ago

Hi David,

Thanks, If possible, my case is from top left then filling alternately downward then rightward. For subgroups, it'll be perfect if subgroups follow the same rule. \

wilkox commented 6 years ago

Sorry if my question wasn't clear. What I'm trying to understand is: in what situation is column-first tile placement and starting from the top left corner better than the current default? Is it an aesthetic choice or is there a practical reason to prefer this layout?

Yuanchao-Xu commented 6 years ago

Oh I didn't get your question before. There isn't a specific reason, just other treemap softwares put it like that, e.g., treemap, tableau and power BI, and it looks natural and in accordance with people's reading habit.

wilkox commented 6 years ago

Thanks Yuanchao. I’m going to add arguments to let you specify the starting corner and row-first vs column-first placement. I’ll update this issue when the feature is released.

wilkox commented 6 years ago

The latest development version v2.5.0.9004 adds a start argument to all the geoms that lets you specify the starting corner (bottomleft, topleft, topright or bottomright), and a layout argument that lets you choose a row-first (srow) or column-first (scol) squarified layout. You can install the development version with devtools::install_github("wilkox/treemapify"). Does this solve your issue?

Yuanchao-Xu commented 6 years ago

Thanks David! I've just tried that, that's perfect!