Comments (10)
Hi @Tomer-Tsaban this is not currently readily configurable with iheatmapr, unfortunately. However, there is a hacky back-door approach you can use to get this effect:
# q is the heatmap object created above
# first convert it to an htmlwidgets object proper (this is normally done during the print process)
q_widget <- to_widget(q)
# Edit the htmlwidget object itself
q_widget$x$config$modeBarButtonsToRemove <- list(
'sendDataToCloud',
'toImage',
'autoScale2d',
'resetScale2d',
'hoverClosestCartesian',
'hoverCompareCartesian'
)
# you should be able to display the heatmap using q_widget similarly to how you would q.
Having a modify_config
function to enable this customization directly seems like a good feature to add though going forward.
from iheatmapr.
NiuBi!
from iheatmapr.
Re the 2nd question -- I don't know. I am not aware of a way to do that.
from iheatmapr.
Hi Alicia, thanks for your answer!
I tried to implement what you suggested (exactly your code) and for some reason I get this error:
ERROR: unable to find an inherited method for function ‘to_widget’ for signature ‘"iheatmapr"
are you familiar with this?
from iheatmapr.
Try iheatmapr::to_widget
-- maybe another package is loaded that also has to_widget method that is shadowing iheatmapr's.
from iheatmapr.
Hi, thanks for your quick responses!
I tried again and figured out that the problem is with shiny package.
I use iheatmapr in a shiny app, and this is how the error was received. sorry for foolishly not stating that out previously.
anyhow, when trying the to_widget function in a non-shiny context, it works smoothly.
however when trying to embed in shiny, this error comes up again. here's a simple reproducible example with the measles data:
`
data(measles, package = "iheatmapr")
ui<-fluidPage(
iheatmaprOutput("output_q_widget")
)
server<-function(session,input,output){
q<-main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
layout = list(font = list(size = 8))) %>%
add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"),
side = "bottom", name = "Vaccine<br>Introduced?",
title = "Vaccine?",
colors = c("lightgray","blue")) %>%
add_col_labels(ticktext = seq(1930,2000,10),font = list(size = 8)) %>%
add_row_labels(size = 0.3,font = list(size = 6)) %>%
add_col_summary(layout = list(title = "Average<br>across<br>states"),
yname = "summary") %>%
add_col_title("Measles Cases from 1930 to 2001", side= "top") %>%
add_row_summary(groups = TRUE,
type = "bar",
layout = list(title = "Average<br>per<br>year",
font = list(size = 8)))
q_widget <- to_widget(q)
# Edit the htmlwidget object itself
q_widget$x$config$modeBarButtonsToRemove <- list(
'sendDataToCloud',
'toImage',
'autoScale2d',
'resetScale2d',
'hoverClosestCartesian',
'hoverCompareCartesian'
)
#q_widget
output$output_q_widget<-renderIheatmap({
q_widget
})
}
shinyApp(ui,server)
`
Thanks, and again sorry for lacking this information in my previous question.
EDIT: also, for some reason github won't accept the whole code snippet as code-text... sorry.
from iheatmapr.
Thanks for additional details... the issue is that renderIheatmap will call 'to_widget' but with the above approach that has already been done. As another temporary workaround, you could define
renderIheatmap2 <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
htmlwidgets::shinyRenderWidget(expr, iheatmaprOutput, env, quoted = TRUE)
}
and use that instead of renderIheatmap (basically an edit of that function that removes the call to 'to_widget')
Will be much better to add ability to edit config directly to the package, but in meantime hope that unblocks whatever app you are working on.
from iheatmapr.
This works beautifully!
thanks alot
from iheatmapr.
@AliciaSchep May I had a question to your suggestion ?
I succesfully removed logo using the strategy you suggested:
heatmapPlot_widget <- iheatmapr::to_widget(heatmapPlot);
heatmapPlot_widget[["x"]][["config"]][["displaylogo"]] = FALSE;
heatmapPlot_widget[["x"]][["config"]][["toImageButtonOptions"]] = list( format='svg');
But the 'svg' output does not seem to work.
Is the plotly version embedded in iHeatmapr too old to include this option ?
Thank you.
from iheatmapr.
Another vote for allowing a custom config.
This issue is currently unresolvable (even with the hacky way) in shiny apps because of #71 which was mentioned by @Tomer-Tsaban
from iheatmapr.
Related Issues (20)
- textangle messes-up the row or column labels HOT 1
- layout of colorbars of annotations
- Reverse dependency checks fail with `ggdendro` HOT 5
- Adding empty annotation causes an error HOT 2
- Single row heatmap does not show HOT 2
- Column annotation label disappeared HOT 10
- Scale the main_heatmap
- Add extra markings to specific cells
- Bug: error causes heatmap to disappear if it tries to re-plot after a plotly plot is rendered HOT 1
- iheatmapr in shiny is not responsive HOT 1
- renderIheatmap breaks when used with shiny::req HOT 3
- Using multiple colors for axis ticks HOT 2
- Add animation/slider function
- Decorate heatmap body
- [FEATURE REQUEST] Use with Chart studio HOT 1
- How to change the row order of the heatmap from Alabama to Wyoming ? [Question] HOT 4
- Buffer and size dendrogram argument to add_*_clustering
- iheatmapr doesn't work when on the same HTML page as a standard plotly widget HOT 1
- Resize width and height of html file using saveWidget or save_iheatmap
- CRAN deprecation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iheatmapr.