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

Usage of API functions, how does they work in Julia 1.2.0? #305

Closed
crash-crush opened this issue Dec 18, 2019 · 5 comments
Closed

Usage of API functions, how does they work in Julia 1.2.0? #305

crash-crush opened this issue Dec 18, 2019 · 5 comments

Comments

@crash-crush
Copy link

Hello,

I have tried several Julia Plotting Packages in order to update a heatmap in runtime. Therefore I found these function from the API, but I didn't got them to work to test them out. And furthermore I don't know yet how to see the possible attributes of the functions and in which way I can set them to any value?
http://spencerlyon.com/PlotlyJS.jl/manipulating_plots/
I tried react! but probably wrong.

Thanks for help.

@sglyon
Copy link
Member

sglyon commented Dec 18, 2019

Hi @crash-crush thanks for posting.

Could you provide a small code snippet that demonstrates what you've tried. That will give us a starting point to figure out how to help!

@crash-crush
Copy link
Author

Ok. Thanks for the fast response. Its important for winning people to the julia community :)

Here I go what I have tried and what I have wanted(I think it's clear from the "not- working- code")

using PlotlyJS
using Plotly

plot(heatmap(z=rand(100,100)))
Plotly.plot(heatmap(z=rand(100,100)))  
#till here everything wents great just an aspect-ratio of 1 would be wishable.
#then I have tried with some errors occuring the react! function

react!(plot(heatmap(z=rand(100,100)))) #error 
Plotly.react!(heatmap(z=rand(100,100))) #error 

Furthermore I wanted to put these into a for loop to get a live view from processing for approximately 1*10^6 to 10^9 steps

Thanks in advance.

@sglyon
Copy link
Member

sglyon commented Dec 18, 2019

This should work...

using PlotlyJS

p = plot(heatmap(z=rand(100,100)))
restyle!(p, z=[rand(100, 100)])

The react! function is used when you are changing both the traces and layout. When you only want to change one or more traces, the restyle! function is a bit easier to work with.

Note that when calling restyle! you need to wrap the new data in a container like an array or a tuple. This is because restyle! is meant to be able to change the data for more than one trace. To distinguish which traces gets which new data, plotly will index into the container.

@crash-crush
Copy link
Author

Thank thats works, even in a for loop but pretty slow.
How can I in addition to this ,because it would be the same type of structure manipulating, get an aspect ratio of 1, also quadratic matrix element representation?
Is there something like annotate structure attributes like
p.aspect_ratio=1

and how can I list the possible attributes?

@sglyon
Copy link
Member

sglyon commented Dec 18, 2019

I'm not sure how to fix the aspect ratio... perhaps the width and height in the layout?

You can see a full list of everything configurable here: https://plot.ly/javascript/reference/

I'm going to close the issue as I think we've resolved the original problem

@sglyon sglyon closed this as completed Dec 18, 2019
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