3
$\begingroup$

Writing:

ParametricPlot[{x, x}, {x, 1, 2}, AxesOrigin -> {0, 0}]

I get:

enter image description here

I would like to know if there was a command to add after AxesOrigin that gave the following graph:

enter image description here

Thanks so much!

$\endgroup$
2
$\begingroup$
ParametricPlot[{x , x Boole[1 <= x <= 2] }, {x, 0, 3},  Exclusions -> None]

enter image description here

or

ParametricPlot[{x , x Boole[1 <= x <= 2] }, {x, 0, 3}, 
 PlotRange -> {{0, 3}, {0, 3}}, Exclusions -> None]

enter image description here

Note: Exclusions -> {{1,2}} also works.

$\endgroup$
  • $\begingroup$ Thanks so much! $\endgroup$ – TeM Aug 10 '18 at 8:50
  • $\begingroup$ @TeM, my pleasure. Thank you for the accept. $\endgroup$ – kglr Aug 10 '18 at 8:55
3
$\begingroup$

Do you have to use ParametricPlot?

If not:

Plot[If[x < 1 || x > 2, 0, x], {x, 0, 3},
 AxesOrigin -> {0, 0},
 Exclusions -> Automatic,
 ExclusionsStyle -> Red]
$\endgroup$
  • $\begingroup$ The options Exclusions -> Automatic, ExclusionsStyle -> Red do not appear to change the output in v10.1. Are they needed in other versions? $\endgroup$ – Mr.Wizard Aug 10 '18 at 5:17
  • $\begingroup$ Thanks so much! $\endgroup$ – TeM Aug 10 '18 at 8:51
2
$\begingroup$

Maybe you can use a two parameter ParametricPlot:

ParametricPlot[{x,x t}, {x,1,2}, {t,0,1}, Frame->False, AxesOrigin->{0,0}]

enter image description here

Or with PlotStyle -> None:

ParametricPlot[{x, x t}, {x, 1, 2}, {t, 0, 1},
  Frame -> False, AxesOrigin -> {0, 0}, PlotStyle -> None]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks so much! $\endgroup$ – TeM Aug 10 '18 at 8:51

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.