0
$\begingroup$

The following two plots are not visible when shown togather:

  tr1 = With[{a = 0.1}, 
   Composition[TranslationTransform[{0, 0, a}], 
    ScalingTransform[{Sqrt[1 - (2 a - a^2)], 
      Sqrt[1 - (2 a - a^2)], (1 - (2 a - a^2))}]]];
plot1 = Region[TransformedRegion[Sphere[], tr1], 
  PlotTheme -> "Detailed", PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
  AxesOrigin -> {0, 0, 0}, AxesStyle -> Directive[Black, 17], 
  AxesLabel -> {x, y, z}, AxesEdge -> Automatic]

tr2 = With[{a = 0.2}, 
   Composition[TranslationTransform[{0, 0, a}], 
    ScalingTransform[{Sqrt[1 - (2 a - a^2)], 
      Sqrt[1 - (2 a - a^2)], (1 - (2 a - a^2))}]]];
plot2 = Region[TransformedRegion[Sphere[], tr2], 
  PlotTheme -> "Detailed", PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
  AxesOrigin -> {0, 0, 0}, AxesStyle -> Directive[Black, 17], 
  AxesLabel -> {x, y, z}, AxesEdge -> Automatic]

Show[plot2, plot1]

How can one plot these with different colors and adjust the transparency such that they are visible neatly?

$\endgroup$

1 Answer 1

2
$\begingroup$
RegionPlot3D[Evaluate[TransformedRegion[DiscretizeRegion@Sphere[], #] & /@ {tr1, tr2}], 
 PlotTheme -> "Detailed", 
 PlotLegends -> (Defer[TransformedRegion[Sphere[], #]] & /@ {"tr1", "tr2"}), 
 PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
 AxesOrigin -> {0, 0, 0}, 
 AxesStyle -> Directive[Black, 17], 
 AxesLabel -> {x, y, z}, 
 PlotStyle -> {FaceForm[[email protected], Red], FaceForm[[email protected], Green]}, 
 AxesEdge -> Automatic]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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