From 069bbbc4b2e30fa685591f3ba87021123df040c0 Mon Sep 17 00:00:00 2001 From: Giorgio Calderone Date: Sat, 21 Mar 2020 19:01:19 +0100 Subject: [PATCH] Fix plot "w image" --- src/Gnuplot.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Gnuplot.jl b/src/Gnuplot.jl index 6c1fed1..6a222f7 100644 --- a/src/Gnuplot.jl +++ b/src/Gnuplot.jl @@ -202,7 +202,7 @@ function data2string(args...) return accum end - # Multidimensional, no independent indices + # Multidimensional, no independent 1D indices if firstMultiDim == 1 #@info "Case 2" @assert minimum(lengths) == maximum(lengths) "Array size are incompatible" @@ -210,7 +210,13 @@ function data2string(args...) for CIndex in CartesianIndices(size(args[1])) indices = Tuple(CIndex) (i > 1) && (indices[end-1] == 1) && (push!(accum, "")) # blank line - v = "" # * join(string.(getindex.(Ref(Tuple(indices)), 1:ndims(args[1]))), " ") + if length(args) == 1 + # Add independent indices (useful when plotting "with image") + v = join(string.(getindex.(Ref(Tuple(indices)), 1:ndims(args[1]))), " ") + else + # Do not add independent indices since there is no way to identify the distinguish a "z" array from additional arrays + v = "" + end for iarg in 1:length(args) d = args[iarg] v *= " " * string(d[i])