Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi

I am looking at a lot of (stacked) time series grouped by some criteria. I would like to be able to click on one of the graphs in the example below and have a new pop-up window showing a larger version of the graph. Is this possible with current features?

Screenshot 2025-08-09 at 11 22 17
You must be logged in to vote

Replies: 1 comment · 4 replies

Comment options

I would just make a second figure with one subplot and display the data in the clicked subplot, something like (not tested, just to give you an idea):

fig_many = fpl.Figure(shape=(m, n))
fig_detailed = fpl.Figure(shape=(1, 1))

# add graphics to your subplots etc, I recommend naming them for convenience

# initialize the detailed fig with data from the first subplot
fig_detailed[0, 0].add_line_collection(fig_many[0, 0]["line-coll"].data[:], colors=line_stack.data[:], name="line-collection")  # set any other properties you want

@fig_many.renderer.add_event_handler("click")
def fig_many_clicked(ev):
    for subplot in fig_many:
        pos = (ev.x, ev.y)
        if subplot.map_screen_to_world(pos) is not None:
            # this is the subplot that has been clicked, set the data of the line collection in the detailed subplot
            for g in subplot["line-collecection"].graphics:
                    fig_detailed[0, 0]["line-collection"].data = g.data[:]

If your lines are huge and GPU VRAM is a real concern you can share the buffer, but if you're plotting multiple lines to start with I'm assuming that's not an issue here.

You must be logged in to vote
4 replies
@arniwesth
Comment options

Brilliant! If someone comes looking, I got my example to work with some minor changes to the code above:

# initialize the detailed fig with data from the first subplot
fig_detailed[0, 0].add_line_stack(fig_many[0, 0]["line-coll"].data[:], cmap="rainbow", name="line-collection")  # set any other properties you want

@fig_many.renderer.add_event_handler("click")
def fig_many_clicked(ev):
    for subplot in list(fig_many):
        pos = (ev.x, ev.y)
        if subplot.map_screen_to_world(pos) is not None:
            # this is the subplot that has been clicked, set the data of the line stack in the detailed subplot
            fig_detailed[0, 0]["line-collection"].data = subplot["line-coll"].data[:]

Note that you need to click on the actual subplot graph. Clicking on the subplot title does not work.

@kushalkolar
Comment options

Does this actually work?

fig_detailed[0, 0]["line-collection"].data = subplot["line-coll"].data[:]

I can't remember if we made line collections settable like that.

@arniwesth
Comment options

It does for my simple dummy example above. I ran into some issues with the real data, which I think is related to not all time series having the same length. I solved it this way, which at least works for all my use-cases (might not be the smartest way):

@fig_many.renderer.add_event_handler("click")
def fig_many_clicked(ev):
    for subplot in list(fig_many):
        pos = (ev.x, ev.y)
        if subplot.map_screen_to_world(pos) is not None:
            fig_detailed[0, 0].delete_graphic(fig_detailed[0, 0]["line-collection"])
            fig_detailed[0, 0].add_line_stack(subplot["line-coll"].data[:], cmap="rainbow", name="line-collection") 
@kushalkolar
Comment options

yes GPU buffers are always of a fixed size so you have to delete the graphic and create a new one. For the future we have ideas for swapping out the buffer under the hood and keeping the graphic: #869

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.