i have a problem which I could not solve yet because it is rarely discussed in the web. I have a Dataset, representing z-Values (e.g. Qualities 1-7) on distinct points of a circle (center=0,0; x-direction 1/2r and r, y-direction 1/2r and r). The z Values are mirrored in y- and x- direction in this way:

TableForm[{{"", "", "", "", "", ""}, {"", "", "", 3, "", ""}, 
{"", "","", 5, "", ""}, {"", 6, 3, 4, 3, 6}, {"", "", "", 5, "", ""},
{"","", "", 3, "", ""}}, 
TableHeadings -> {{"x", "-r", "-1/2r",0,"1/2r", "r"}, 
{"y", "-r","-1/2r", 0, "1/2r", "r"}}]

I want to display these data as a flat disk in a contour plot (or similar) in 3d comparable to this example but flat and as a disk, where the colors display the z-Value only (colors are already defined-this here shall be a minimal example).

data1 = {"a", {{_, _, 5, _, _}, {_, 1, 2, 1, _}, {7, 3, 1, 3, 7},
{_,1, 2, 1, _}, {_, _, 5, _, _}}}; ListPlot3D[Last[#],
DataRange -> {{-20, 20}, {-20, 20}, {0, 7}}, ColorFunctionScaling ->
False,ImagePadding -> {{10, 10}, {10, 10}}] & /@ {data1}

In a last step I want to stack several of these disks with unique contours in a 3d tower where the z-Axis of the tower displays a 4th parameter similar to this. Here I only build very thin rings but no real disks. Actually a surface contourplot on top of these rings would be sufficient:

Disk10 = ContourPlot3D[x^2 + y^2 == 400, {x, -20, 20}, {y, -20, 20}, 
{z,9.9, 10.0}, Mesh -> None]; 
Disk20 = ContourPlot3D[x^2 + y^2 == 400, {x, -20,20}, {y, -20, 20}, 
{z, 39.9, 40.0},Mesh -> None];
Show[{Disk10, Disk20}, Axes -> True,
AxesOrigin -> {0, 0, 0},
TicksStyle -> 14, PlotRange -> {{-20, 20}, {-20, 20}, {0, 70}}]

Is this possible? Further I would like to add grids along the x- and y- axes in z direction. Is this possible in a 3D plot? Up to now I only created facegrids where a cube-image is the result but here grids along the inside of the disks would be great (a cross would be the result here in my imagination). Many thanks in advance!

I am grateful for all hints and comments.


After testing the data on the newest solution some questions arose. 1. i can use the data with r>1 until it comes to the interpolation. I get the errors:

Interpolation::udeg: Interpolation on unstructured grids is currently 
only supported for InterpolationOrder->1 or InterpolationOrder->All.
Order will be reduced to 1. >>
Interpolation::umprec: Interpolation on unstructured grids is currently 
only supported for machine numbers. The data will be coerced to machine
precision. >>

Jason warned me there would be errors but here the problem is the reduction of all values to 1.) Might this be handled, because later on this causes other mistakes with the original data. 2.) In the last step we stack several disks on basis of the given data set. Originally each disk has its own data set and its own z value but:

