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

fix: Matplotlib input table and execution context not working #185

Merged
merged 4 commits into from
Dec 22, 2023

Conversation

jnumainville
Copy link
Collaborator

@jnumainville jnumainville commented Dec 22, 2023

KeyedArrayBackedMutableTable was renamed, which was causing this to break. Moved to the python api and also fixed some issues with the execution context

from deephaven.plugin.matplotlib import TableAnimation
from deephaven import pandas as dhpd
from deephaven import time_table

import matplotlib.pyplot as plt
import seaborn as sns  
import pandas as pd

# Create a ticking table with the cosine function
tt = time_table("PT1S").update(["X = 0.2 * i", "Y = Math.cos(X)"])

fig, ax = plt.subplots() # Create a new figure

# This function updates a figure
def update_fig(data, update):
    # Clear the axes (don't draw over old lines)
    ax.clear()
    # Convert the X and Y columns in `tt` to a DataFrame
    df = dhpd.to_pandas(tt.view(["X", "Y"]))
    # Draw the line plot
    sns.lineplot(df, x="X", y="Y")

# Create our animation. It will listen for updates on `tt` and call `update_fig` whenever there is an update
line_plot_ani = TableAnimation(fig, tt, update_fig)

@jnumainville jnumainville requested a review from mofojed December 22, 2023 21:03
@jnumainville jnumainville changed the title Matplotlib keytable fix: Matplotlib input table and execution context not working Dec 22, 2023
@jnumainville jnumainville marked this pull request as ready for review December 22, 2023 21:10
@jnumainville jnumainville merged commit ab8cc67 into deephaven:main Dec 22, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants