diff --git a/.gitignore b/.gitignore index 08d8375a..ae891fd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# virutalenv +.venv + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/pyfolio/tears.py b/pyfolio/tears.py index fc3bd83c..715c8b26 100644 --- a/pyfolio/tears.py +++ b/pyfolio/tears.py @@ -454,7 +454,13 @@ def create_simple_tear_sheet( plotting.plot_txn_time_hist(transactions, ax=ax_txn_timings) for ax in fig.axes: - plt.setp(ax.get_xticklabels(), visible=True) + ax.tick_params( + axis="x", + which="major", + bottom=True, + top=False, + labelbottom=True, + ) @plotting.customize @@ -642,7 +648,13 @@ def create_returns_tear_sheet( raise ValueError("bootstrap requires passing of benchmark_rets.") for ax in fig.axes: - plt.setp(ax.get_xticklabels(), visible=True) + ax.tick_params( + axis="x", + which="major", + bottom=True, + top=False, + labelbottom=True, + ) if return_fig: return fig @@ -746,7 +758,13 @@ def create_position_tear_sheet( ) for ax in fig.axes: - plt.setp(ax.get_xticklabels(), visible=True) + ax.tick_params( + axis="x", + which="major", + bottom=True, + top=False, + labelbottom=True, + ) if return_fig: return fig @@ -841,7 +859,13 @@ def create_txn_tear_sheet( ax=ax_slippage_sensitivity, ) for ax in fig.axes: - plt.setp(ax.get_xticklabels(), visible=True) + ax.tick_params( + axis="x", + which="major", + bottom=True, + top=False, + labelbottom=True, + ) if return_fig: return fig diff --git a/pyfolio/tests/test_nbs.py b/pyfolio/tests/test_nbs.py index adda16f3..514ca5fd 100755 --- a/pyfolio/tests/test_nbs.py +++ b/pyfolio/tests/test_nbs.py @@ -5,17 +5,16 @@ Each cell is submitted to the kernel, and checked for errors. """ -import os -import glob +from pathlib import Path from runipy.notebook_runner import NotebookRunner - -from pyfolio.utils import pyfolio_root from pyfolio.ipycompat import read as read_notebook +EXAMPLES_PATH = Path(__file__).resolve().parent.parent / "examples" + def test_nbs(): - path = os.path.join(pyfolio_root(), "examples", "*.ipynb") - for ipynb in glob.glob(path): + for ipynb in EXAMPLES_PATH.glob("*.ipynb"): + print(ipynb) with open(ipynb) as f: nb = read_notebook(f, "json") nb_runner = NotebookRunner(nb)