Giter Club home page Giter Club logo

treemap's Introduction

๐Ÿฌ Pretty Treemaps

Looking to run this for Go coverage? Check https://github.com/nikolaydubina/go-cover-treemap

Go Reference codecov Go Report Card OpenSSF Scorecard

Uses "Squarified Treemaps" (Mark Bruls, Kees Huizing, and Jarke J. van Wijk., 2000) algorithm.

$ go install github.com/nikolaydubina/treemap/cmd/treemap@latest 
$ echo '
Africa/Algeria,33333216,72
Africa/Angola,12420476,42
Africa/Benin,8078314,56
...
' | treemap > out.svg

example

Adjusting size

$ ... | treemap -w 1080 -h 360 > out.svg

example-narrow

$ ... | treemap -w 1080 -h 1080 > out.svg

example-square

Imputing heat

$ ... | treemap -impute-heat > out.svg

example-narrow

Different colorscheme

$ ... | treemap -color RdYlGn > out.svg

example-RdYlGn

Tree-Hue coloring when there is no heat

$ ... | treemap -color balanced > out.svg

example-balanced

Without color

$ ... | treemap -color none > out.svg

example-no-color

Format

Size and heat is optional.

</ delimitered path>,<size>,<heat>

Algorithms

  • Squarified algorithm for treemap layout problem. This is very common algorithm used in Plotly and most of visualization packages. "Squarified Treemaps", Mark Bruls, Kees Huizing, and Jarke J. van Wijk, 2000
  • Tree-Hue Color algorithm for generating colors for nodes in treemap. The idea is to represent hierarchical structure by recursively painting similar hue to subtrees. Nikolay Dubina, 2021

Contributions

Welcomed!

References

Appendix A: Long Roots

When roots have one child multiple times it takes extra vertical space, which is very useful for narrow final dimensions.

example-long-roots

Can collapse them into one node example-long-roots-collapse

Long roots without collapsing somewhere deep inside

Long roots with collapsing somewhere deep inside

Appendix B: Less Illustrative Examples

Large dimensions and large tree (e.g. github.com/golang/go)

$ ... | treemap -w 4096 -h 4096 > out.svg

example-large

treemap's People

Contributors

mlange-42 avatar nikolaydubina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

treemap's Issues

Can't use slash or comma in names

Slashes and commas are reserved as path and column delimiters, respectively. This prevents their use in names (path parts). Or rather, it leads to unexpected results.

My particular use case is in dirstat again, where I would like to use a trailing slash to denote directories.

I see two options to solve this:

  • Configurable column and path delimiters
  • Using HTLM entities, like &sol; for these characters
    • Comes with some problems:
      • Would not work well with string length calculations for box titles
        • Could use regex or a dedicated XML/HTML encoding/decoding library to fix this
      • & is currently replaced by &amp; to form valid XML/SVG
        • Would require to take care of HTML entities in & replacement

Zoomable

Are there any plans to make this zoomable?

Default heat colors counterintuitive

Currently, the default heat coloring ranges from red to blue for low to high heat values.

Given the term "heat", I would expect the opposite.

Here is an example from dirstat, which uses log(#files) for coloring:

grafik

Escape illegal XML characters

Some characters that are illegal in XML strings break SVG rendering. These characters should be escaped.

Encountered the issue in my little Go learning project dirstat, which uses treemap to visualize disk usage. File and directory names may contain such characters.

Looks like the relevant characters are only those:

  • " &quot;
  • ' &apos;
  • < &lt;
  • > &gt;
  • & &amp;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.