3
$\begingroup$

I have a set of coordinates(Table[{n, Sqrt[n]}, {n, 100}]), which I then converted to polar coordinates, and I want to plot them, but the following code doesn't seem to work.

g = CoordinateTransformData["Cartesian" -> "Polar", "Mapping", #] & /@
   Table[{n, Sqrt[n]}, {n, 100}];
ListPolarPlot[g, PolarGridLines -> Automatic, 
 PlotRange -> {{-2, 2}, {-2, 2}}]

enter image description here

Do all points fully display in the polar coordinate system? For example, the last point of g: $\{ \left.10 \sqrt{101},\tan ^{-1}\left(\frac{1}{10}\right)\right\}$

How to ensure that all points are fully displayed in a polar coordinate system?


Edits: By the cvgmt's answer, we made the following modifications.

g1 = Map[Reverse, g, {1}]; 
ListPolarPlot[g1, PolarGridLines -> Automatic, PlotRange -> 200]

enter image description here

$\endgroup$
3
  • $\begingroup$ You have to adopt the plot range to the points you want to display. E.g. g[[-1]]={100.499, 0.0996687} $\endgroup$ Feb 24, 2023 at 8:27
  • 2
    $\begingroup$ The structure of data should be ListPolarPlot[{{θ1, r1}, {θ2, r2}, {θ3, r3}}],not ListPolarPlot[{{r1, θ1}, {r2, θ2}, {r3, θ3}}] $\endgroup$
    – cvgmt
    Feb 24, 2023 at 8:31
  • 1
    $\begingroup$ g1 = Reverse[g, {2}] also work. $\endgroup$
    – cvgmt
    Feb 24, 2023 at 10:02

1 Answer 1

4
$\begingroup$
  • According to the document of ListPolarPlot, we need to use ListPolarPlot[{{θ1, r1}, {θ2, r2}, {θ3, r3}}].
  • To demenstrate this,here we only plot {10 Sqrt[101], ArcTan[1/10]}.
{θ, r} = 
 CoordinateTransformData["Cartesian" -> "Polar", 
  "Mapping", {100, Sqrt[100]}]

ListPolarPlot[{{θ, r}}, PolarGridLines -> Automatic, PlotRange -> .2]

enter image description here

$\endgroup$
2
  • $\begingroup$ it's a (+1) from me. good job as always. do you know why it evaluated the wrong structure of the data? seems a bit odd, doesn't it? $\endgroup$
    – bmf
    Feb 24, 2023 at 9:21
  • $\begingroup$ @bmt Thanks! Since the original Cartesian data {n, Sqrt[n]} are on a parabola {x,Sqrt[x]}, the final result should be also a parabola. $\endgroup$
    – cvgmt
    Feb 24, 2023 at 9:27

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.