Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidated PR; v0.8.3 #86

Merged
merged 63 commits into from
May 15, 2021
Merged

Consolidated PR; v0.8.3 #86

merged 63 commits into from
May 15, 2021

Conversation

klaukh
Copy link
Contributor

@klaukh klaukh commented Mar 3, 2018

Consolidated PR: Issues and PRs incorporated

BIG hat tips to @mkuhn, @pooranis, @alanocallaghan, @garthtarr, @xtmwang, and @botanize (and others I'm neglecting... sincere apologies) for examples and inspiration on the various implementations. All mistakes are mine and not anyone else (until the community gets their hands on this, of course!)

Info

Version 0.8.3 of d3heatmap. Version increments where on my own as I was using my fork and modifications of this package elsewhere. Final merged version should please be >= 0.8.3 to coincide with imports and suggests in dependent packages I have.

Note

Once all needed tweaks to this PR are resolved and the PR is ready to merge, I'll process an updated README and commit for inclusion just prior to merging.

Issues to close:

#10 - Question: how to reproduce "Mike Bostock's Les Misérables Co-occurrence": can be done via Shiny with a dropdown
#19 - Square blocks: heatmap sizing can take care of that
#26 - Display issues with heatmap generated: can be addressed by sizing or turning off the grid
#42 - symm = TRUE seems working incorrectly: code looks to cover and no reproduceable example given
#55 - Regarding visualization of more than 6000 rows using d3heatmap: can be addressed by sizing or turning off the grid

Resolved Issues:

#17 - Add an option to add a heatmap legend: as discussed in #50.
#24 - Tooltip shows original values, but colors are scaled: as noted in the issue, this is the cellnote_scale argument.
#38 - Plotting NA values: can be specified by value and color, using na.value and na.color.
#40 - Add main title and axes labels: added as main, labRow, and labCol.
#43 - tooltip mislabeled when zoom in [Firefox]: same as #63.
#45 - Add side color panel to indicate groups: adds RowSideColors and ColSideColors, with automatic and palettized color options. Also adds legend and tooltip capabilities conditional on names and label information being provided alongside the sidecolors. This was a well-documented fixed across several forks and branches.
#46 - horizontal axis tick rotation options: adds the parameter, srtCol.
#50 - Color key and density info legend: adds the legend and density info with two options: histogram and none.
#52 - cexCol and cexRow seem inversed: corrects for this issue; fairly straightforward fix.
#53 - RowSideColors and ColSideColors gives black on invalid color (also alpha): corrects for alpha inclusion causing black colors in RowSideColors and ColSideColors.
#63 - Wrong mouseover information shown when zoomed: a well documented issue, especially with Firefox. Corrects for this
#71 - Change name of column and row in the tooltip: includes cellnote_row, cellnote_col, and cellnote_val to allow for customization of tooltip
#74 - Print Cell Labels in Heatmap: includes print.values = TRUE argument.
#77 - d3heatmap does not render in flexdashboard when scatterD3 also used: changed all d3 to d3v3 to preempt conflicts with d3v4.
#81 - specify that zero values get neutral color in diverging data: symbreaks = TRUE argument available.
#83 - x must be numeric probelm in d3heatmap shiny: filters non-numeric columns at initial d3heatmap call, from either data.frame or matrix.
#84 - Consolidated PR and CRAN update (sister issue to this PR): CRAN check successful and devtools spellcheck processed and remedied.

PRs

#21 - typo: corrected in some commit long ago.
#31 - Implement ColSideColors/RowSideColors: implemented as in the PR, with some modification.
#35 - minVal and maxVal options: implemented as in the PR, with some modification.
#58 - Add optional parameters: fix the range of the input data, NA color: implemented as in the PR, with some modification.
#68 - Fix self.getId error: implemented as in the PR.
#72 - Added axis positioning options and title: implemented as in the PR, with some modification.
#75 - Replace ordinal scales with linear scales: implemented as in the PR.

New features

API

Inspired by dygraphs and able to leverage magrittr, the new API provides a second method for invoking d3heatmap and integrating with Shiny apps, modules, and gadgets! Examples:

library(d3heatmap)
library(magrittr)

d3heatmap(mtcars, dendrogram = 'none', key = TRUE, col = 'RdYlGn',
          scale = 'column', key.title = "Legend", print.values = T,
          notecol = 'white') %>% 
  hmAxis("x", title = "test", location = 'bottom') %>% 
  hmAxis("y", title = "test", location = 'left') %>% 
  hmCells(font.size = 8, color = 'blue') %>% 
  hmLegend(show = T, title = "Title", location = "tl")

Gadget

An shiny gadget coupled with an S4 class that has print() and save() methods. Gadget takes normal d3heatmap inputs and allows for interactive adjustment of the heatmap. Gadget allows for filtering rows and columns, and also a dynamic filter to interactively subset the entire underlying data set. Saving the gadget to an object generates the S4 class that contains the heatmap, data, filter, and settings. Passing the gadget back into the function d3heatmapGadget(gadget) starts the user at the last state of the gadget.

gadget <- d3heatmapGadget(mtcars, col = 'blues')
	print(gadget)
	save(gadget, file = "heatmap.html")
gadget <- d3heatmapGadget(gadget)

Note: this PR was edited for grammar and spelling

@alanocallaghan
Copy link

Great to see, thanks for this @klaukh! I did some work on my fork recently, though from the sounds of it this PR might already contain most of it

@klaukh
Copy link
Contributor Author

klaukh commented Mar 4, 2018

@alanocallaghan, thanks! And double thanks for the work you did on your fork, as much of it directly influenced stuff in this PR. If you see additional things that can be tweaked or added, feel free to offer some code snippets here or even an issue or PR over in my fork and work to I'll incorporate.

@pooranis
Copy link

pooranis commented Mar 4, 2018

@klaukh Great updates. Thanks for the mention! And thanks for writing this package. Back when I made those commits, I knew very little js and nothing about d3. I learned a lot reading your code.

@klaukh
Copy link
Contributor Author

klaukh commented Mar 4, 2018

Thanks, but only the bad stuff is mine... the good code is undoubtedly something I got from someone else. Please let me know if something needs to be tweaked.

@vyster
Copy link

vyster commented Jul 7, 2019

Hello, I need to make https://bost.ocks.org/mike/miserables/ this from the co-occurrence matrix I have generated., Can you help??

@vyster
Copy link

vyster commented Jul 7, 2019

Hello, I need to make https://bost.ocks.org/mike/miserables/ this from the co-occurrence matrix I have generated., Can you help??
https://drive.google.com/file/d/1c275QvW7XjY5llhBvExSn_XWgK5w7o2R/view?usp=sharing

@talgalili
Copy link
Owner

Hey @klaukh :)
I've now take ownership over the repo from Joe and RStudio.
I see you've put a lot of work here (~3 years ago, but still).

Do you think I should merge it as is? Do you want to add more features/changes before I do so?

Do you know if there are other PR I should include/omit, given this PR?

Thanks,
T

@klaukh
Copy link
Contributor Author

klaukh commented Mar 3, 2021

@talgalili As you can probably infer I haven't looked at this in years. I recommend you proceed as you see fit

@talgalili
Copy link
Owner

talgalili commented Mar 4, 2021 via email

@talgalili talgalili merged commit 64ac004 into talgalili:master May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants