Skip to content

Commit 908bc28

Browse files
committed
MAINT Remove plt.show() and plt.close(fig). These shouldn't be required and seem to cause display problems. See #485.
1 parent a44e41f commit 908bc28

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

pyfolio/tears.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,6 @@ def create_simple_tear_sheet(returns,
434434
for ax in fig.axes:
435435
plt.setp(ax.get_xticklabels(), visible=True)
436436

437-
plt.show()
438-
plt.close(fig)
439-
440437

441438
@plotting.customize
442439
def create_returns_tear_sheet(returns, positions=None,
@@ -624,11 +621,8 @@ def create_returns_tear_sheet(returns, positions=None,
624621
for ax in fig.axes:
625622
plt.setp(ax.get_xticklabels(), visible=True)
626623

627-
plt.show()
628624
if return_fig:
629625
return fig
630-
else:
631-
plt.close(fig)
632626

633627

634628
@plotting.customize
@@ -722,11 +716,8 @@ def create_position_tear_sheet(returns, positions,
722716
for ax in fig.axes:
723717
plt.setp(ax.get_xticklabels(), visible=True)
724718

725-
plt.show()
726719
if return_fig:
727720
return fig
728-
else:
729-
plt.close(fig)
730721

731722

732723
@plotting.customize
@@ -805,11 +796,8 @@ def create_txn_tear_sheet(returns, positions, transactions,
805796
for ax in fig.axes:
806797
plt.setp(ax.get_xticklabels(), visible=True)
807798

808-
plt.show()
809799
if return_fig:
810800
return fig
811-
else:
812-
plt.close(fig)
813801

814802

815803
@plotting.customize
@@ -898,11 +886,8 @@ def create_round_trip_tear_sheet(returns, positions, transactions,
898886

899887
gs.tight_layout(fig)
900888

901-
plt.show()
902889
if return_fig:
903890
return fig
904-
else:
905-
plt.close(fig)
906891

907892

908893
@plotting.customize
@@ -980,11 +965,8 @@ def create_interesting_times_tear_sheet(
980965
ax.set_ylabel('Returns')
981966
ax.set_xlabel('')
982967

983-
plt.show()
984968
if return_fig:
985969
return fig
986-
else:
987-
plt.close(fig)
988970

989971

990972
@plotting.customize
@@ -1276,11 +1258,8 @@ def create_bayesian_tear_sheet(returns, benchmark_rets=None,
12761258

12771259
gs.tight_layout(fig)
12781260

1279-
plt.show()
12801261
if return_fig:
12811262
return fig
1282-
else:
1283-
plt.close(fig)
12841263

12851264

12861265
@plotting.customize
@@ -1454,16 +1433,11 @@ def create_risk_tear_sheet(positions,
14541433
risk.plot_volume_exposures_gross(grossed_threshold, percentile,
14551434
ax_vol_gross)
14561435

1457-
plt.show()
1458-
14591436
for ax in fig.axes:
14601437
plt.setp(ax.get_xticklabels(), visible=True)
14611438

1462-
plt.show()
14631439
if return_fig:
14641440
return fig
1465-
else:
1466-
plt.close(fig)
14671441

14681442

14691443
@plotting.customize
@@ -1582,8 +1556,5 @@ def create_perf_attrib_tear_sheet(returns,
15821556

15831557
gs.tight_layout(fig)
15841558

1585-
plt.show()
15861559
if return_fig:
15871560
return fig
1588-
else:
1589-
plt.close(fig)

0 commit comments

Comments
 (0)