1+ import matplotlib .pyplot as plt
12import numpy as np
23import plotly .graph_objects as go
34from mpl_toolkits .axes_grid1 import make_axes_locatable
4- import matplotlib . pyplot as plt
5+
56import maxplotlib .subfigure .tikz_figure as tf
67
8+
79class Node :
810 def __init__ (self , x , y , label = "" , content = "" , layer = 0 , ** kwargs ):
911 self .x = x
@@ -13,6 +15,7 @@ def __init__(self, x, y, label="", content="", layer=0, **kwargs):
1315 self .layer = layer
1416 self .options = kwargs
1517
18+
1619class Path :
1720 def __init__ (
1821 self , nodes , path_actions = [], cycle = False , label = "" , layer = 0 , ** kwargs
@@ -24,6 +27,7 @@ def __init__(
2427 self .label = label
2528 self .options = kwargs
2629
30+
2731class LinePlot :
2832 def __init__ (self , ** kwargs ):
2933 """
@@ -56,7 +60,7 @@ def __init__(self, **kwargs):
5660 # Initialize lists to hold Node and Path objects
5761 self .nodes = []
5862 self .paths = []
59- #self.layers = {}
63+ # self.layers = {}
6064
6165 # Counter for unnamed nodes
6266 self ._node_counter = 0
@@ -77,7 +81,7 @@ def _add(self, obj, layer):
7781 else :
7882 self .layered_line_data [layer ] = [obj ]
7983
80- def add_line (self , x_data , y_data , layer = 0 , plot_type = ' plot' , ** kwargs ):
84+ def add_line (self , x_data , y_data , layer = 0 , plot_type = " plot" , ** kwargs ):
8185 """
8286 Add a line to the plot.
8387
@@ -95,17 +99,17 @@ def add_line(self, x_data, y_data, layer=0, plot_type='plot', **kwargs):
9599 "kwargs" : kwargs ,
96100 }
97101 self ._add (ld , layer )
98-
99- def add_imshow (self , data , layer = 0 , plot_type = ' imshow' , ** kwargs ):
102+
103+ def add_imshow (self , data , layer = 0 , plot_type = " imshow" , ** kwargs ):
100104 ld = {
101105 "data" : np .array (data ),
102106 "layer" : layer ,
103107 "plot_type" : plot_type ,
104108 "kwargs" : kwargs ,
105109 }
106110 self ._add (ld , layer )
107-
108- def add_patch (self , patch , layer = 0 , plot_type = ' patch' , ** kwargs ):
111+
112+ def add_patch (self , patch , layer = 0 , plot_type = " patch" , ** kwargs ):
109113 ld = {
110114 "patch" : patch ,
111115 "layer" : layer ,
@@ -114,7 +118,7 @@ def add_patch(self, patch, layer=0, plot_type='patch', **kwargs):
114118 }
115119 self ._add (ld , layer )
116120
117- def add_colorbar (self , label = "" , layer = 0 , plot_type = ' colorbar' , ** kwargs ):
121+ def add_colorbar (self , label = "" , layer = 0 , plot_type = " colorbar" , ** kwargs ):
118122 cb = {
119123 "label" : label ,
120124 "layer" : layer ,
@@ -159,9 +163,10 @@ def plot_matplotlib(self, ax, layers=None):
159163 ** line ["kwargs" ],
160164 )
161165 elif line ["plot_type" ] == "patch" :
162- ax .add_patch (line ["patch" ],
163- ** line ["kwargs" ],
164- )
166+ ax .add_patch (
167+ line ["patch" ],
168+ ** line ["kwargs" ],
169+ )
165170 elif line ["plot_type" ] == "colorbar" :
166171 divider = make_axes_locatable (ax )
167172 cax = divider .append_axes ("right" , size = "5%" , pad = 0.05 )
@@ -208,7 +213,7 @@ def plot_plotly(self):
208213 traces .append (trace )
209214
210215 return traces
211-
216+
212217 def add_node (self , x , y , label = None , content = "" , layer = 0 , ** kwargs ):
213218 """
214219 Add a node to the TikZ figure.
0 commit comments