1
$\begingroup$

I have a data set gathered from lab. The measurements are of the form {x, y, z}. I want to plot this data in a way that there is (1) no interpolation between adjacent data points and (2) that is visualised in the form of cubes, i.e. {x, y}, and give the location of the cuboid whilst z gives the height, and then repeat this simply for all data points.

I have tried ListContourPlot and ListDensityPlot with InterpolationOrder -> 0, however I get wierd results. For example, both plots don't show the squares or rectangular patches that I was expecting, instead they seem more triangular.

I have attached an image of a couple of my plots:

enter image description here.

And this is the code that I have used to generate these plots:

GraphicsGrid[{{ListContourPlot[scanDataCh1, Mesh -> None, 
  InterpolationOrder -> 0, PlotRange -> All, 
  ColorFunction -> "Rainbow", 
  FrameLabel -> {"Hem. Voltage (V)", 
  "Elevation Angle \!\(\*SuperscriptBox[\((\), \(o\)]\))", 
  "ListContourPlot for Channel 1"}, ImageSize -> Large], 
ListDensityPlot[scanDataCh1, Mesh -> None, InterpolationOrder -> 0,
  PlotRange -> All, ColorFunction -> "Rainbow", 
  FrameLabel -> {"Hem. Voltage (V)", 
  "Elevation Angle \!\(\*SuperscriptBox[\((\), \(o\)]\))", 
  "ListDensityPlot for Channel 1"}, ImageSize -> Large]}}]

Thanks!

$\endgroup$
2
  • $\begingroup$ ps the data set is rather large so I have not been able to include it in the post $\endgroup$
    – Richard
    Jan 5, 2023 at 16:17
  • 3
    $\begingroup$ Please include a sample of the data. $\endgroup$ Jan 5, 2023 at 16:17

1 Answer 1

2
$\begingroup$

I create some arbitrary sample data for the sake of an example:

hw2 = 0.02;
dat = RandomReal[{0, 1}, {20, 3}];
Graphics3D[{Cuboid[{#[[1]] - hw2, #[[2]] - hw2, 
      0}, {#[[1]] + hw2, #[[2]] + hw2, #[[3]]}]} & /@ dat]

![enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.