set x and y range of plotly heatmap

James Dalgleish

Plotly.js: Initial Zoom

Similar to the above question, is there a way to set the zoom for plotly heatmap produced with geom_tile() and ggplotly(). Say for instance, I wanted an x range of 5:10 and a y range of 20:30, how would I get a zoomed heatmap of that region? The whole goal of this is to zip quickly to important points of the heatmap in a large dataset in a shiny framework. Here's some example code of a basic plotly heatmap:

p <- t(volcano) %>%
melt() %>% 
ggplot(aes(x=Var2, y=Var1)) + geom_tile(aes(fill=value))
ggplotly(p)

reference: https://stackoverflow.com/questions/36437879/unexpected-output-using-plotly-and-geom-tile?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa).
DevMui

plotly bascially takes options through layout. This page might be helpful https://plot.ly/r/axes/#manual-ranges

ggplotly(p, dynamicTicks = T) %>%
   layout(xaxis=list(autorange=F, range=c(5,10)), yaxis=list(autorange=F, range=c(20,30)))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related