Vertical and Horizontal Shifts of Plots
$begingroup$
I am trying to combine two plots in a way that the second plot will horizontally move to the point where the first one ends. So they will be touching each other at their end/starting points. I have tried some simple tricks and codes, but no success. The codes are as the followings:
Fig1 := Plot[10.9545 + Sqrt[100 - x^2]/2, x, 0, 16, PlotRange -> 0, 16, 0, 16];
Fig2 := Plot[Sqrt[120.` - 4.` x^2], x, 0, 6];
Show[Fig1, Fig2, DisplayFunction -> $DisplayFunction,PlotLabel -> "Combined PPF"]
plotting
$endgroup$
add a comment |
$begingroup$
I am trying to combine two plots in a way that the second plot will horizontally move to the point where the first one ends. So they will be touching each other at their end/starting points. I have tried some simple tricks and codes, but no success. The codes are as the followings:
Fig1 := Plot[10.9545 + Sqrt[100 - x^2]/2, x, 0, 16, PlotRange -> 0, 16, 0, 16];
Fig2 := Plot[Sqrt[120.` - 4.` x^2], x, 0, 6];
Show[Fig1, Fig2, DisplayFunction -> $DisplayFunction,PlotLabel -> "Combined PPF"]
plotting
$endgroup$
add a comment |
$begingroup$
I am trying to combine two plots in a way that the second plot will horizontally move to the point where the first one ends. So they will be touching each other at their end/starting points. I have tried some simple tricks and codes, but no success. The codes are as the followings:
Fig1 := Plot[10.9545 + Sqrt[100 - x^2]/2, x, 0, 16, PlotRange -> 0, 16, 0, 16];
Fig2 := Plot[Sqrt[120.` - 4.` x^2], x, 0, 6];
Show[Fig1, Fig2, DisplayFunction -> $DisplayFunction,PlotLabel -> "Combined PPF"]
plotting
$endgroup$
I am trying to combine two plots in a way that the second plot will horizontally move to the point where the first one ends. So they will be touching each other at their end/starting points. I have tried some simple tricks and codes, but no success. The codes are as the followings:
Fig1 := Plot[10.9545 + Sqrt[100 - x^2]/2, x, 0, 16, PlotRange -> 0, 16, 0, 16];
Fig2 := Plot[Sqrt[120.` - 4.` x^2], x, 0, 6];
Show[Fig1, Fig2, DisplayFunction -> $DisplayFunction,PlotLabel -> "Combined PPF"]
plotting
plotting
asked Aug 26 '18 at 16:16
IlkerIlker
623
623
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
You can use Translate
to translate the graphics primitives of Fig2
by a vector of your choice:
Show[Fig1, Fig2 /. l_Line :> Translate[l, 10, 0], PlotRange -> All] (* or *)
Show[Fig1, Graphics[Translate[Fig2[[1]], 10, 0]], PlotRange -> All]
Alternatively, you create a translated version of Fig2
:
Fig3 = Plot[Sqrt[120.` - 4.` (x - 10)^2], x, 10, 16];
Show[Fig1, Fig3, PlotRange -> All]
same picture
$endgroup$
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
add a comment |
$begingroup$
An alternative is to define your function as having two parts using Piecewise, and then simply plot that combined function.
f[x_] := Piecewise[10.9545 + Sqrt[100 - x^2]/2, 0 < x < 10,
Sqrt[120.` - 4.` (x - 10)^2], 10 < x < 16];
Plot[f[x], x, 0, 16]
$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%2f180692%2fvertical-and-horizontal-shifts-of-plots%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$
You can use Translate
to translate the graphics primitives of Fig2
by a vector of your choice:
Show[Fig1, Fig2 /. l_Line :> Translate[l, 10, 0], PlotRange -> All] (* or *)
Show[Fig1, Graphics[Translate[Fig2[[1]], 10, 0]], PlotRange -> All]
Alternatively, you create a translated version of Fig2
:
Fig3 = Plot[Sqrt[120.` - 4.` (x - 10)^2], x, 10, 16];
Show[Fig1, Fig3, PlotRange -> All]
same picture
$endgroup$
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
add a comment |
$begingroup$
You can use Translate
to translate the graphics primitives of Fig2
by a vector of your choice:
Show[Fig1, Fig2 /. l_Line :> Translate[l, 10, 0], PlotRange -> All] (* or *)
Show[Fig1, Graphics[Translate[Fig2[[1]], 10, 0]], PlotRange -> All]
Alternatively, you create a translated version of Fig2
:
Fig3 = Plot[Sqrt[120.` - 4.` (x - 10)^2], x, 10, 16];
Show[Fig1, Fig3, PlotRange -> All]
same picture
$endgroup$
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
add a comment |
$begingroup$
You can use Translate
to translate the graphics primitives of Fig2
by a vector of your choice:
Show[Fig1, Fig2 /. l_Line :> Translate[l, 10, 0], PlotRange -> All] (* or *)
Show[Fig1, Graphics[Translate[Fig2[[1]], 10, 0]], PlotRange -> All]
Alternatively, you create a translated version of Fig2
:
Fig3 = Plot[Sqrt[120.` - 4.` (x - 10)^2], x, 10, 16];
Show[Fig1, Fig3, PlotRange -> All]
same picture
$endgroup$
You can use Translate
to translate the graphics primitives of Fig2
by a vector of your choice:
Show[Fig1, Fig2 /. l_Line :> Translate[l, 10, 0], PlotRange -> All] (* or *)
Show[Fig1, Graphics[Translate[Fig2[[1]], 10, 0]], PlotRange -> All]
Alternatively, you create a translated version of Fig2
:
Fig3 = Plot[Sqrt[120.` - 4.` (x - 10)^2], x, 10, 16];
Show[Fig1, Fig3, PlotRange -> All]
same picture
edited Aug 28 '18 at 3:53
answered Aug 26 '18 at 16:41
kglrkglr
182k10200414
182k10200414
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
add a comment |
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
Thanks! Translate is the one that I have been looking for.
$endgroup$
– Ilker
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
$begingroup$
`@Ilker, my pleasure. Thank you for the accept.
$endgroup$
– kglr
Aug 26 '18 at 16:53
add a comment |
$begingroup$
An alternative is to define your function as having two parts using Piecewise, and then simply plot that combined function.
f[x_] := Piecewise[10.9545 + Sqrt[100 - x^2]/2, 0 < x < 10,
Sqrt[120.` - 4.` (x - 10)^2], 10 < x < 16];
Plot[f[x], x, 0, 16]
$endgroup$
add a comment |
$begingroup$
An alternative is to define your function as having two parts using Piecewise, and then simply plot that combined function.
f[x_] := Piecewise[10.9545 + Sqrt[100 - x^2]/2, 0 < x < 10,
Sqrt[120.` - 4.` (x - 10)^2], 10 < x < 16];
Plot[f[x], x, 0, 16]
$endgroup$
add a comment |
$begingroup$
An alternative is to define your function as having two parts using Piecewise, and then simply plot that combined function.
f[x_] := Piecewise[10.9545 + Sqrt[100 - x^2]/2, 0 < x < 10,
Sqrt[120.` - 4.` (x - 10)^2], 10 < x < 16];
Plot[f[x], x, 0, 16]
$endgroup$
An alternative is to define your function as having two parts using Piecewise, and then simply plot that combined function.
f[x_] := Piecewise[10.9545 + Sqrt[100 - x^2]/2, 0 < x < 10,
Sqrt[120.` - 4.` (x - 10)^2], 10 < x < 16];
Plot[f[x], x, 0, 16]
answered Aug 27 '18 at 2:03
bill sbill s
53.1k375150
53.1k375150
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%2f180692%2fvertical-and-horizontal-shifts-of-plots%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