Closed Ibrokhimsadikov closed 2 months ago
No that isn’t possible in datamapplot. You would want our ThisNotThat library which can do that and has a number of prebuilt widgets to attach to selection callbacks
On Sun, Apr 7, 2024 at 3:20 AM Ibrokhimsadikov @.***> wrote:
I wanted to ask if it is possible to be able to apply lasso selection and on selection another table riw indexes are displayed:
I want something similar to this:
`import dash from dash import html from dash import dcc import dash_table import plotly.express as px from dash.dependencies import Input, Output Sample data
import pandas as pd import numpy as np
np.random.seed(0) df = pd.DataFrame({ "X": np.random.rand(100), "Y": np.random.rand(100), "Z": np.random.choice(["A", "B", "C"], 100) }) Dash app
app = dash.Dash(name)
app.layout = html.Div([ dcc.Graph( id='scatter-plot', figure=px.scatter(df, x='X', y='Y', color='Z') ), dash_table.DataTable( id='data-table', columns=[{"name": i, "id": i} for i in df.columns], data=df.to_dict('records') ) ])
@app.callback( Output('data-table', 'data'), Input('scatter-plot', 'selectedData') ) def update_data_table(selected_data): if selected_data is None: return df.to_dict('records')
selected_points = [point['pointIndex'] for point in selected_data['points']] filtered_df = df.iloc[selected_points]
return filtered_df.to_dict('records')
if name == 'main': app.run_server(debug=True) `
Is it feasible ask?
— Reply to this email directly, view it on GitHub https://github.com/TutteInstitute/datamapplot/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3IUBLPVQU35SWHZTTEVS3Y4DXTHAVCNFSM6AAAAABF3C5WE6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDSNRQGU4DAMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I wanted to ask if it is possible to be able to apply lasso selection and on selection another table riw indexes are displayed:
I want something similar to this:
`
Is it feasible ask?