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

[Cannot update data using react!] #495

Closed
jake-w-liu opened this issue Jan 9, 2025 · 5 comments
Closed

[Cannot update data using react!] #495

jake-w-liu opened this issue Jan 9, 2025 · 5 comments

Comments

@jake-w-liu
Copy link

jake-w-liu commented Jan 9, 2025

Julia version 1.11

I am not sure I'm doing the right thing or not...
If I have created a plot with the following code, and want to update the y-data, what I expect is that the updated figure is displayed. However, what I get is still the original data point (which is y = [1, 4, 7] in this example)

using PlotlyJS
x = [1, 2, 3]
y = [1, 4, 7]
tr = scatter(x=x, y=y,)
fig = plot(tr)

# change data
fig.plot.data[1][:y][3] = 0 # == y[3] = 0
react!(fig.plot, fig.plot.data, fig.plot.layout)
display(fig)

Thanks in advance!
newplot

@jake-w-liu
Copy link
Author

I'm also not sure is "redraw!" the same as "react!"
this seems not included in the API examples in:
http://juliaplots.org/PlotlyJS.jl/stable/api/

@mzaffalon
Copy link
Contributor

@jake-w-liu how did you solve it?

@jake-w-liu
Copy link
Author

react!(fig.plot, fig.plot.data, fig.plot.layout)

Hi, I found out that the correct method of using react! is

react!(fig, fig.plot.data, fig.plot.layout)

not

react!(fig.plot, fig.plot.data, fig.plot.layout)

It's my mistake haha... But I'm not sure why there isn't a method error.

@mzaffalon
Copy link
Contributor

Thank you for the answer. What about opening a bug report?

@mzaffalon
Copy link
Contributor

Bug report here: #497

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

No branches or pull requests

2 participants