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

problem in customized ticks in go.Surface #2158

Closed
aligoglos opened this issue Feb 4, 2020 · 2 comments
Closed

problem in customized ticks in go.Surface #2158

aligoglos opened this issue Feb 4, 2020 · 2 comments

Comments

@aligoglos
Copy link

I want to customize x and y labels, I tried this but haven't worked!

fig = go.Figure(data=[go.Surface(z=z_vals)])
    print(list(lable1))
    print(list(lable2))
    fig.update_layout(scene=dict(
        xaxis=dict(
            nticks = 12,
            ticktext=list(lable1)),
        yaxis=dict(
            nticks=12,
            ticktext=list(lable2)),
    ))
    fig.show()

print results:

['1398/01', '1398/02', '1398/03', '1398/04', '1398/05', '1398/06', '1398/07', '1398/08', '1398/09', '1398/10', '1398/11', '1398/12']

['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']

but always show :
image

@empet
Copy link

empet commented Feb 4, 2020

To set custom ticklabels it's not sufficient to give a list of strings, for ticktext. You have to set tickvals as a list/array of numerical values, with len(tickvals)=len(ticktext). At these numerical values on axis will be located the strings in ticktext.

If your surface is defined only by an array, z, of shape (m,n), then, besides ticktext you should define
tickvals = np,arange(12) .

@aligoglos
Copy link
Author

Thanks a lot.

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