18
$\begingroup$

Consider the code

a = Table[BesselJ[i, x], {i, 0, 3}]
Plot[a, {x, 0, 20}, Axes -> False]

producing

enter image description here

I'd like to transform the plot into a circle. In other words, I'd like to wrap the plot around a circle.

I found PolarPlot[{1, 1 + 1/10 Sin[10 t]}, {t, 0, 2 Pi}] producing

enter image description here

which looks like a sin curve wrapped around the circle.

I know that the result would not be smooth closed, but no problem.

$\endgroup$
3
  • 2
    $\begingroup$ c[x_] := Table[BesselJ[i, x], {i, 0, 3}]; PolarPlot[ 3 + # & /@ c[10 t], {t, 0, 2 Pi}] $\endgroup$ Oct 30, 2014 at 23:27
  • $\begingroup$ @belisarius, perfect! Since I'll use 4 colours to each graph, how to pass the colours to PolarPlot? I tried PlotStyle but no success. $\endgroup$
    – Sigur
    Oct 30, 2014 at 23:30
  • $\begingroup$ Why closing vote? $\endgroup$
    – Sigur
    Oct 31, 2014 at 14:15

2 Answers 2

20
$\begingroup$

Update

ticks[x1_, x2_] := {#/10 + π/2, #} & /@ 
  FindDivisions[{10 (x1 - π), 10 (x2 - π)}, 20]

funcs = Table[3 + BesselJ[i, 10 (x -π/2)], {i, 0, 3}];
PolarPlot[funcs // Evaluate, {x, -π/2, 3π/2}, 
    PolarAxes -> Automatic,
    PolarTicks -> {ticks[0, 2 π][[2 ;; -2]], Automatic}
] (*thanks @kguler 's and @rm-rf 's advice*)

enter image description here

Manipulate version

Manipulate[
 funcs = Table[a BesselJ[i, 10 (x -π/2)] + b, {i, 0, n}];
 PolarPlot[funcs // Evaluate, {x, -π/2, 3π/2},
  Axes -> False] , {{n, 4}, 1, 10}, {{a, 1}, 0, 3}, {{b, 3}, 1, 5},
 ControlType -> {Automatic, VerticalSlider, VerticalSlider},
 ControlPlacement -> { Top, Left, Left}]

enter image description here

Original

funcs = Table[3 + BesselJ[i, 10 x], {i, 0, 3}]
PolarPlot[Evaluate@funcs, {x, 0, 2 π}] (* thanks @kguler's advice *)

Blockquote

$\endgroup$
5
  • $\begingroup$ FOr v9 you need to use PolarPlot[Evaluate@funcs, {x, 0, 2 \[Pi]}] to get separate colors. (+1) $\endgroup$
    – kglr
    Oct 30, 2014 at 23:40
  • $\begingroup$ Nice! I'm trying to plot my graphs on a symmetric range around zero (for example, {x,-10,10}) and then I'd like the middle part pointing to north, that is, f(0) onto the vertical axis. $\endgroup$
    – Sigur
    Oct 30, 2014 at 23:46
  • 1
    $\begingroup$ @Sigur Try this: PolarPlot[funcs /. x -> y - π/2 // Evaluate, {y, 3π/2, -π/2}] $\endgroup$
    – rm -rf
    Oct 30, 2014 at 23:53
  • $\begingroup$ @rm-rf, thanks. It works. The constant circle was confusing me :) $\endgroup$
    – Sigur
    Oct 30, 2014 at 23:57
  • $\begingroup$ Well, if we change a little bit the domain we can do it symmetric from the north to the south. $\endgroup$
    – Sigur
    Oct 31, 2014 at 0:44
16
$\begingroup$
Composition[
   {#, Scale[#, {-1, 1}, {0, 0}]} &,
   Rotate[#, Pi/2, {0, 0}] &,
   First
   ] /@ Table[
   With[{root = FindRoot[D[BesselJ[i, x], x], {x, 100}][[1, 2]]},

    PolarPlot[{1 + BesselJ[i, t root/Pi]}, {t, 0, Pi}, 
     PlotStyle -> {Thick, Blend["AvocadoColors", i/15]}]
    ]
   , {i, 0, 15}] // 
 Graphics[#, ImageSize -> 500, Background -> Orange] &

enter image description here

$\endgroup$
5
  • $\begingroup$ @JunhoLee I find yours better bacause it is shorter :) Thanks, well, one could probably argue about colors :P p.s. I like the gradient in background which isn't there :) $\endgroup$
    – Kuba
    Oct 31, 2014 at 0:39
  • $\begingroup$ @Kuba, amazing. Very beautiful. Since I'm doing a logo, unfortunately I can not use yours. But thanks for some idea. $\endgroup$
    – Sigur
    Oct 31, 2014 at 0:41
  • 2
    $\begingroup$ Now I know how they designed Amidala's hair. $\endgroup$
    – Öskå
    Oct 31, 2014 at 1:10
  • $\begingroup$ @Öskå It's not easy to be hairdresser there days :P $\endgroup$
    – Kuba
    Oct 31, 2014 at 1:13
  • 1
    $\begingroup$ @Kuba Not to mention how hat it was during Bessel's time-frame en.wikipedia.org/wiki/Friedrich_Bessel#mediaviewer/… $\endgroup$ Oct 31, 2014 at 3:21

Your Answer

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

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