Running the last part of that example gives me an error:
The latex command `lualatex jl_FXPARL.tex` failed
error(::String) at error.jl:33
savepdf(::String, ::TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Array{String,1}, run_count::Int64, tmp::String) at tikzdocument.jl:197
savepdf at tikzdocument.jl:158 [inlined]
savesvg(::String, ::TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Array{String,1}, keep_pdf::Bool) at tikzdocument.jl:267
savesvg at tikzdocument.jl:266 [inlined]
save(::String, ::TikzDocument; include_preamble::Bool, latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Array{String,1}, dpi::Int64, showing_ide::Bool) at tikzdocument.jl:84
(::PGFPlotsX.var"#save##kw")(::NamedTuple{(:showing_ide,),Tuple{Bool}}, ::typeof(PGFPlotsX.save), ::String, ::TikzDocument) at tikzdocument.jl:73
#save#60 at tikzpicture.jl:34 [inlined]
save at tikzpicture.jl:34 [inlined]
#save#55 at axislike.jl:45 [inlined]
(::PGFPlotsX.var"#save##kw")(::NamedTuple{(:showing_ide,),Tuple{Bool}}, ::typeof(PGFPlotsX.save), ::String, ::Axis) at axislike.jl:45
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol("image/svg+xml")}, ::Axis) at tikzdocument.jl:289
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Axis) at multimedia.jl:109
displayinplotpane(::Axis) at showdisplay.jl:67
displayandrender(::Axis) at showdisplay.jl:131
(::Atom.var"#208#213"{String})() at eval.jl:136
#invokelatest#1 at essentials.jl:712 [inlined]
invokelatest at essentials.jl:711 [inlined]
macro expansion at dynamic.jl:24 [inlined]
eval(::String, ::Int64, ::String, ::String, ::Bool) at eval.jl:113
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at essentials.jl:712
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at essentials.jl:711
macro expansion at eval.jl:41 [inlined]
(::Atom.var"#188#189")() at task.jl:358
Searching on “matrix plot” I found another example at
here, the line
rand(RGB{Float64}, 20, 20)
seems to plot a random matrix, but I am not sure how to convert from :red to RGB{Float64}.
Normally RGB has 3 values: red, green and blue. Those range from 0 to 255. If you want to have an RGB value for a completely red pixel, this would result in (255, 0, 0). These values need to be normalised between 0 and 1 (= 256 discrete values) to work with Colors.jl. This can easily be done by dividing the RGB integer value between 0-255 by 255, resulting in a floating point number between 0 and 1.
For the above example to work, you need to add Colors (Colors.jl docs) and use it. Then go ahead and run the example img = rand(RGB{Float64}, 20, 20), this will result in a randomly colored matrix. You can then plot this with your desired tools (e.g. PGFPlotsX as in the post you linked). I’ve just tested with Plots.jl ( plot(img) )and it worked perfectly fine.
Edit: And just to make this fully clear, here’s your initial example:
julia> using Colors
julia> using Plots
julia> color_matrix = [RGB(255/255,0,0) RGB(255/255,0,0); RGB(255/255,0,0) RGB(0,0,255/255)]
2Ă—2 Array{RGB{Float64},2} with eltype RGB{Float64}:
RGB{Float64}(1.0,0.0,0.0) RGB{Float64}(1.0,0.0,0.0)
RGB{Float64}(1.0,0.0,0.0) RGB{Float64}(0.0,0.0,1.0)
julia> plot(color_matrix)