-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
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
Allow setting plotly margins #9805
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/7a4b272f9c24d9ef30c24991091687936de63148/gradio-5.3.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@7a4b272f9c24d9ef30c24991091687936de63148#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/7a4b272f9c24d9ef30c24991091687936de63148/gradio-client-1.7.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/7a4b272f9c24d9ef30c24991091687936de63148/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @aliabid94 ! Tested and works well
Thanks for allowing passing margins. However, please note that the bug I reported was not that margins were ignored. My reported bug is that, without specifying margins, some labels are cut off from the resulting figure. See example: https://huggingface.co/spaces/albertvillanova/bug-plotly-line-polar
Code: import gradio as gr
import pandas as pd
import plotly.express as px
DATA = {"BBH": [0.2, 0.7], "GPQA": [0.4, 0.5], "IFEval": [0.6, 0.3], "MATH": [0.2, 0.7], "MMLU-Pro": [0.4, 0.5], "MuSR": [0.6, 0.3]}
def display_plot():
df = pd.DataFrame(DATA, index=["model-1", "model-2"])
fig = px.line_polar(
df.melt(ignore_index=False, var_name="Benchmark", value_name="Score").reset_index(names="Model"),
r="Score", theta="Benchmark", color="Model",
line_close=True,
range_r=[0, 1],
color_discrete_sequence=["#FF9D00", "#32343D"],
)
return fig
with gr.Blocks() as demo:
plot = gr.Plot()
btn = gr.Button()
btn.click(
fn=display_plot,
outputs=plot,
)
demo.launch() |
I think this fixes your issue. You can try it yourself by uninstalling |
@hysts, thanks for checking and for the hint how I can check next time! 🤗 |
Plotly margins, when explicitly set, were being overwritten, so users couldn't specify them. Fixed now. See discussion here:
https://huggingface.slack.com/archives/C02QZLG8GMN/p1729596330205269
See modified outbreak_forecast demo below: