Skip to main content

Streamlit component that allows you to show PyVista 3d visualizations

Project description

🧊 stpyvista

Streamlit component to show PyVista 3D visualizations

Installation instructions

pip install stpyvista

Usage instructions

Streamlit Cloud

import streamlit as st
import pyvista as pv
from stpyvista import stpyvista

# pythreejs does not support scalar bars :(
pv.global_theme.show_scalar_bar = False 

## Initialize a plotter object
plotter = pv.Plotter(window_size=[400,400])

## Create a mesh with a cube 
mesh = pv.Cube(center=(0,0,0))

## Add some scalar field associated to the mesh
mesh['myscalar'] = mesh.points[:, 2]*mesh.points[:, 0]

## Add mesh to the plotter
plotter.add_mesh(mesh, scalars='myscalar', cmap='bwr', line_width=1)
plotter.add_scalar_bar()

## Final touches
plotter.view_isometric()
plotter.background_color = 'white'

## Pass a key to avoid re-rendering at each time something changes in the page
stpyvista(plotter, key="pv_cube")

Log changes

v 0.0.8 - Remove excessive whitespace below the rendered component. - Can pass additional kwargs to panel.pane.vtk, e.g. setting an orientation_widget. Check panel-vtk for details on valid kwargs.
v 0.0.6 - Replaced pythreejs backend for panel backend. This is a temporary solution as pyvista will remove panel support in favor of trame.
v 0.0.5 - Support transparent backgrounds to blend with streamlit's web app theme. - Add a control to spin along a certain axis the first mesh passed to the plotter.
v 0.0.4 - Pass a key to the stpyvista component to avoid re-rendering at every streamlit interaction - Using ipywidgets `embed_minimal_html` directly instead of pyvista `export_html`. - Update examples as a multipage streamlit app

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stpyvista-0.0.8.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stpyvista-0.0.8-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file stpyvista-0.0.8.tar.gz.

File metadata

  • Download URL: stpyvista-0.0.8.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for stpyvista-0.0.8.tar.gz
Algorithm Hash digest
SHA256 dcf61e4ac44baa722dd52f6119969e410b8e8e15338db9faf1a6e9c8b3bc1b75
MD5 2914ee786e1465bc0759bb637e2eaddc
BLAKE2b-256 49b5c427149f60aee6fd895cff9c5371373b8f948685927b05964933f0cec1c3

See more details on using hashes here.

File details

Details for the file stpyvista-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: stpyvista-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for stpyvista-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cf767a589574f2aa36671d6a5c1235750764705aadb1824843cfce011f039d8d
MD5 98618246ab73b5a1083b8caf9c23a520
BLAKE2b-256 3933a2e64d27260f240431b9be105d4a0ba5b16f655939b2b8f3f65b16737f9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page