<jupyter_start><jupyter_text>Python Package Imports<jupyter_code>%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt 
from mpl_toolkits.mplot3d import axes3d
import matplotlib.cm as cm
from IPython.display import display, Math, clear_output

import sympy
from sympy import *
from sympy.physics.vector import ReferenceFrame, CoordinateSym
from sympy.vector import CoordSys3D, divergence, curl

import ipyvolume as ipv
import time
from ipywidgets import Output

import helpers

np.seterr(divide='ignore', invalid='ignore');<jupyter_output>The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload<jupyter_text>Demonstrate a surface (or mesh or wireframe) plot.  The input data to a 3D surface plot is 3 vectors (i.e. x,y,z). These vectors define a surface; the surface is not a vector field, nor is it a scalar value defined at all points in space.<jupyter_code># Create the data.
dphi, dtheta = np.pi/250.0, pi/250.0
[phi,theta] = np.mgrid[0:np.pi+dphi*1.5:dphi,0:2*np.pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = np.sin(m0*phi)**m1 + np.cos(m2*phi)**m3 + np.sin(m4*theta)**m5 + np.cos(m6*theta)**m7
x = r*np.sin(phi)*np.cos(theta)
y = r*np.cos(phi)
z = r*np.sin(phi)*np.sin(theta)

# And surface/mesh plots, showing surfaces or wireframes.
ipv.clear()
ipv.figure()
ipv.plot_mesh(x, y, z, wireframe=False)
ipv.squarelim()
ipv.show()<jupyter_output><empty_output><jupyter_text>Demonstrate a quiver plot, which shows a vector at each position The input data to a 3D quiver plot is: 1. a sequence of three vectors which define the position of each point **and** 2. a sequence of three vectors which define the magnitude and direction at each point.<jupyter_code># quiver plot, vector at each position
x, y, z, u, v, w = np.random.random((6, 1000))*2-1

print('Shape of x: {}'.format(np.shape(x)[0]))
print('Shape of u: {}'.format(np.shape(u)[0]))

quiver = ipv.quickquiver(x, y, z, u, v, w, size=5)
ipv.show()<jupyter_output>Shape of x: 1000
Shape of u: 1000<jupyter_text>A quiver plot with sliders<jupyter_code>x, y, z, u, v, w = np.random.random((6, 1000))*2-1
selected = np.random.randint(0, 1000, 100)
ipv.figure()
quiver = ipv.quiver(x, y, z, u, v, w, size=5, size_selected=8, selected=selected)

from ipywidgets import FloatSlider, ColorPicker, VBox, jslink

size = FloatSlider(min=0, max=30, step=0.1)
size_selected = FloatSlider(min=0, max=30, step=0.1)
color = ColorPicker()
color_selected = ColorPicker()
jslink((quiver, 'size'), (size, 'value'))
jslink((quiver, 'size_selected'), (size_selected, 'value'))
jslink((quiver, 'color'), (color, 'value'))
jslink((quiver, 'color_selected'), (color_selected, 'value'))
VBox([ipv.gcc(), size, size_selected, color, color_selected])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14047534586732885, 'fraction_numerical': 0.03299042213550905, 'mean_word_length': 5.714285714285714, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '210196', 'license': 'MIT', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1063, 'n_words': 316, 'path': 'other_visualization_demos.ipynb', 'repo_name': 'lucask07/teaching-notebooks', 'size': '2819'}