Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axis attributes do not work for scatter3d #287

Closed
xiuliren opened this issue Jul 18, 2019 · 2 comments
Closed

axis attributes do not work for scatter3d #287

xiuliren opened this issue Jul 18, 2019 · 2 comments

Comments

@xiuliren
Copy link

Describe the bug
I can not specify axis attributes in scatter3d. It works in 2D scatter.

You can reproduce this with the following code:

using PlotlyJS
function errorbars1()
    trace1 = PlotlyJS.scatter3d(;x=vcat(1:10, 10:-1:1),
                     y=vcat(2:11, 9:-1:0),z=vcat(2:11, 9:-1:0),
                     fill="tozerox",
                     fillcolor="rgba(0, 100, 80, 0.2)",
                     line_color="transparent",
                     name="Fair",
                     showlegend=false)

    
    data = [trace1]
    layout = Layout(;paper_bgcolor="rgb(255, 255, 255)",
                    plot_bgcolor="rgb(229, 229, 229)",
                    showticklabels=false,
                    xaxis=attr(gridcolor="rgb(255, 255, 255)",
                               range=[1, 10],
                               showgrid=true,
                               showline=false,
                               showticklabels=false,
                               tickcolor="rgb(127, 127, 127)",
                               ticks="outside",
                               zeroline=false),

                    yaxis=attr(gridcolor="rgb(255, 255, 255)",
                               showgrid=false,
                               showline=false,
                               showticklabels=false,
                               tickcolor="rgb(127, 127, 127)",
                               ticks="outside",
                               zeroline=false),
                    zaxis=attr(gridcolor="rgb(255, 255, 255)",
                               showgrid=false,
                               showline=false,
                               showticklabels=false,
                               tickcolor="rgb(127, 127, 127)",
                               ticks="outside",
                               zeroline=false)
    )

    PlotlyJS.plot(data, layout)
end
errorbars1()

Please provide the following:

  1. output of julia command versioninfo()
Julia Version 1.0.4
Commit 38e9fb7f80 (2019-05-16 03:38 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)
Environment:
  JULIA_NUM_THREADS = 32
  1. Output running the following in Julia 0.7 or greater: using Pkg; pkg"status" (if you are on Julia 0.6 or earlier run Pkg.status())
Status `~/.julia/environments/v1.0/Project.toml`
  [c7e460c6] ArgParse v0.6.2
  [c2a8506f] BigArrays v0.8.0+ [`~/.julia/dev/BigArrays`]
  [ad839575] Blink v0.10.1
  [336ed68f] CSV v0.5.9
  [aaaa29a8] Clustering v0.13.2
  [35d6a980] ColorSchemes v3.3.0
  [5ae59095] Colors v0.9.5
  [a93c6f00] DataFrames v0.19.0
  [864edb3b] DataStructures v0.17.0
  [7806a523] DecisionTree v0.8.3
  [5789e2e9] FileIO v1.0.7
  [4d00f742] GeometryTypes v0.7.5
  [aa1b3936] GraphIO v0.4.0
  [f67ccb44] HDF5 v0.12.0
  [7073ff75] IJulia v1.18.1
  [4138dd39] JLD v0.9.1
  [033835bb] JLD2 v0.1.2
  [682c06a0] JSON v0.20.0
  [2b0e0bc5] LanguageServer v0.6.0-DEV #master (https://github.com/julia-vscode/LanguageServer.jl.git)
  [093fc24a] LightGraphs v1.2.0
  [7269a6da] MeshIO v0.3.1
  [626554b9] MetaGraphs v0.6.1
  [6f286f6a] MultivariateStats v0.6.0
  [47be7bcc] ORCA v0.2.1
  [f0f68f2c] PlotlyJS v0.12.5
  [91a5bcdd] Plots v0.26.0
  [92933f4c] ProgressMeter v1.0.0
  [d330b81b] PyPlot v2.8.1
  [1a8c2f83] Query v0.12.0
  [4491297b] RealNeuralNetworks v0.8.0+ [`~/.julia/dev/RealNeuralNetworks`]
  [ae029012] Requires v0.5.2
  [295af30f] Revise v2.1.6
  [3646fa90] ScikitLearn v0.5.0
  [2913bbd2] StatsBase v0.31.0
@sglyon
Copy link
Member

sglyon commented Jul 18, 2019

Hmm, I cannot get any data to show when I run your example, but I believe I might still know the problem.

In the Plotly.js api you need to specify axis attributes for 3d plots in inside layout.scene.(x|y|z)axis instead of layout.(x|y|z)axis.

So, I think this example should be written :

using PlotlyJS
function errorbars1()
    trace1 = PlotlyJS.scatter3d(;x=vcat(1:10, 10:-1:1),
                     y=vcat(2:11, 9:-1:0),z=vcat(2:11, 9:-1:0),
                     fill="tozerox",
                     fillcolor="rgba(0, 100, 80, 0.2)",
                     line_color="transparent",
                     name="Fair",
                     showlegend=false)

    
    data = [trace1]
    layout = Layout(;paper_bgcolor="rgb(255, 255, 255)",
        plot_bgcolor="rgb(229, 229, 229)",
        showticklabels=false,
        scene=attr(
            xaxis=attr(
                gridcolor="rgb(255, 255, 255)",
                range=[1, 10],
                showgrid=true,
                showline=false,
                showticklabels=false,
                tickcolor="rgb(127, 127, 127)",
                ticks="outside",
                zeroline=false
            ),
            yaxis=attr(
                gridcolor="rgb(255, 255, 255)",
                showgrid=false,
                showline=false,
                showticklabels=false,
                tickcolor="rgb(127, 127, 127)",
                ticks="outside",
                zeroline=false
            ),
            zaxis=attr(
                gridcolor="rgb(255, 255, 255)",
                showgrid=false,
                showline=false,
                showticklabels=false,
                tickcolor="rgb(127, 127, 127)",
                ticks="outside",
                zeroline=false
            )
        )
    )

    PlotlyJS.plot(data, layout)
end
errorbars1()

@xiuliren
Copy link
Author

thanks!
Your solution works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants