1
$\begingroup$

I have a List of Temperature Values ranging from r=0, to rmax at different value of z. Currently, the only contour plot I can make is an r-z plot. I have been able reverse the data to produce a plot that ranges from {-rmax, rmax}, but I think it would be more effective to show an r-theta plot at z=10. At each r, the Temperature value should be identical from 0 to 2pi, giving me perfect rings. Since, I do not have any theta values, what is the best was for me to create this plot?

r-z Contour Plot

edit: I have created some data similar to the situation I have. The numbers arent exactly the same, but I tried to replicate them as well as possible.

    rmax = 6;
    zmax = 10;

    T = Table[0, {r, 1, rmax}, {z, 1, zmax}];

    T[[All, All]] = {{482.076, 482.075, 482.070, 482.0625, 482.051, 
482.038, 482.023, 482.005, 481.9873, 481.967}, {482.084, 482.083, 
482.0784, 482.0705, 482.059, 482.0464, 482.030, 482.013, 481.995, 
481.978}, {482.109, 482.107, 482.102, 482.094, 482.083, 482.069, 
482.053, 482.035, 482.017, 481.999}, {482.149, 482.147, 482.142, 
482.134, 482.122, 482.108, 482.0915, 482.072, 482.051, 
482.031}, {482.204, 482.202, 482.197, 482.189, 482.177, 482.162, 
482.144, 482.123, 482.099, 482.074}, {482.274, 482.272, 482.267, 
482.259, 482.247, 482.231, 482.212, 482.189, 482.161, 482.130}};

    ListContourPlot[Transpose[T]]
$\endgroup$
  • $\begingroup$ Where's your data? $\endgroup$ – Feyre Oct 21 '16 at 20:22
  • $\begingroup$ Can you provide the code? I am not sure if I understand the question... If you just want to plot rings, you could use ParametricPlot. $\endgroup$ – anderstood Oct 21 '16 at 20:23
2
$\begingroup$

When I understood you correctly, you have for each value of z a list of temperatures. Since you haven't provided data, let us create some fake ones

data = Table[Sin[r]*(2 - Cos[z]), {z, 0., 1/2, 1/19}, {r, 0, Pi/2, Pi/(2*19)}];
ListContourPlot[data]

Mathematica graphics

Now the only missing piece is that you have to make a coordinate transformation. ContourPlot will always use Cartesian coordinates x and y, but what you want to have is for each {x,y} the radius. Centering the origin in the middle, this is easy because you are just calculating the Euclidean distance like in school

$$ r= \sqrt{x^2+y^2}.$$

Indeed, this formula is part of the transformation to polar coordinates.

Since you have only a list of temperatures for some r, we will interpolate the places in between and then, we can put this together and use ContourPlot as usual. Then you have it, a Manipulate that gives you the contour plot you like for a chosen z:

Manipulate[
 With[{ip = ListInterpolation[data[[z]]]},
  ContourPlot[
   With[{r = Sqrt[x^2 + y^2]}, ip[Min[20, r]]],
   {x, -20, 20}, {y, -20, 20}, 
   RegionFunction -> Function[{x, y}, Sqrt[x^2 + y^2] < 20],
   BoundaryStyle -> {Thick, Red}
   ]
  ],
 {z, 1, Length[data], 1}
 ]

Mathematica graphics

| improve this answer | |
$\endgroup$
  • $\begingroup$ This is exactly what I needed! I appreciate all your help :D $\endgroup$ – Pfab Oct 23 '16 at 17:40
1
$\begingroup$

This is admittedly a bit resource intensive:

Some data dependent on r:

data = Table[r^2 - Sin[2 Pi r]^2, {r, -3, 3, 0.01}];

Generate the full array:

array = Table[{i/100, j/100, 
    data[[Round[Sqrt[i^2 + j^2 + 300]]]]}, {i, -200, 200}, {j, -200, 
    200}];
ListContourPlot[Flatten[array, 1]]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ may be a little better to use Interpolation instead of Round $\endgroup$ – george2079 Oct 21 '16 at 20:59
  • $\begingroup$ @george2079 You're right, halirutan used Interpolation now, so I'll just leave it. Can't be bothered to alter anyway if the OP doesn't even come back to update his own question. $\endgroup$ – Feyre Oct 22 '16 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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