PlutoPlotly : Image trace is not shown

Hi,

I would like to use Pluto.jl(v0.19.26) and PlutoPlotly.jl(v0.3.7) to overlay images and graphics, but the image trace does not display well. Other traces such as scatter and heatmap display fine.

using PlutoPlotly

# ok
plot(heatmap(;x = [1, 2, 3, 4, 5], y = [1, 2, 3], z = rand(3,5)))

# error
plot(image(;z = rand(3,5,3)*255))

The combination of Jupyter and PlotlyJS.jl displays the image trace correctly.

Please let me know if you know where the cause is.

julia> versioninfo()
Julia Version 1.8.1
Commit afb6c60d69a (2022-09-06 15:09 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 16 × Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 6 on 16 virtual cores
Environment:
  JULIA_NUM_THREADS = 6
  DYLD_LIBRARY_PATH = /usr/local/opt/suite-sparse/lib:

With an uppercase P, it works
Plot(image(;z = rand(3,5,3)*255)).

Worth filing an issue, since it is unexpected.
It looks like PlutoPlot does not see that the result of Plot(image(... is simple enough for Pluto.

Thank you for your response.

I tried the PlotlyBase.Plot() you suggested, and the image is displayed correctly although the axis settings are different from plot().

I will register the issue later.

Thank you very much for your help.

1 Like

Hey @kemu

Thanks for spotting this issue.

PlutoPlotly internally preprocess the data contained in the plot in order to make it compatible with publish_to_js from Pluto.

The error there was because there was no proper method to preprocess 3D array.
This should have been fixed with Add _preprocess method for Arrays with more than 2 dimensions by disberd · Pull Request #17 · JuliaPluto/PlutoPlotly.jl · GitHub and I already pushed a new patch version which hopefully fix the issue.

Let me know if things work fine with PlutoPlotly v0.3.8

2 Likes

Thanks for fixing the problem.

I checked it immediately with v.0.3.8 and it works as expected.
Pluto and PlutoPlotly.jl are important tools in my research. I am very grateful for their development.

2 Likes