Skip to content

Commit

Permalink
Updated aspect ratio mode for plotly engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
SridharJagannathan committed Sep 19, 2019
1 parent 04ff657 commit 0797a48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 2 additions & 6 deletions R/hxsurf.R
Expand Up @@ -290,13 +290,9 @@ plot3d.hxsurf<-function(x, plotengine = getOption('nat.plotengine'),
if (plotengine == 'rgl'){
invisible(rlist)
} else {
maxrange <- ceiling(max(tmpx$vb)/10)*10
minrange <- floor(min(tmpx$vb)/10)*10
psh <- psh %>%
plotly::layout(showlegend = FALSE, scene=list(xaxis = list(range = c(minrange,maxrange)),
yaxis = list(range = c(minrange,maxrange)),
zaxis = list(range = c(minrange,maxrange)),
camera=.plotly3d$camera))
plotly::layout(showlegend = FALSE,
scene=list(camera=.plotly3d$camera))
assign("plotlyscenehandle", psh, envir=.plotly3d)
psh
}
Expand Down
3 changes: 2 additions & 1 deletion R/neuron-plot.R
Expand Up @@ -605,7 +605,8 @@ nclear3d <- function(plotengine = getOption('nat.plotengine'), ...) {

openplotlyscene <- function(){
if (!exists("plotlyscenehandle", envir = .plotly3d))
.plotly3d$plotlyscenehandle = plotly::plot_ly()
.plotly3d$plotlyscenehandle = plotly::plot_ly() %>%
plotly::layout(scene=list(aspectmode='data'))
plotlyreturnlist = list()
plotlyreturnlist$plotlyscenehandle = .plotly3d$plotlyscenehandle
return(invisible(plotlyreturnlist))
Expand Down

0 comments on commit 0797a48

Please sign in to comment.