How to reverse X-axis in Graphics?
$begingroup$
The following
Graphics[Circle, Axes -> {True, True}, ScalingFunctions -> {Identity, "Reverse"}]
doesn't work

I need "minus" direction go to the right...
plotting graphics
$endgroup$
add a comment |
$begingroup$
The following
Graphics[Circle, Axes -> {True, True}, ScalingFunctions -> {Identity, "Reverse"}]
doesn't work

I need "minus" direction go to the right...
plotting graphics
$endgroup$
add a comment |
$begingroup$
The following
Graphics[Circle, Axes -> {True, True}, ScalingFunctions -> {Identity, "Reverse"}]
doesn't work

I need "minus" direction go to the right...
plotting graphics
$endgroup$
The following
Graphics[Circle, Axes -> {True, True}, ScalingFunctions -> {Identity, "Reverse"}]
doesn't work

I need "minus" direction go to the right...
plotting graphics
plotting graphics
asked Feb 10 at 11:14
DimsDims
30117
30117
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$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}]

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}, ]

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}]}]

$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 optionScalingFunctionsinGraphics.
$endgroup$
– kglr
Feb 10 at 12:35
add a comment |
$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}]

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$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191234%2fhow-to-reverse-x-axis-in-graphics%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$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}]

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}, ]

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}]}]

$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 optionScalingFunctionsinGraphics.
$endgroup$
– kglr
Feb 10 at 12:35
add a comment |
$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}]

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}, ]

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}]}]

$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 optionScalingFunctionsinGraphics.
$endgroup$
– kglr
Feb 10 at 12:35
add a comment |
$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}]

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}, ]

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}]}]

$endgroup$
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}]

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}, ]

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}]}]

edited Feb 10 at 12:37
answered Feb 10 at 11:43
kglrkglr
190k10206424
190k10206424
$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 optionScalingFunctionsinGraphics.
$endgroup$
– kglr
Feb 10 at 12:35
add a comment |
$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 optionScalingFunctionsinGraphics.
$endgroup$
– kglr
Feb 10 at 12:35
$begingroup$
So it is not possible without cheating? Send shame to Stephen!
$endgroup$
– Dims
Feb 10 at 12:30
$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
$begingroup$
@Dims, I think it is not possible to use the option
ScalingFunctions in Graphics.$endgroup$
– kglr
Feb 10 at 12:35
add a comment |
$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}]

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$
add a comment |
$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}]

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$
add a comment |
$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}]

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$
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}]

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}]
answered Feb 10 at 13:37
Bob HanlonBob Hanlon
61.4k33598
61.4k33598
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f191234%2fhow-to-reverse-x-axis-in-graphics%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown