Skip to content

[FR] Enable axis manipulation for matrix plots #2814

@TorkelE

Description

@TorkelE

I have the following matrix of colors:

using Plots
test = fill(RGB{Float64}(1,1,1),3,3);
test[1,1] = RGB{Float64}(0,0,0); test[1,2] = RGB{Float64}(0,0,0.5); test[1,3] = RGB{Float64}(0,0,1);
test[2,1] = RGB{Float64}(0.5,0,0); test[2,2] = RGB{Float64}(0.5,0,0.5); test[2,3] = RGB{Float64}(0.5,0,1);
test[3,1] = RGB{Float64}(1.0,0,0); test[3,2] = RGB{Float64}(1.0,0,0.5); test[3,3] = RGB{Float64}(1.0,0,1);
plot([1,2,3],[1,2,3],test)

This gives a plot like
matrix_plot_1

Now imagine if I would want to flip the y-axis, so that the element [1,1] is in the bottom left corner. Intuitevely one would want to do so through

plot([1,2,3],[3,2,1],test)

this, however, gives a weird result:
matrix_plot_2

Furthermore, say that I want a different scale of one axis, e.g.

plot([1,2,3],[0.1,0.2,0.3],test)

this also compresses that axis:
matrix_plot_3
making the figure unreadable. It would be very useful to be able to re-scale the axis, without warping the figure itself.

All these tests are made using Plots 1.3.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions