1
$\begingroup$

Another quick question, I have been trying to plot a phase plot, which has resulted in some issues. I know that there is a negative axis which it is also transposed on. However, when I include negative signs in front of the graph it doesn't want to plot.

My question thus is how do I hold the values on the positive axis whilst also being able to flip it to the negative one. It might help to show the picture to help along it's indeed a phase plot of a double well.

Thanks already for the help!.

To give an example of what I exactly would want mathematica to do I have attached a handdrawn picture. enter image description here

enter image description hereaswell.

$\endgroup$
3
  • $\begingroup$ hmm, could you please explain a bit more what you're trying to do? I'm not sure what you mean when you say that there is a negative axis it's transposed on. Also if there's code that attempts to solve the problem but doesn't work, could you please include it? and welcome to MMA SE! :) $\endgroup$ – thorimur Feb 17 at 11:05
  • $\begingroup$ Hey thanks! this community has been extremely helpful!. I mainly just want to mirror the image above to the negative yaxis (But also holds the current image so like stacking it up ontop). I can post the code however I have removed the problematic code that cuts out the negative part of the phase graph. $\endgroup$ – Tim van schaik Feb 17 at 11:11
  • $\begingroup$ I have attached a picture of what I meant, which hopefully gives you some insight in what I mean :) $\endgroup$ – Tim van schaik Feb 17 at 11:19
4
$\begingroup$
plot = Plot[Evaluate[Piecewise[{{Clip[#[x], {0, 5}], -Pi <= x <= 3 Pi}}, #[Pi]] & /@ 
   {Sin, 1/2 + Sin[#] &, 3/2 + Sin[#] &}], 
  {x, -3 Pi, 6 Pi}, Filling -> 0]

![enter image description here

1. You can use ReflectionTransform on the graphics primitives of plot:

Show[plot, 
 MapAt[GeometricTransformation[#, ReflectionTransform[{0, 1}]] &, plot, 1], 
 PlotRange -> All]

enter image description here

Alternatively, use ReplaceAll to replace Lines and Polygons with their reflected versions:

plot2  = plot /. primitive : _Line | _Polygon :> {primitive, 
    GeometricTransformation[primitive, ReflectionTransform[{0, 1}]]} ;


Show[plot2, PlotRange -> All]
same picture

2. Use the option ScalingFunctions:

reflectedplot = Plot[Evaluate[Piecewise[{{Clip[#[x], {0, 5}], -Pi <= x <= 3 Pi}}, 
   #[Pi]] & /@ {Sin, 1/2 + Sin[#] &, 3/2 + Sin[#] &}],
 {x, -3 Pi, 6 Pi}, 
 Filling -> 0, ScalingFunctions -> {None, "Reverse"}]

enter image description here

Show[plot, reflectedplot, PlotRange -> All]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Also for this example, Show[plot, plot /. {x_Real, y_Real} :> {x, -y}, PlotRange -> All] $\endgroup$ – Bob Hanlon Feb 17 at 16:52

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.