From 3f701e4fc769d77af74a0bcc2a9ab2f1a7bdd1ea Mon Sep 17 00:00:00 2001 From: didier Date: Sun, 28 Mar 2021 23:53:33 +0100 Subject: [PATCH] improve some TA plots --- gamestonk_terminal/technical_analysis/overlap.py | 12 +++++------- .../technical_analysis/trend_indicators.py | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gamestonk_terminal/technical_analysis/overlap.py b/gamestonk_terminal/technical_analysis/overlap.py index 5b7a5d8c084..7509c0ce2f3 100644 --- a/gamestonk_terminal/technical_analysis/overlap.py +++ b/gamestonk_terminal/technical_analysis/overlap.py @@ -87,18 +87,16 @@ def ema(l_args, s_ticker, s_interval, df_stock): plt.xlim(df_stock["4. close"].index[0], df_stock["4. close"].index[-1]) plt.xlabel("Time") plt.ylabel(f"Share Price of {s_ticker} ($)") - axTa = axPrice.twinx() - plt.plot(df_ta.index, df_ta.values) + plt.plot(df_ta.index, df_ta.values, c="tab:blue") + l_legend = list() + l_legend.append(s_ticker) # Pandas series if len(df_ta.shape) == 1: - l_legend = [f"{ns_parser.n_length} EMA"] + l_legend.append(f"{ns_parser.n_length} EMA") # Pandas dataframe else: - l_legend = df_ta.columns.tolist() + l_legend.append(df_ta.columns.tolist()) plt.legend(l_legend) - axTa.set_ylabel("{ns_parser.n_length} EMA", color="tab:blue") - axTa.spines["right"].set_color("tab:blue") - axTa.tick_params(axis="y", colors="tab:blue") plt.grid(b=True, which="major", color="#666666", linestyle="-") plt.minorticks_on() plt.grid(b=True, which="minor", color="#999999", linestyle="-", alpha=0.2) diff --git a/gamestonk_terminal/technical_analysis/trend_indicators.py b/gamestonk_terminal/technical_analysis/trend_indicators.py index 40cde77bb37..7561d218472 100644 --- a/gamestonk_terminal/technical_analysis/trend_indicators.py +++ b/gamestonk_terminal/technical_analysis/trend_indicators.py @@ -224,6 +224,7 @@ def aroon(l_args, s_ticker, s_interval, df_stock): plt.subplot(313) plt.plot(df_ta.index, df_ta.iloc[:, 2].values, "b", lw=2) + plt.xlim(df_stock.index[0], df_stock.index[-1]) plt.xlabel("Time") plt.legend([f"Aroon OSC ({df_ta.columns[2]})"]) plt.grid(b=True, which="major", color="#666666", linestyle="-")