Elliothuo
Elliothuo

Reputation: 79

PlotlyJS in Julia : xaxis setting

I want to draw some points in a three-dimensional coordinate system, and make some adjustments to the range displayed by the x, y, and z axes.

For example, the range of the x-axis is set to -1~8 (but the x-coordinate range of the plotted point is only 1~2), I tried the following code but it didn't work:

node_date = DataFrame(A = node_x,B = node_y,C = node_z)
data = scatter3d(node_date,x =:A,y =:B,z = :C,mode="markers")
layout = Layout(xaxis_range=[-1, 8])
plot(data,layout)

If the above code is changed to a two-dimensional figure, it is effective. How should I modify the program now?

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = "C:\Users\huoze\AppData\Local\atom\app-1.38.0-beta0\atom.exe"  -a
  JULIA_NUM_THREADS = 2

Upvotes: 0

Views: 690

Answers (1)

hckr
hckr

Reputation: 5583

Try modifying scene's xaxis instead of xaxis_range in Layout with attr.

Instead of

layout = Layout(xaxis_range=[-1, 8])

use

layout = Layout(;scene=attr(;xaxis=attr(;range=[-1, 8])))

Inspiration: https://plot.ly/javascript/3d-axes/

Upvotes: 1

Related Questions