dgaragones
(David G. Aragonés)
July 12, 2019, 3:59pm
1
I’ve taken this piece of code from the documentation:
data = Table[Sin[i + j], {j, 0, 2 Pi, 0.5}, {i, -1, 1}];
ListDensityPlot[data, Mesh -> All]
I am working in something similar, but I want to make the ListDensityPlot to cover the full rectangle showed in the plot (no white space). Can anyone help me?
Thank you in advance for any help!
data = Table[Sin[i + j], {j, 0, 2 Pi, 0.5}, {i, -1, 1}];
ListDensityPlot[data, Mesh → All, Prolog → {Blue, Rectangle[{-1, -1}, {1, 1}]}]
dgaragones
(David G. Aragonés)
July 12, 2019, 8:59pm
3
Thank you for your answer!
I was thinking about an extension of the interpolation done to cover the full rectangle.
OK. Try by adding corner points to the list:
data = Table[Sin[i + j], {j, 0, 2 Pi, 0.5}, {i, -1, 1}];
corners = {{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}};
ListDensityPlot[Join[data, corners], Mesh -> All]
dgaragones
(David G. Aragonés)
July 13, 2019, 3:59pm
5
Ok, I don’t know why but using InterpolationOrder->0 it works.
Yes, InterpolationOrder->0 does make the plot cover the whole square. But then it looks a bit strange:
dgaragones
(David G. Aragonés)
July 13, 2019, 10:25pm
7
Yes, it’s true. It looks a bit weird. However, in my case study it seems to fit well.
It’d be nice if there were an option to full the rectangle with a higher interpolation order though.