plotly: изменение меток на оси z
Нужно на plotly сделать график, сделал все работает. Однако смущает оси, особенно z хотелось бы чтоб цифры шли нормально от 1 до 11. А не как сейчас от 0 до 10 с промежутком в 2. Как это сделать?
from dash import Dash, dcc, html, Input, Output
import plotly.graph_objects as go
import numpy as np
app = Dash(__name__)
app.layout = html.Div([
html.H4('Interactive plot with custom data source'),
dcc.Graph(id="renderers-x-graph"),
html.P("Number of bars:"),
dcc.Slider(id="renderers-x-slider", min=2, max=10, value=4, step=1),
])
@app.callback(
Output("renderers-x-graph", "figure"),
Input("renderers-x-slider", "value"))
def update_bar_chart(size):
fig = go.Figure(go.Surface(
contours = {
"x": {"show": True, "start": 1.5, "end": 2, "size": 0.04, "color":"white"},
"z": {"show": True, "start": 0, "end": 0.5, "size": 0.05, "color":"#FF0000"}
},
x = [1,2,3,4,5],
y = [1,2,3,4,5],
z = [
[0, 2, 0, 5, 0],
[1, 0, 1, 0, 1],
[0, 1, 0, 1, 0],
[1, 0, 10, 0, 1],
[0, 1, 0, 1, 0]
]))
return fig
if __name__ == "__main__":
app.run_server(debug=True)
Источник: Stack Overflow на русском