# PlutoPlotly : Image trace is not shown

**URL:** https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699
**Category:** General Usage
**Tags:** pluto, plotlyjs
**Created:** [June 22, 2023, 12:45pm UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699 "2023-06-22T12:45:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kemu](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kemu](https://discourse.julialang.org/u/kemu)
#### Post date: [June 22, 2023, 12:45pm UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699/1 "2023-06-22T12:45:16Z")

</div>

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.

```julia
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))

```

 ![Screen Shot 2023-06-22 at 21.16.54](https://global.discourse-cdn.com/julialang/original/3X/6/3/63b2950a499b5d59e663d53c0d6fec78a7d28918.jpeg)

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:

```

---

<div class="post-metadata">

### Author: ![ederag](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ederag/32/4106_2.png) [@ederag](https://discourse.julialang.org/u/ederag)
#### Post date: [June 22, 2023, 3:31pm UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699/2 "2023-06-22T15:31:11Z")

</div>

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

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/c/9cfb4a3c1a13ec466a74b6f6f2da845985bd7337.png)

Worth [filing an issue](https://github.com/JuliaPluto/PlutoPlotly.jl/issues), since it is unexpected.  
It looks like [`PlutoPlot`](https://github.com/JuliaPluto/PlutoPlotly.jl/blob/7ab9f04d16f66370a4a15b36a5946fa0f96cdbae/notebooks/wrapper.jl#L622C1-L625) does not see that the result of `Plot(image(...` is simple enough for Pluto.

---

<div class="post-metadata">

### Author: ![kemu](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kemu](https://discourse.julialang.org/u/kemu)
#### Post date: [June 23, 2023, 12:24am UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699/3 "2023-06-23T00:24:23Z")

</div>

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()`.

 ![Screen Shot 2023-06-23 at 9.15.11](https://global.discourse-cdn.com/julialang/original/3X/f/f/ff4a7945a3edaa8091d804fcce05016de6c0cffb.png)

I will register the issue later.

Thank you very much for your help.

---

<div class="post-metadata">

### Author: ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)
#### Post date: [June 25, 2023, 2:57pm UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699/4 "2023-06-25T14:57:18Z")

</div>

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](https://github.com/JuliaPluto/PlutoPlotly.jl/pull/17) 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

---

<div class="post-metadata">

### Author: ![kemu](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kemu](https://discourse.julialang.org/u/kemu)
#### Post date: [June 26, 2023, 2:41am UTC](https://discourse.julialang.org/t/plutoplotly-image-trace-is-not-shown/100699/5 "2023-06-26T02:41:37Z")

</div>

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.
