Skip to content

Commit

Permalink
Updated plotting method
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsch420 committed Jan 9, 2025
1 parent 250212c commit ae516e4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1121,10 +1121,10 @@ def unit_positions_for_structure_plot(self) -> Dict[Unit, Tuple[int, int]]:
positions = {}
for depth, layer in enumerate(layers):
number_of_nodes = len(layer)
positions_in_layer = np.linspace(0, maximum_layer_width, number_of_nodes, endpoint=False)
positions_in_layer = np.linspace(0., maximum_layer_width, number_of_nodes, endpoint=False)
positions_in_layer += (maximum_layer_width - len(layer)) / (2 * len(layer))
for position, node in zip(positions_in_layer, layer):
positions[node] = (depth, position)
positions[node] = (float(depth), position)

return positions

Expand Down Expand Up @@ -1184,6 +1184,9 @@ def plot_structure(self, node_colors: Optional[Dict[Unit, str]] = None, node_siz
# and make the Spines Visibility as False
for pos in ['right', 'top', 'bottom', 'left']:
plt.gca().spines[pos].set_visible(False)
xticks, xticklabels = plt.xticks()
xmin = (3 * xticks[0] - xticks[1]) / 2.
plt.xlim(xmin, max([x for x, _ in positions.values()]) + 1)



Expand Down

0 comments on commit ae516e4

Please sign in to comment.