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

Subplots not appearing #128

Closed
ashleightrinh opened this issue Jul 11, 2017 · 9 comments
Closed

Subplots not appearing #128

ashleightrinh opened this issue Jul 11, 2017 · 9 comments

Comments

@ashleightrinh
Copy link

I have multiple matrices I want to plot in a column. Despite using similar code as in the subplots section it does not appear when I combine them, as shown:

p1 = plot(t, g1);
p2 = plot(t, g2);
p3 = plot(t, g3);
[p1, p2, p3]

After typing that into the terminal this is the result I get is

3-element Array{Plots.Plot{Plots.PlotlyJSBackend},1}:
 Plot{Plots.PlotlyJSBackend() n=6}
 Plot{Plots.PlotlyJSBackend() n=6}
 Plot{Plots.PlotlyJSBackend() n=6}

and no plot appears.

I am using Plots with the plotlyjs() backend.

@sglyon
Copy link
Member

sglyon commented Jul 11, 2017

Hi @ashleightrinh thanks for coming here!

The issue here is somewhat subtle: the [p1, p2, p3] syntax only works when you use PlotlyJS.jl directly. In order to create subplots using Plots.jl you need to tap into the layout functionality offered by Plots.jl (documentation here).

Hopefully that helps!

@ashleightrinh
Copy link
Author

Hi @sglyon thank you for responding so promptly!

I've tried it again using PlotlyJS.jl and now I do get a plot window opening but for some reason all the plots are empty.

Previously when I tried the layout method offered by Plots.jl it got really complicated since each of my individual data sets (g1, g2, etc.) has 6 lines to plot but they all get plotted in separate subplots rather than each set of data in one subplot each.

Thank you for the help!

@sglyon
Copy link
Member

sglyon commented Jul 12, 2017

Hmm that's odd. Could you please post a sample of the t and g1 variables so I can try it out myself?

If the data are sensitive you could just create a random data set of the same type as the original objects.

@ashleightrinh
Copy link
Author

ashleightrinh commented Jul 12, 2017

Hi, so the code is quite long so I will attach it as a word document and can be copied and pasted.
It's a function so I don't know how to extract just t and g1.

@ashleightrinh
Copy link
Author

Sorry, I thought close and comment meant close the window.

@sglyon
Copy link
Member

sglyon commented Jul 13, 2017

No problem.

I don't have word on my computer.

I should be able to tell everything that I need just from the types of t and g1

Could you instead just post the types of these two variables. You can use the typeof function to get that info

@ashleightrinh
Copy link
Author

Ok, so g1 is an Array{Float64,2} and t is an Array{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},1}.

@sglyon sglyon closed this as completed in b802e4e Jul 13, 2017
@sglyon
Copy link
Member

sglyon commented Jul 13, 2017

Hey @ashleightrinh thank you for that.

It turns out this was an issue within PlotlyJS that I've just fixed with the previous commit.

If you do Pkg.checkout("PlotlyJS") and then try your plotting code again it should work now.

Today I will tag a new release with METADATA.jl. This means if you wait a few hours you can do Pkg.update() instead and your example will work with the released version of this package.

I'll try to remember to post here when METADATA is updated.

@sglyon
Copy link
Member

sglyon commented Jul 13, 2017

The METADATA PR has been merged: JuliaLang/METADATA.jl#10250 (comment)

You can now just do Pkg.update() to get the version of PlotlyJS.jl where you could should work. If it doesn't work after updating please respond here!

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