Spherical "wedges" with Volume plot?

HI @danc try this. The solution might not work for every combination of theta, phi and radius ranges, I did not test it fully. Also you might increase the number of points for the np.linspace of theta and phi for a better resolution but be aware of possible browser freeze if increasing too drastically. Also, try investigating how to calculate the triangulation better instead of using alphahull=1, for example here

import plotly.graph_objs as go
import numpy as np

# Define the parameters for the partial sphere
radius_min = 0.8  
radius_max = 1.0  
theta_min = np.pi / 4  
theta_max = np.pi / 2/4  
phi_min = np.pi / 4  
phi_max = np.pi / 2/4  

# Create a grid of points in spherical coordinates within the specified ranges
radius = np.linspace(radius_min, radius_max, 2)
theta = np.linspace(theta_min, theta_max, 5)
phi = np.linspace(phi_min, phi_max, 5)
radius, theta, phi = np.meshgrid(radius, theta, phi)

# Convert spherical coordinates to Cartesian coordinates
x = radius * np.sin(theta) * np.cos(phi)
y = radius * np.sin(theta) * np.sin(phi)
z = radius * np.cos(theta)

# Create a 3D Mesh plot
mesh = go.Mesh3d(
    x=x.flatten(),
    y=y.flatten(),
    z=z.flatten(),
    alphahull=1,
    flatshading=True
)

# Create the layout for the 3D plot
layout = go.Layout(
    scene=dict(
        xaxis_title='X',
        yaxis_title='Y',
        zaxis_title='Z',
        aspectmode='data',
    ),
    height=800,
    width=800,
    xaxis={'scaleanchor': 'y'},
)

# Create a figure and add the mesh plot and layout
fig = go.Figure(data=[mesh], layout=layout)

# Show the 3D plot
fig.show()


mrep mesh3d