plotlyaxisshowedgesisosurface

How to show all the edges of a cubic region in plotly?


In the figure about isosurface, only 6 edges of the cube are shown, where mirror='allticks' is used. And how to show the other 6 edges?

the figure about isosurface

My code is given as:

import plotly.graph_objects as go

fig = go.Figure(data=go.Isosurface(
               x=[0, 0, 0, 0, 1, 1, 1, 1],
               y=[1, 0, 1, 0, 1, 0, 1, 0],
               z=[1, 1, 0, 0, 1, 1, 0, 0],
               value=[1, 0, 1, 0, 2, -2, 3, 6],
               surface=dict(count=50, fill=1.0),
               isomin=2.0,
               isomax=9.0))

config = dict(showline=True,
             linecolor='black',
             showbackground=False,
             range=[-0.0, 1.0],
             tickcolor='black',
             mirror='allticks',
             ticks='outside')

fig.update_layout(scene=dict(
                 xaxis=config,
                 yaxis=config,
                 zaxis=config,
                 xaxis_title_text='x',
                 yaxis_title_text='y',
                 zaxis_title_text='z'),
                 width=900 )

fig.show()


Solution

  • I have added the following codes to show all the edges of the cube.

    fig.add_trace(go.Scatter3d(
      x=[1, 1, 0],
      y=[0, 1, 1],
      z=[1, 1, 1],
      mode='lines',
      line=dict(color='black', width=2, dash='solid'),
      showlegend=False
    ))
    fig.add_trace(go.Scatter3d(
      x=[1, 0, 0],
      y=[0, 0, 1],
      z=[0, 0, 0],
      mode='lines',
      line=dict(color='black', width=2, dash='solid'),
      showlegend=False
    ))
    fig.add_trace(go.Scatter3d(
      x=[1, 1],
      y=[1, 1],
      z=[0, 1],
      mode='lines',
      line=dict(color='black', width=2, dash='solid'),
      showlegend=False
    ))
    fig.add_trace(go.Scatter3d(
      x=[0, 0],
      y=[0, 0],
      z=[0, 1],
      mode='lines',
      line=dict(color='black', width=2, dash='solid'),
      showlegend=False
    ))