mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
4ba7b238e2
* changes * add changeset * chages * changes * changes * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1.3 KiB
1.3 KiB
Gradio Demo: plot_guide_zoom¶
In [ ]:
!pip install -q gradio
In [ ]:
# Downloading files from the demo repo import os !wget -q https://github.com/gradio-app/gradio/raw/main/demo/plot_guide_zoom/data.py
In [ ]:
import gradio as gr from data import df with gr.Blocks() as demo: plt = gr.LinePlot(df, x="weight", y="height") def select_region(selection: gr.SelectData): min_w, max_w = selection.index return gr.LinePlot(x_lim=(min_w, max_w)) # type: ignore plt.select(select_region, None, plt) plt.double_click(lambda: gr.LinePlot(x_lim=None), None, plt) if __name__ == "__main__": demo.launch()