KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

Heatmap #196

Closed fipelle closed 4 years ago

fipelle commented 4 years ago

Hi,

I am having some troubles understanding how heatmaps work with PGFPlotsX.jl.

I am trying to plot the following matrix

# Packages
using Random;
Random.seed!(1);

# Matrix
A=zeros(10,3);
A[rand(1:30,10)].=rand(0:0.0000001:1,10);
A[1,1]=1;

via

# Packages
using PGFPlotsX;

# Heatmap
@pgf Axis(
    {
        view = (0, 90),
        colorbar, "colormap/jet",
    },
    Plot3(
    {
       surf,
       shader = "flat",
    },
    Coordinates(1:3, 1:10, A')
    )
)

Considering that A[1,1]=1 I would expect to have a red entry in the heatmap. However, it does not show in the chart (see attached). Can you please take a look at it?

heatmap
KristofferC commented 4 years ago

The color is probably the mean of the values in A[1,1], A[1,2], A[2,2]; A[2,1] which is the vertices of the lower left quad.

KristofferC commented 4 years ago

You can use the shader=interp to see that the value at [1,1] is 1:

image

Closing since it doesn't seem like a problem with the package.