0

So, I have this function of the polar angle $\theta$, with a varying parameter $t$:

{Cos[\[Theta]] (1 + Sin[t]), Sin[\[Theta]]}

and I want to draw it in a parametric plot, with respect to the angle $\theta$, showing the variation with $t$:

ParametricPlot[ Table[{Cos[\[Theta]] (1 + Sin[t]), Sin[\[Theta]]}, {t, 0, 2 \[Pi], \[Pi]/10}], {\[Theta], 0, 2 \[Pi]},  PlotRange -> {{-2, 2}, {-1.5, 1.5}}]

enter image description here

I need to make this picture with different colours (and/or with thickness) for every different functions of the parameter $t$. For example, I'd like to see a thick black circle with $t=0$, and varying grey thinner ellipses with increasing $t$... The bigger the parameter, the lighter the colour and thinner the lines.

My problem is that I can't include these instructions within the command Table[ ]. When I try to set PlotStyle-> every function of the family changes in the same way!

Thank you all in advance!

AstoundingJB
  • 133
  • 4
  • You need to use Evaluated -> True. Please see the linked question for more details on this behavior – rm -rf Feb 20 '14 at 16:01
  • Ok, thank you to the advice about the command Evaluated. Now the ellipses are also purple and green. Anyway I'm still not able to change colours and sizes of the various lines...! I can't find any help in the answers you pointed me to..! Sorry, I am a newbie to Mathematica! – AstoundingJB Feb 20 '14 at 16:16
  • You already mentioned using PlotStyle so I assumed you were familiar with it. If you don't like the default colors, you need to set the style for each curve in your plot yourself. You can create a color generating function that varies with t the way you want it to (lighter colors for increasing t) and create a table for the colors. – rm -rf Feb 20 '14 at 16:17
  • PlotStyle-> should be inside the Table[ ] command (which is also inside Evaluate[ ]) and vary with $t$. Basically, I can't do this... Is there a way to do this? Can I include the dependence with $t$ or I must define manually the different attributes for each curve? – AstoundingJB Feb 20 '14 at 16:27
  • No, that's not where you use PlotStyle. You need to pass a list of colors separately to PlotStyle after the arguments. Options always come after the required arguments. And yes, you must define the dependence of the colors with t, as otherwise, Mathematica won't know what color you want for which t. – rm -rf Feb 20 '14 at 16:29
  • 1
    Here's an example for you to start on: With[{t = Range[0, \[Pi]/2, \[Pi]/10]}, ParametricPlot[{Cos[\[Theta]] (1 + Sin[#]), Sin[\[Theta]]} & /@ t, {\[Theta], 0, 2 \[Pi]}, PlotRange -> {{-2, 2}, {-1.5, 1.5}}, Evaluated -> True, PlotStyle -> (ColorData["SunsetColors"] /@ Rescale@t)] ] If you use the full range 0–2π, then there are a lot of overlaps which obscures the information that you're trying to convey via colors. -π/2 to π/2 gives distinct curves, but that's not what you wanted to plot. In any case, that's something for you to decide. – rm -rf Feb 20 '14 at 16:38
  • Thank you very much! In your comment there are a lot of commands I didn't know... but they're a great starting point to me! T hank you! – AstoundingJB Feb 20 '14 at 16:44
  • Hi @rm-rf! Thanks for your help, I solved the problem and got exactly the picture I wanted. Now, what should I do? You marked this question as a duplicate but, actually, I don't think it is so for the dependence on the parameter $t$, as the structure of your example shows. So, as a duplicate, should I simply delete my question? I'd rather set your answer as the accepted one, once your comment is put into an "answer form". Or, can I write the code I used, just for the benefit of someone else? Thanks! – AstoundingJB Feb 21 '14 at 09:24

0 Answers0