HeightStack = Catenate[Table[{#1, #2, z, #3} & @@@ data11, data12,
{z, {1, 3}}]]; ListSliceDensityPlot3D
[HeightStack, {"ZStackedPlanes", {1, 3}}]

doesn`t work. Is the syntax wrong here? 3.) I defined certain colors for #3-values from 1-7 (Qualities) -i defined 7 colors for the 7 Qualities) and want to use them in the Colorfunction of the densityplot instead of the basic colors. Up to this project i always used:

ColorFunction -> (Blend[colors, #3] &),
ColorFunctionScaling -> False

but i get errors combining it with the ListSliceDensityPlot3D. Is this function not possible here, due to the Interpolation function?

Many thanks in advance!

  • $\begingroup$ it isn't clear to me how the points you have listed correspond to a disk. You have these points: i.imgur.com/lFg6ITI.png - how does that map to a disk? Can you say how the 11 nonzero points you have there correspond to {x, y} coordinates of the disk? $\endgroup$
    – Jason B.
    Commented Feb 15, 2016 at 15:37
  • $\begingroup$ Thanks for your answer. The problem here is, that there are z values for distinct points on the disk, as you can find in the table,this is why the rest of the matrix is empty with "". The disk has the diameter r ..in (x and y direction, so no ellipsis - in the 3rd example i chose 400 as diameter). The z values are the numbers in the table. These values are taken at disk center (x=0/y=0) and each 1/2r and r in y and y direction (x=0 and y= 1/2r and r - same for y=0 and x=....). $\endgroup$
    – StephanJ
    Commented Feb 15, 2016 at 15:38
  • $\begingroup$ The star shape comes because the z data in y and x direction is mirrored for -1/2r and -r which have the same z values as the positive direction. So actually what i imagine is getting 2 mirrorred double quarter disks in the end resulting in a full disk whith colored surface displacing the z values. Unfortunatly i did not find any picures for explanation. $\endgroup$
    – StephanJ
    Commented Feb 15, 2016 at 15:38
  • $\begingroup$ To me, disk means circular, but you have data that is more in a diamond shape if I'm not mistaken - the data doesn't fill out the circle and many of the points are inside the circle. And when you have this as a flat object with the z values as colors, do you want to interpolate the color between the various grid points? $\endgroup$
    – Jason B.
    Commented Feb 15, 2016 at 15:40
  • $\begingroup$ Exactly. In your example you displayed the z values 1 as well. These are residues of the plotting because the outer values would disappear if i took these data out. I only got z values along the axis at the given x (and y) values resulting in a bigger L . Mirrored the data forms an X. I would like to interpolate the z values of one axis in form of a quarter disk for each quarter of the disk if possible. Further the z values for i and iii as well as for ii and iV are mirrored. $\endgroup$
    – StephanJ
    Commented Feb 15, 2016 at 15:52

1 Answer 1


It seems to me there are a number of questions here,

  1. How to take a discrete number of values in the first quadrant and reflect them symmetrically into the other three quadrants
  2. How to take this small number of data points and make a circular density plot out of them, when the data points do not fully fill out the circle.
  3. How to take many such circular plots and stack them as disks in a three dimensional graphic.
  4. How to add gridlines to this 3D graphic.

First, let's look at your data. Get rid of all of those underscores, they are not doing you any good. Since your data is sparse, you should arrange it in the form of tuples like {x,y,. Here is your data in the proper form, where I've setr=1`

data1 = {{0, 0}, {1/2, 0}, {1, 0}, {0, 1/2}, {0, 1}, {1/2, 1/2}};

Now we can get to work on your questions.

1. Mirroring the data into other quadrants

I'm going to use pure functions to map the data into the other quadrants:

data2 = Join[
   data1, {-#1, #2, #3} & @@@ data1, {-#1, -#2, #3} & @@@ 
    data1, {#1, -#2, #3} & @@@ data1] // DeleteDuplicates
(* {{0, 0, 1}, {1/2, 0, 2}, {1, 0, 5}, {0, 1/2, 3}, {0, 1, 
  7}, {1/2, 1/2, 1}, {-(1/2), 0, 2}, {-1, 0, 5}, {-(1/2), 1/2, 
  1}, {0, -(1/2), 3}, {0, -1, 7}, {-(1/2), -(1/2), 1}, {1/2, -(1/2), 
  1}} *)

Here I'll plot the x and y coordinates of the original data (in red) and the mirrored data (in blue),

ListPlot[{Most /@ data2, Most /@ data1}, AspectRatio -> 1, 
 PlotStyle -> {Blue, Red}]

enter image description here

2. Creating a circular density plot

So now that you have your data, let's see what it looks like when we plot it,

Show[ListDensityPlot[data2], Graphics@Circle[]]

enter image description here

You can see that we are going to have to extrapolate to guess what the data will be outside the diamond-shaped region in order to fill out the unit circle. To do this we can make an interpolation function (you will get a warning that Interpolation is limited when the data is on an unstructured grid) and then apply that to a set of points making up the unit disk, with more error messages about the data points being outside the original data range. This last message is serious in my opinion, and seriously calls into question your plan of making a disk-shaped plot when you have data on a diamond-shaped grid, but so be it.

data3 = Module[{func},
   func = Interpolation[{{#1, #2}, #3} & @@@ data2];
   {#1, #2, func[#1, #2]} & @@@ RandomPoint[Disk[], 2000]

Here are the interpolated random points in blue and the original points in red,

ListPlot[{Most /@ data3, Most /@ data2}, AspectRatio -> 1, 
 PlotStyle -> {Blue, Directive[PointSize[Large], Red]}]

enter image description here

And here are density plots of the original and extrapolated data,

ListDensityPlot /@ {data2, data3}

enter image description here

As you can see, the results of extrapolating are a bit sketchy. If you could extend your original data set to include the point {x,y} = {r/Sqrt[2], r/Sqrt[2]} the quality would be vastly improved.

3. Putting this circular plot into 3D, and stacking many such disks

For the 3D plot, I'm going to use ListSliceDensityPlot, and for this I want the data as a list of {x, y, z, f[x,y,z]} tuples. Again we can use a pure function to map create a list of the proper structure. I'll take the data above and give z-values of {1, 3, 7, 12} with the exact same xy data.

data4 = Catenate[
   Table[{#1, #2, z, #3} & @@@ data3
    , {z, {1, 3, 7, 12}}]
ListSliceDensityPlot3D[data4, {"ZStackedPlanes", {1, 3, 7, 12}}]

enter image description here

4. Adding 3D gridlines

So GridLines is not an option for any Graphics3D object. Mr. Wizard, who I used to watch on TV so much as a child, has an answer here on how to do that. I'll just give a brief example and you'll need to adapt it to your needs.

Here I'm putting vertical lines (parallel to z) at each point where there was originally data. It should be straightforward for you to put lines parallel to x and y if you choose,

lines = Line[{{#1, #2, 0.5}, {#1, #2, 12.5}}] & @@@ (Most /@ data2);
Show[ListSliceDensityPlot3D[data4, {"ZStackedPlanes", {1, 3, 7, 12}}],

enter image description here

  • $\begingroup$ Oh, this is a great approach, thanks! $\endgroup$
    – StephanJ
    Commented Feb 15, 2016 at 16:37
  • $\begingroup$ Now we just have to look for a disk shape and if possible grids along the axes. $\endgroup$
    – StephanJ
    Commented Feb 15, 2016 at 16:41
  • $\begingroup$ @StephanJ Is it possible to get the data points at r/Sqrt[2] instead of r/2? That would make it much easier to make a disk. Also if there were more points we could have better interpolation. $\endgroup$
    – Jason B.
    Commented Feb 15, 2016 at 17:24
  • $\begingroup$ Update to the 2nd answer: WOW! Many many thanks. I am again astonished what is possible with this program and with the creativity of yours. I will play around with that solution during the next hours. Unfortunately the data is limited to the given set. I tried to find a possibility for my students to display their data in a proper and pretty way. The idea to create "disks" came after the experimental setup so we sadly cannot get back to the r/sqrt[2] data but many thanks for the hint. In future we will consider that. $\endgroup$
    – StephanJ
    Commented Feb 16, 2016 at 9:43
  • $\begingroup$ @StephanJ - my advice would be to let go of the requirement of the individual slices being disks, because it involves extrapolating outside the region where you actually have data. If you keep the data in the diamond pattern, then you are giving an honest representation of the data. $\endgroup$
    – Jason B.
    Commented Feb 16, 2016 at 12:43

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.