4
$\begingroup$

The following

Graphics[Circle[], Axes -> {True, True}, ScalingFunctions -> {Identity, "Reverse"}]

doesn't work

enter image description here

I need "minus" direction go to the right...

$\endgroup$
6
$\begingroup$

For Circle[] (or any graphics primitive symmetric around the origin), you can use custom ticks:

Graphics[Circle[], 
 Axes -> True, TicksStyle -> 16,
 Ticks -> {Charting`ScaledTicks["Reverse"], Automatic}]

enter image description here

You can also cheat by using the graphics primitives as Epilog in a plotting function that accepts ScalingFunctions(say, Plot):

Plot[x, {x, -1, 1}, AspectRatio -> 1, TicksStyle -> 16, 
 PlotStyle -> None, 
 PlotRange -> {{-1, 1}, {-1, 1}}, Axes -> True, 
 ScalingFunctions -> {"Reverse", Identity},
 Epilog -> {Circle[]}, ]

enter image description here

In general, you can use ScalingTransform[{-1, 1}] or ReflectionTransform[{-1, 0}] on graphics primitives and use custom ticks:

SeedRandom[1]
pnts = RandomReal[{-5, 5}, {10, 2}];
Row[{Graphics[{Opacity[.5], Blue, 
    Polygon[pnts[[FindShortestTour[pnts][[2]]]]]}, 
    Axes -> {True, True}, TicksStyle -> 16, ImageSize -> 300],
  Graphics[{Opacity[.5], Green, 
     GeometricTransformation[
      Polygon[pnts[[FindShortestTour[pnts][[2]]]]], ScalingTransform[{-1, 1}]]}, 
    Axes -> {True, True}, TicksStyle -> 16, ImageSize -> 300]
   Graphics[{Opacity[.5], Red, 
     GeometricTransformation[
      Polygon[pnts[[FindShortestTour[pnts][[2]]]]], ScalingTransform[{-1, 1}]]}, 
    Axes -> {True, True}, TicksStyle -> 16, ImageSize -> 300,
    Ticks -> {Charting`ScaledTicks["Reverse"], Automatic}]}]

enter image description here

$\endgroup$
  • $\begingroup$ So it is not possible without cheating? Send shame to Stephen! $\endgroup$ – Dims Feb 10 at 12:30
  • $\begingroup$ @Dims, I think it is not possible to use the option ScalingFunctions in Graphics. $\endgroup$ – kglr Feb 10 at 12:35
1
$\begingroup$

For objects like circles that are readily converted to mathematical functions:

r = 1;

ContourPlot[
 x^2 + y^2 == r^2,
 {x, -1.05, 1.05}, {y, -1.05, 1.05},
 Frame -> False,
 Axes -> True,
 ScalingFunctions -> {"Reverse", Identity}]

enter image description here

Or

Plot[
 {Sqrt[r^2 - x^2], -Sqrt[r^2 - x^2]},
 {x, -1.05, 1.05},
 PlotStyle -> ColorData[97][1],
 AspectRatio -> 1,
 ScalingFunctions -> {"Reverse", Identity}]
$\endgroup$

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.