InspectDR.jl
InspectDR.jl copied to clipboard
error with Plots gui()
At the line I call gui(), I got the following errors. I can't seem to reproduce it with a demo script. Not sure what is wrong. If I comment out the gui() line, then there is no error and also no plot.
ERROR: TypeError: in #_add, in typeassert, expected String, got Array{String,1}
Stacktrace:
[1] (::getfield(InspectDR, Symbol("#kw##_add")))(::NamedTuple{(:id,),Tuple{Array{String,1}}}, ::typeof(InspectDR._add), ::InspectDR.Plot2D, ::Array{Float64,1}, ::Array{Float64,1}) at ./none:0
[2] _series_added(::Plots.Plot{Plots.InspectDRBackend}, ::Plots.Series) at /home/user/.julia/packages/Plots/EJpx2/src/backends/inspectdr.jl:294
[3] _before_layout_calcs(::Plots.Plot{Plots.InspectDRBackend}) at /home/user/.julia/packages/Plots/EJpx2/src/backends/inspectdr.jl:433
[4] prepare_output(::Plots.Plot{Plots.InspectDRBackend}) at /home/user/.julia/packages/Plots/EJpx2/src/plot.jl:254
[5] display at /home/user/.julia/packages/Plots/EJpx2/src/output.jl:144 [inlined]
[6] gui(::Plots.Plot{Plots.InspectDRBackend}) at /home/user/.julia/packages/Plots/EJpx2/src/output.jl:134 (repeats 2 times)
Sorry, it is very difficult to reproduce this issue without an example.
If I take your example from #15:
using Plots
inspectdr()
# gr()
function testPlot()
P1 = plot(Plots.fakedata(50,5))
P2 = plot(Plots.fakedata(50,5))
plot(P1, P2, layout=(2,1), size=(1200,600))
gui()
end
I could imagine that you might have tried to label those plots with a title, for example:
plot(P1, P2, layout=(2,1), size=(1200,600), title=["A" "B"])
Note that I needed a row vector (not the default column vector) to get this to work. This is sort of non-intuitive given that your layout is more of a column vector.
...But I think that this is part of the issue with the flexibility of the Plots.jl module. It is not bounded to layouts that are on a simple grid... so the API must reflect that, somehow.
Of course, I am not certain if I am adressing your issue at all - I am sorry about that. I really would need sample code to reproduce your issue.
My mistake I guess because I passed a label to each plot with a Array{String,1}, as
P2 = plot(Plots.fakedata(50,5), label=["fake"])
But this was tolerated by GR.
if I do it with just a string, then there is no problem:
P2 = plot(Plots.fakedata(50,5), label="fake")
Hmm.... I wonder if backends are supposed to support this...
I suggest to close this. Labels should be of type string.
Agreed. This seems to be just how Plots.jl works.