1
$\begingroup$

I have such code:

f[x_] = x + 0.4;
x[t_] = Cos[t];
y[t_] = Sin[t];
Show[Plot[f[x], {x, 0, 1.2}, PlotRange -> {0, 1.5}, PlotStyle -> Red, 
  AxesOrigin -> {0, 0}, AspectRatio -> 0.75], 
 ParametricPlot[{x[t], y[t]}, {t, 0, 2*Pi}, 
  PlotRange -> {{0, 1.2}, {0, 1.5}}, PlotStyle -> Blue, 
  AxesOrigin -> {0, 0}, AspectRatio -> 0.75]]

and obtain the graph:

enter image description here

Could you help me, how I can hide the small piece of the blue curve left of the ordinate axis?

$\endgroup$
5
  • $\begingroup$ Use {t, 0, Pi/2} as the limits. $\endgroup$ Commented Feb 10, 2021 at 12:41
  • 1
    $\begingroup$ Thanks, but that is a demonstration example, actually I don't know which value of parameter $t$ I should take. Also I have several parametric curves... $\endgroup$ Commented Feb 10, 2021 at 13:02
  • 1
    $\begingroup$ If you do not give the plot range as an option to Show, then only the first specification of PlotRange is active. Therefore, If you change PlotRange -> {0, 1.5} to PlotRange -> {{0, 1.2}, {0., 1.5}} in the first plot the superfluous part disappears. $\endgroup$ Commented Feb 10, 2021 at 13:16
  • $\begingroup$ If you in the Parametric plot will take the limits {t, 0, 1.57} you get what you need. $\endgroup$ Commented Feb 10, 2021 at 13:44
  • $\begingroup$ In the Show use the option PlotRangePadding -> 0. Most of your options should be moved to Show to avoid unnecessary duplication, e.g., Show[Plot[f[x], {x, 0, 1.2}, PlotStyle -> Red], ParametricPlot[{x[t], y[t]}, {t, 0, 2*Pi}, PlotStyle -> Blue], PlotRange -> {{0, 1.2}, {0, 1.5}}, AxesOrigin -> {0, 0}, AspectRatio -> 0.75, PlotRangePadding -> 0] $\endgroup$ Commented Feb 10, 2021 at 15:01

2 Answers 2

3
$\begingroup$

Try RegionFunction

Show[
Plot[f[x], {x, 0, 1.2}, PlotRange -> {0, 1.5},PlotStyle -> Red, AxesOrigin -> {0, 0}, AspectRatio -> 0.75], 
ParametricPlot[{x[t], y[t]}, {t, 0,2*Pi},
RegionFunction -> Function[x, x >= 0],PlotRange -> {{0, 1.2}, {0, 1.5}}, PlotStyle -> Blue,AxesOrigin -> {0, 0}, AspectRatio -> 0.75]]

enter image description here

$\endgroup$
3
$\begingroup$

Change the order of Show

f[x_] = x + 0.4;
x[t_] = Cos[t];
y[t_] = Sin[t];
Show[ParametricPlot[{x[t], y[t]}, {t, 0, 2*Pi}, 
  PlotRange -> {{0, 1.2}, {0, 1.5}}, PlotStyle -> Blue, 
  AxesOrigin -> {0, 0}, AspectRatio -> 0.75], 
 Plot[f[x], {x, 0, 1.2}, PlotRange -> {0, 1.5}, PlotStyle -> Red, 
  AxesOrigin -> {0, 0}, AspectRatio -> 0.75]]
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.