4
$\begingroup$

I would like to plot a curve with specific x-axis range, for example: y = 2x, and only the region of -1.5 <= x <= -0.7 and 0.7 <= x <= 1.5 are of interest.

$\endgroup$

closed as off-topic by rhermans, mikado, zhk, happy fish, yohbs May 2 '17 at 2:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – rhermans, mikado, zhk, happy fish, yohbs
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Greetings! Make the most of Mma.SE and take the tour now. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working examples of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$ – rhermans Apr 28 '17 at 13:06
  • 4
    $\begingroup$ try Plot[ConditionalExpression[ 2 x, -1.5 <= x <= -0.7 || 0.7 <= x <= 1.5], {x, -2, 2}] to get this. $\endgroup$ – kglr Apr 28 '17 at 13:20
4
$\begingroup$

Specify the domain as a region.

Plot[2 x, x ∈ ImplicitRegion[-1.5 <= x <= -0.7 || 0.7 <= x <= 1.5, {x}]]

plot

$\endgroup$

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