나의 작은 valley
[시각화 기술] Graph visualization in Jupyter 본문
그래픽스(graphics)/시각화 기술(visualization)
[시각화 기술] Graph visualization in Jupyter
붕옥 아이젠 2022. 10. 25. 23:20728x90
#Initialize with this block.
from manim import *
config.media_width = "70%" #Set the width of pic/video
config.media_embed = True #Embed pic/video in Jypyter Notebook
#Shortcuts
RI = "-s --disable_caching --progress_bar=leave -v WARNING"
RlV = "-ql --disable_caching --progress_bar=leave -v WARNING"
RmV = "-qm --disable_caching --progress_bar=leave -v WARNING"
RhV = "-qh --disable_caching --progress_bar=leave -v WARNING"
%%manim $RmV {"SVG_import"}
class SVG_import(Scene):
def construct(self):
print(f"{config.assets_dir}")
svg = SVGMobject(file_name="./assets/foldtypes.svg").set_stroke(WHITE)
self.add(svg)
%%manim $RI {"Take1"}
class Take1(Scene):
def construct(self):
vertex = [(-2,0),(-1,0),(1,.5),(1,-.5),(2,1),(2,.5),(2,-.5),(2,-1)]
edge = [[(-2,0),(-1,0)], [(-1,0),(1,.5)], [(-1,0),(1,-.5)], [(1,.5), (2,1)], [(1,.5), (2,.5)], [(1,-.5), (2,-.5)], [(1,-.5), (2,-1)]]
g = Graph(vertex,edge)
self.add(g)
%%manim $RI {"Take2"}
class Take2(Scene):
def construct(self):
vertex = [(-2,0), (-1,0), (1,.5), (1,-.5), (2,1), (2,.5), (2,-.5), (2,-1)]
edge = [((-2,0), (-1,0)),
((-1,0), (1,.5)),
((-1,0), (1,-.5)),
((1,.5), (2,1)),
((1,.5), (2,.5)),
((1,-.5), (2,-.5)),
((1,-.5), (2,-1))]
g = Graph(vertex, edge)
self.add(g)
%%manim $RI {"Take2"}
class Take2(Scene):
def construct(self):
vertex = [(-2,0), (-1,0), (1,.5), (1,-.5), (2,1), (2,.5), (2,-.5), (2,-1)]
edge = [((-2,0), (-1,0)),
((-1,0), (1,.5)),
((-1,0), (1,-.5)),
((1,.5), (2,1)),
((1,.5), (2,.5)),
((1,-.5), (2,-.5)),
((1,-.5), (2,-1))]
layout = {v : list(v).append(0) for v in vertex}
print(layout)
g = Graph(vertex, edge, layout=layout)
self.add(g)
%%manim $RI {"Take3"}
class Take3(Scene):
def construct(self):
vertex = [(-2,0), (-1,0), (1,.5), (1,-.5), (2,1), (2,.5), (2,-.5), (2,-1)]
edge = [((-2,0), (-1,0)),
((-1,0), (1,.5)),
((-1,0), (1,-.5)),
((1,.5), (2,1)),
((1,.5), (2,.5)),
((1,-.5), (2,-.5)),
((1,-.5), (2,-1))]
layout = {v : list(v) + [0] for v in vertex}
print(layout)
g = Graph(vertex, edge, layout=layout)
self.add(g)
728x90
'그래픽스(graphics) > 시각화 기술(visualization)' 카테고리의 다른 글
[시각화 기술] Graphing the Function (0) | 2022.11.22 |
---|---|
[시각화 기술] Manim Community - Quickstart (0) | 2022.11.15 |
[시각화 기술] (0) | 2022.11.08 |
[시각화 기술] Manim 설치 (for window) (0) | 2022.11.01 |
INTRO (0) | 2022.08.03 |
Comments