We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a dynamic legend and am trying to have it resize to fit the text content. However, right now the legend will expand but not contract.
Here is a basic example:
import finplot as fplt import yfinance import numpy as np df = yfinance.download("ASTS", interval="1d") df["Date"] = df.index.astype(np.int64) ax = fplt.create_plot("ASTS") legend = fplt.add_legend("", ax=ax) df[["Open", "Close", "High", "Low"]].plot(ax=ax, kind="candle") def update_legend_text(x, y): row = df.loc[df["Date"] == x].iloc[0] legend.setText(f'<span style="color: white;">O: {row["Open"]:.2f} C: {row["Close"]:.2f} H: {row["High"]:.2f} L: {row["Low"]:.2f}</span>') fplt.set_mouse_callback(update_legend_text, ax=ax, when="hover") fplt.show()
You can see how the legend will grow larger to accommodate longer text but will not shrink back when going to shorter text.
The text was updated successfully, but these errors were encountered:
Unfortunately I don't know, you'll have to look into the pyqtgraph code for how legends are made to find a solution. GL!
Sorry, something went wrong.
No branches or pull requests
I have a dynamic legend and am trying to have it resize to fit the text content. However, right now the legend will expand but not contract.
Here is a basic example:
You can see how the legend will grow larger to accommodate longer text but will not shrink back when going to shorter text.
The text was updated successfully, but these errors were encountered: