using for loop to install conda package
This commit is contained in:
2
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/README.txt
vendored
Normal file
2
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/README.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
3D Drawing
|
||||
----------
|
||||
BIN
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/__pycache__/mayavi2_spring.cpython-311.pyc
vendored
Normal file
BIN
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/__pycache__/mayavi2_spring.cpython-311.pyc
vendored
Normal file
Binary file not shown.
BIN
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/__pycache__/plot_basic.cpython-311.pyc
vendored
Normal file
BIN
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/__pycache__/plot_basic.cpython-311.pyc
vendored
Normal file
Binary file not shown.
43
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/mayavi2_spring.py
vendored
Normal file
43
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/mayavi2_spring.py
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
=======
|
||||
Mayavi2
|
||||
=======
|
||||
|
||||
"""
|
||||
|
||||
import networkx as nx
|
||||
import numpy as np
|
||||
from mayavi import mlab
|
||||
|
||||
# some graphs to try
|
||||
# H=nx.krackhardt_kite_graph()
|
||||
# H=nx.Graph();H.add_edge('a','b');H.add_edge('a','c');H.add_edge('a','d')
|
||||
# H=nx.grid_2d_graph(4,5)
|
||||
H = nx.cycle_graph(20)
|
||||
|
||||
# reorder nodes from 0,len(G)-1
|
||||
G = nx.convert_node_labels_to_integers(H)
|
||||
# 3d spring layout
|
||||
pos = nx.spring_layout(G, dim=3, seed=1001)
|
||||
# numpy array of x,y,z positions in sorted node order
|
||||
xyz = np.array([pos[v] for v in sorted(G)])
|
||||
# scalar colors
|
||||
scalars = np.array(list(G.nodes())) + 5
|
||||
|
||||
mlab.figure()
|
||||
|
||||
pts = mlab.points3d(
|
||||
xyz[:, 0],
|
||||
xyz[:, 1],
|
||||
xyz[:, 2],
|
||||
scalars,
|
||||
scale_factor=0.1,
|
||||
scale_mode="none",
|
||||
colormap="Blues",
|
||||
resolution=20,
|
||||
)
|
||||
|
||||
pts.mlab_source.dataset.lines = np.array(list(G.edges()))
|
||||
tube = mlab.pipeline.tube(pts, tube_radius=0.01)
|
||||
mlab.pipeline.surface(tube, color=(0.8, 0.8, 0.8))
|
||||
mlab.orientation_axes()
|
||||
51
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/plot_basic.py
vendored
Normal file
51
.CondaPkg/env/share/doc/networkx-3.1/examples/3d_drawing/plot_basic.py
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"""
|
||||
================
|
||||
Basic matplotlib
|
||||
================
|
||||
|
||||
A basic example of 3D Graph visualization using `mpl_toolkits.mplot_3d`.
|
||||
|
||||
"""
|
||||
|
||||
import networkx as nx
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
|
||||
# The graph to visualize
|
||||
G = nx.cycle_graph(20)
|
||||
|
||||
# 3d spring layout
|
||||
pos = nx.spring_layout(G, dim=3, seed=779)
|
||||
# Extract node and edge positions from the layout
|
||||
node_xyz = np.array([pos[v] for v in sorted(G)])
|
||||
edge_xyz = np.array([(pos[u], pos[v]) for u, v in G.edges()])
|
||||
|
||||
# Create the 3D figure
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111, projection="3d")
|
||||
|
||||
# Plot the nodes - alpha is scaled by "depth" automatically
|
||||
ax.scatter(*node_xyz.T, s=100, ec="w")
|
||||
|
||||
# Plot the edges
|
||||
for vizedge in edge_xyz:
|
||||
ax.plot(*vizedge.T, color="tab:gray")
|
||||
|
||||
|
||||
def _format_axes(ax):
|
||||
"""Visualization options for the 3D axes."""
|
||||
# Turn gridlines off
|
||||
ax.grid(False)
|
||||
# Suppress tick labels
|
||||
for dim in (ax.xaxis, ax.yaxis, ax.zaxis):
|
||||
dim.set_ticks([])
|
||||
# Set axes labels
|
||||
ax.set_xlabel("x")
|
||||
ax.set_ylabel("y")
|
||||
ax.set_zlabel("z")
|
||||
|
||||
|
||||
_format_axes(ax)
|
||||
fig.tight_layout()
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user