Plots.jl: Heatmap using non-numeric (categorical) colormaps

Created on 25 Apr 2016  路  18Comments  路  Source: JuliaPlots/Plots.jl

I want to include in MIToS some visualization for Multiple Sequence Alignments like alignfigR.
Is there a way with Plots to do a heatmap like plot for categorical variables?

Most helpful comment

Good progress!

tmp

All 18 comments

This works right now on the tb_pyplot branch:

tmp

I were asking for a case where z is the categorical/grouping variable.

I'm not sure I understand. (Your link doesn't work... maybe fixing that would help explain?)

So really what you're asking is if the colormap can have non-numeric data as it's values? I don't think it's possible out of the box... it's on the list.

Exactly, I renamed the issue ;) Thanks!

Note: here's one possible method for pyplot: https://gist.github.com/jakevdp/8a992f606899ac24b711

Getting closer:

tmp

I want to accept a Plots.ColorVector which makes it a discrete colormap. Right now it only accepts a Plots.ColorGradient with a continuous colormap. It works though! (sort of)

Good progress!

tmp

That looks really great!

I'm getting the following error with axiscolor=nothing and also with border=nothing

heatmap(ys,xs,z',yflip=true, grid=false, ratio=:equal, axiscolor=nothing)
MethodError: `convertColor` has no method matching convertColor(::Void)
Closest candidates are:
  convertColor(::Any, !Matched::Real)
  convertColor(::Any, !Matched::Void)

 in getPyPlotColor at /home/dzea/.julia/v0.4/Plots/src/backends/pyplot.jl:91
 in updateAxisColors at /home/dzea/.julia/v0.4/Plots/src/backends/pyplot.jl:849
 in finalizePlot at /home/dzea/.julia/v0.4/Plots/src/backends/pyplot.jl:1062
 in writemime at /home/dzea/.julia/v0.4/Plots/src/backends/pyplot.jl:1108
 in writemime at /home/dzea/.julia/v0.4/Plots/src/output.jl:118
 in writemime at multimedia.jl:43
 in sprint at iostream.jl:206
 in display_dict at /home/dzea/.julia/v0.4/Plots/src/Plots.jl:280

Also I'm getting the following error:

@show z'
heatmap(z', yflip=true, grid=false, ratio=:equal)
z' = ASCIIString["B" "C" "A" "B" "B" "C" "C" "A" "A" "A" "A" "C" "C" "B" "B"
            "A" "C" "C" "B" "B" "C" "C" "A" "A" "B" "A" "A" "A" "C" "C"
            "B" "A" "C" "A" "B" "B" "A" "C" "B" "C" "B" "C" "B" "C" "C"
            "C" "A" "C" "B" "B" "A" "B" "B" "B" "A" "A" "C" "C" "A" "B"]
LoadError: type Void has no field surf

Why am I seeing blue lines with the recipe?

image

I think these issues are solved now?

Yes, It's solved :D Thanks @tbreloff !

image

I can't replicate this example from above.

n,m = 15,4
xs = [string("x",i) for i=1:n]
ys = [string("y",i) for i=1:m]
z = rand(["A","B","C"], n, m)
heatmap(xs, ys, z, yflip=true, c=[:red :blue :green])

image

Any idea?

Does it work with the pyplot backend?

I can't test PyPlot in my machine at the moment, but think I figured out the problem.

n,m = 15,4
xs = [string("x",i) for i=1:n]
ys = [string("y",i) for i=1:m]
z = rand(["A","B","C"], n, m)
heatmap(xs, ys, z, yflip=true, c=cgrad([:red, :blue, :green]))

image

Looks like syntax for color input has changed since the last post where discrete colors aren't allowed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cody-G picture Cody-G  路  4Comments

tbenst picture tbenst  路  3Comments

asinghvi17 picture asinghvi17  路  3Comments

Cody-G picture Cody-G  路  3Comments

apalugniok picture apalugniok  路  3Comments