5
$\begingroup$

I am trying to generate a parametric plot in Mathematica 8 using the following:

pp1=ParametricPlot[{Evaluate[Qin[t]]*10^3,Evaluate[PhiOut[t]]},{t,0,1/f0},AspectRatio->1/1,PlotRange->All,AxesOrigin->{0,0},PlotStyle->Directive[Thickness[Medium],colour]];

This works fine but I was wondering if it is possible to switch the styling of the line from solid to dashed for a certain range of the plotting parameter t e.g. for t>0.5*1/f0. I know that this can be done by generating separate plots and then combining them. This is not very convenient in my case. Is it possible to do this in a single ParametricPlot command?

$\endgroup$

migrated from stackoverflow.com Nov 10 '12 at 21:09

This question came from our site for professional and enthusiast programmers.

9
$\begingroup$
 ParametricPlot[{ Cos[t], Sin[t]}, {t, 0, 2 Pi}, PlotStyle -> Directive[Thick, Black], 
     Mesh -> {{0, Pi}},  MeshShading -> {Dashed, {}}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you. This is what I was looking for. $\endgroup$ – Zots Nov 12 '12 at 1:02
3
$\begingroup$

Use PlotStyle. Here's an example:

ParametricPlot[{{2 Cos[t], 2 Sin[t]}, {2 Cos[t], Sin[t]}, {Cos[t], 2 Sin[t]}, {Cos[t],    Sin[t]}}, {t, 0, 2 Pi}, 
PlotStyle -> {Dashed, Directive[Dashed, Orange],  Directive[Thick, Green],Black}]

enter image description here

$\endgroup$
  • $\begingroup$ Hi and thanks for your reply. This is not exactly what I am trying to do. Here is a simple example to demonstrate my question: What I am trying to do is the equivalent of this sequence of 3 commands: pp1=ParametricPlot[{Cos[t],Sin[t]},{t,0, Pi},PlotStyle->{Black}]; pp2=ParametricPlot[{Cos[t],Sin[t]},{t,Pi,2 Pi},PlotStyle->{Black,Dashed}]; Show[pp1,pp2,PlotRange->All] but in a single ParametricPlot. $\endgroup$ – Zots Nov 9 '12 at 18:44
  • $\begingroup$ I misunderstood the aim of your question. Unfortunately, I do not know how to solve this without using more than one ParametricPlot. $\endgroup$ – DavidC Nov 9 '12 at 18:53

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.