JuliaImages / ImageView.jl

Interactive display of images and movies
MIT License
135 stars 34 forks source link

wrong arrangement of multiple figures in a grid #214

Open szcf-weiya opened 4 years ago

szcf-weiya commented 4 years ago

Hi, I am confused by the arrangement of multiple figures in a grid. I begin with the example code in the README,

gui = imshow_gui((300, 300), (2, 1))  # 2 columns, 1 row of images (each initially 300×300)
canvases = gui["canvas"]
imshow(canvases[1,1], testimage("lighthouse"))
imshow(canvases[1,2], testimage("mandrill"))
Gtk.showall(gui["window"])

it throws an error when accessing canvases[1,2]

julia> imshow(canvases[1,2], testimage("mandrill"))
ERROR: BoundsError: attempt to access 2×1 Array{Any,2} at index [1, 2]

and I check the size of canvases is

julia> size(canvases)
(2, 1)

it seems that the canvases will arrange by column while the gui declares it should be by rows. The following two tries also support my guess.

If I change the indexes for accessing canvases

gui = imshow_gui((300, 300), (2, 1))  # 2 columns, 1 row of images (each initially 300×300)
canvases = gui["canvas"]
imshow(canvases[1,1], testimage("lighthouse"))
imshow(canvases[2,1], testimage("mandrill"))
Gtk.showall(gui["window"])

image

and if I exchange the grid size in imshow_gui

gui = imshow_gui((300, 300), (2, 1))  
canvases = gui["canvas"]
imshow(canvases[1,1], testimage("lighthouse"))
imshow(canvases[1,2], testimage("mandrill"))
Gtk.showall(gui["window"])

image

But I have no idea what happens, my working environment is,

julia> versioninfo()
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

and the versions of my installed packages (I have updated them by running update)

(v1.2) pkg> status
    Status `~/.julia/environments/v1.2/Project.toml`
  [c52e3926] Atom v0.12.9
  [39de3d68] AxisArrays v0.4.2
  [6e4b80f9] BenchmarkTools v0.5.0
  [e2554f3b] Clp v0.7.1
  [5ae59095] Colors v0.11.2
  [861a8166] Combinatorics v1.0.0
  [a2441757] Coverage v1.0.0
  [f68482b8] Cthulhu v1.0.0
  [a93c6f00] DataFrames v0.20.2
  [b4f34e82] Distances v0.8.2
  [31c24e10] Distributions v0.22.5
  [8d5ece8b] GLMNet v0.4.2
  [4c0ca9eb] Gtk v0.18.0
  [7073ff75] IJulia v1.21.1
  [6218d12a] ImageMagick v0.7.5
  [80713f31] ImageSegmentation v1.4.2
  [86fae568] ImageView v0.10.8
  [916415d5] Images v0.22.0
  [6deec6e2] IndexedTables v0.12.6
  [e5e0dc1b] Juno v0.8.1
  [5ab0869b] KernelDensity v0.5.1
  [b964fa9f] LaTeXStrings v1.1.0
  [093fc24a] LightGraphs v1.3.1
  [2f5eb75a] LightGraphsFlows v0.3.1
  [4345ca2d] Loess v0.5.1
  [10e44e05] MATLAB v0.7.3
  [f0f68f2c] PlotlyJS v0.13.1
  [91a5bcdd] Plots v0.29.7
  [c46f51b8] ProfileView v0.6.3
  [438e738f] PyCall v1.91.4
  [d330b81b] PyPlot v2.8.2
  [6f49c342] RCall v0.13.4
  [295af30f] Revise v2.5.4
  [102930c3] SmoothingSplines v0.2.1
  [2913bbd2] StatsBase v0.32.2
  [f3b207a7] StatsPlots v0.14.1
  [5e47fb64] TestImages v0.6.1
  [a759f4b9] TimerOutputs v0.5.3
  [fdbf4ff8] XLSX v0.6.1