Skip to content

Commit 7e045bb

Browse files
committed
Small improvements in legend's rendition
1 parent 5f5514c commit 7e045bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

swift_code_metrics/_graphics.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class Graph:
1212
def __init__(self, path=None):
1313
self.path = path
14+
plt.rc('legend', fontsize='small')
1415

1516
def bar_plot(self, title, data):
1617
plt.title(title)
@@ -32,7 +33,7 @@ def bar_plot(self, title, data):
3233
def pie_plot(self, title, sizes, labels, legend):
3334
plt.title(title)
3435
patches, _, _ = plt.pie(sizes, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90)
35-
plt.legend(patches, legend, loc='lower left')
36+
plt.legend(patches, legend, loc='best')
3637
plt.tight_layout()
3738
plt.axis('equal')
3839

@@ -70,7 +71,11 @@ def directed_graph(self, title, list_of_nodes, list_of_edges):
7071
seq(list_of_nodes).for_each(lambda n: dir_graph.add_node(n[0],
7172
penwidth=ceil((n[1] + 1) / 2), width=(n[1] + 1)))
7273
seq(list_of_edges).for_each(
73-
lambda e: dir_graph.add_edge(e[0], e[1], label=e[2], penwidth=ceil((e[3] + 1) / 2), color=e[4], fontcolor=e[4]))
74+
lambda e: dir_graph.add_edge(e[0], e[1],
75+
label=e[2],
76+
penwidth=ceil((e[3] + 1) / 2),
77+
color=e[4],
78+
fontcolor=e[4]))
7479

7580
dir_graph.layout('dot')
7681
try:

0 commit comments

Comments
 (0)