vifactor / repostat

Inspired by gitstats project: git repository desktop analyzer
GNU General Public License v3.0
106 stars 13 forks source link

Use a better colormap for heatmap tables #91

Closed pulkomandy closed 4 years ago

pulkomandy commented 4 years ago

The tables used a dark red to bright red scale, which is not very readable and also doesn't look nice. Instead use the "viridis" colormap which was designed for matplotlib at https://bids.github.io/colormap/ (python file imported with changes since we don't want to use matplotlib).

pulkomandy commented 4 years ago

Sample rendering: http://pulkomandy.tk/repostat-test/activity.html

vifactor commented 4 years ago

The sample link you have provided still uses the current repostat's red-color rendering. I agree that it does not perhaps look nice, but I wonder if it will be much nicer with "viridis" colormap. The variability of data in the corresponding tables of the analyzed repository is not very high, so you will anyway see mainly one color. Moreover, black numbers with violet background are almost not readable: image

pulkomandy commented 4 years ago

Yes, maybe it's a bit too dark. Maybe "plasma" would work better? It's also available in the file and the lower shade is not as dark. Or maybe we can create something of our own.

Using the colors non-linearly is also an option.

As for the variability, the color range is scaled from 0 to 255 (corresponding to 0-max number of commits for the repository), so you always see all colors. Depending on the repository you may have lots of empty slots, or you may have more spread out activity. That was already the case with the previous colors.

pulkomandy commented 4 years ago

classic for reference: http://pulkomandy.tk/repostat-test/activity-classic.html clrs.cc: http://pulkomandy.tk/repostat-test/activity-clrscc.html plasma: http://pulkomandy.tk/repostat-test/activity-plasma.html

I think plasma gives quite good results. The darkest color is not much darker than before and the spots with higher activity are much better visible now.

vifactor commented 4 years ago

I like some of the colormaps you have used, but this is the matter of taste and there will always be people who won't be satisfied with what we choose now. We must find a way to give user a possibility to configure coloring of those tables. If you do not mind, I'll keep this PR pending till I (or you) figure out how to make that happen.

pulkomandy commented 4 years ago

Yes, that's fine. Maybe other people can give their input then (both on what would be a good default choice, and how to make this easily customizable)

pulkomandy commented 4 years ago

I have added an option to the config file to pick a colorscheme. Default is the traditional red shades. Currently the branch is based before the 2.x changes because I don't know how safe these are to use at the moment.

vifactor commented 4 years ago

PR looks good. Should be safe to rebase on head of master.

I would also appreciate a paragraph about this feature in README.md

pulkomandy commented 4 years ago

I added documentation about the settings file to the README (to the best of my knowledge).

vifactor commented 4 years ago

There is a weird problem with OSX, but it is unrelated to the changes in this PR.