Skip to content
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

gr.Plot is rendered smaller in a hidden gr.Tab #6850

Closed
1 task done
hysts opened this issue Dec 20, 2023 · 0 comments · Fixed by #8740
Closed
1 task done

gr.Plot is rendered smaller in a hidden gr.Tab #6850

hysts opened this issue Dec 20, 2023 · 0 comments · Fixed by #8740
Labels
bug Something isn't working

Comments

@hysts
Copy link
Collaborator

hysts commented Dec 20, 2023

Describe the bug

When gr.Plot is placed in gr.Tab, the graph is rendered smaller than expected in the second tab compared to the first tab even though the figures are the same.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

repro Space: https://huggingface.co/spaces/hysts-debug/gradio-plot-render-in-tab

import gradio as gr
import numpy as np
import pandas as pd
import plotly.express as px

np.random.seed(0)

df = pd.DataFrame({"x": np.arange(100), "y": np.random.normal(size=100).cumsum()})
fig = px.line(df, x="x", y="y")

with gr.Blocks() as demo:
    with gr.Tabs():
        with gr.Tab(label="a"):
            gr.Plot(value=fig)
        with gr.Tab(label="b"):
            gr.Plot(value=fig)

if __name__ == "__main__":
    demo.queue().launch()

Screenshot

out.mp4

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.11.0
gradio_client version: 0.7.3

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.105.0
ffmpy: 0.3.1
gradio-client==0.7.3 is not installed.
httpx: 0.25.2
huggingface-hub: 0.19.4
importlib-resources: 6.1.1
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.8.2
numpy: 1.26.2
orjson: 3.9.10
packaging: 23.2
pandas: 2.1.4
pillow: 10.1.0
pydantic: 2.5.2
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.9.0
typing-extensions: 4.9.0
uvicorn: 0.24.0.post1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.10.0
httpx: 0.25.2
huggingface-hub: 0.19.4
packaging: 23.2
typing-extensions: 4.9.0
websockets: 11.0.3

Severity

I can work around it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants