user10316615
user10316615

Reputation:

Make X axis wider and Y axis narrower in plotly

I am trying to make the x axis of a surface plot wider (more space between each points in x) and y axis narrower (less space between points in y). Here is an example data

kd <- with(MASS::geyser, MASS::kde2d(duration, waiting, n = 50))
p <- plot_ly(x = kd$x, y = kd$y, z = kd$z) %>% add_surface()

I couldn't find a param that does this. I came across width param and tried the following, but didn't help

plot_ly(x = kd$x, y = kd$y, z = kd$z) %>% add_surface() %>% layout(title="test data",width=1000)

Upvotes: 0

Views: 1216

Answers (2)

user9787263
user9787263

Reputation:

You could make the x axis wider using aspectratio

plot_ly(x = kd$x, y = kd$y, z = kd$z) %>% add_surface() %>% layout(scene = list(aspectmode="manual",aspectratio = list( x = 2, y = .5, z = 1)))

Upvotes: 1

Dmitriy Kisil
Dmitriy Kisil

Reputation: 2998

You can make yaxis or xaxis more bigger or smaller using domain parameter. Such here.

Upvotes: 0

Related Questions