Plot 3d rectangle / flag

Hi,

I want to display a flag (rectangle).

app = Dash(__name__)

# coordinates of the flag
flag_x = [256, 296]
flag_y = [256, 260]
flag_z = [20, 50]

flag = go.Figure(data=go.Mesh3d(
    x=flag_x,
    y=flag_y,
    z=flag_z,
    alphahull=5
))

app.layout = html.Div(children=[
    dcc.Graph(
        id='green',
        figure=flag,
        style={'width': '100vh', 'height': '100vh'}
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

When I inspect the output, there is nothing plotted. What am I doing wrong?

hi @HJA
The data is incorrect for the mesh3d. If you take a different example from the Plotly documentation, it works:

import pandas as pd
import plotly.express as px
from dash import Dash, html, dcc
import plotly.graph_objects as go
import numpy as np

app = Dash(__name__)

# coordinates of the flag
# flag_x = [256, 296]
# flag_y = [256, 260]
# flag_z = [20, 50]
#
# flag = go.Figure(data=go.Mesh3d(
#     x=flag_x,
#     y=flag_y,
#     z=flag_z,
#     alphahull=5
# ))
# flag.show()
# exit()

pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt'))
x, y, z = pts.T

flag = go.Figure(data=[go.Mesh3d(x=x, y=y, z=z, color='lightpink', opacity=0.50)])



app.layout = html.Div(children=[
    dcc.Graph(
        id='green',
        figure=flag,
        style={'width': '100vh', 'height': '100vh'}
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)