3
$\begingroup$

I want to plot a triangle like

enter image description here

(not exactly, it is a simplified version) using points (x,y) with 0 < x < y in the range 1<y<0. It would be nice if the following works but not.

ParametricPlot[{x, y}, {x, 0, y}, {y, 0, 1}]

Something close to it can be done by

ParametricPlot[{x, y}&&(x<y), {x, 0, 1}, {y, 0, 1}]

but I obtain a wiggly triangle.

Do you have any solution?

$\endgroup$
5
  • $\begingroup$ ParametricPlot[{y, y - x}, {x, 1, 0}, {y, 0, x}] $\endgroup$ – Acus Jun 11 at 7:54
  • $\begingroup$ ParametricPlot[{x y, y}, {x, 0, 1}, {y, 0, 1}]? $\endgroup$ – kglr Jun 11 at 8:03
  • 5
    $\begingroup$ ParametricPlot[{x, y} && (x<y) ... I have never seen this syntax. Where did you learn it? $\endgroup$ – Szabolcs Jun 11 at 8:22
  • $\begingroup$ Are you sure you don't want RegionPlot instead of ParametricPlot? If not, can you explain why? Additionally: most plotting functions in Mathematica have a RegionFunction option which can be used to restrict the plotting region to arbitrary shaped. It is especially useful with DensityPlot and similar functions. The arguments it takes are different for each plotting function—look them up! $\endgroup$ – Szabolcs Jun 11 at 8:25
  • $\begingroup$ @Szabolcs Thank you for the hint, but this is a simplified version of my problem, whose space is not the same as the range. $\endgroup$ – user112002 Jun 11 at 13:34
2
$\begingroup$
reg = ParametricRegion[{{x, y}, x < y}, {{x, 0, 1}, {y, 0, 1}}];
HighlightMesh[
 BoundaryDiscretizeRegion[
  reg], {Style[1, Directive[Thickness[.03], Red]], Style[2, None]}, 
 PlotRangePadding -> .1]

enter image description here

reg = ParametricRegion[{{x, y}, x < y}, {{x, 0, 1}, {y, 0, 1}}];
RegionPlot[RegionBoundary[DiscretizeRegion[reg]], 
 BoundaryStyle -> Directive[Thickness[.03], Red], 
 PlotRangePadding -> .1]

Or

ParametricPlot[{x, y}, {y, 0, 1}, {x, 0, y}, PlotStyle -> None, 
 BoundaryStyle -> Directive[Red, Thickness[.03]]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you! The latter is the direct solution I wanted. $\endgroup$ – user112002 Jun 11 at 13:43

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.