Specific part of background in a plot - outside plotting area
$begingroup$
I need to add a rectangle to my plot that includes being behind the ticks but not the label of my graph.
I know with Prolog
you can add a rectangle, like with the code:
Plot[x^2, {x, 0, 3}, Prolog -> {Red, Rectangle[Scaled[{0., 0.8}], Scaled[{1, 1}]]}, Frame -> True, FrameLabel -> {"x", "y"}]
But I need the rectangle to go beyond where it is now, to be wider, and actually be behind the number 8 (but not behind the frame label) and go passed the frame a little bit on other side too. With Background
I could cover the whole thing but I am only interested in that rectangle and need the rest of the picture to remain backgroundless.
Is it at all posible?
Thank you!
plotting
$endgroup$
add a comment |
$begingroup$
I need to add a rectangle to my plot that includes being behind the ticks but not the label of my graph.
I know with Prolog
you can add a rectangle, like with the code:
Plot[x^2, {x, 0, 3}, Prolog -> {Red, Rectangle[Scaled[{0., 0.8}], Scaled[{1, 1}]]}, Frame -> True, FrameLabel -> {"x", "y"}]
But I need the rectangle to go beyond where it is now, to be wider, and actually be behind the number 8 (but not behind the frame label) and go passed the frame a little bit on other side too. With Background
I could cover the whole thing but I am only interested in that rectangle and need the rest of the picture to remain backgroundless.
Is it at all posible?
Thank you!
plotting
$endgroup$
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57
add a comment |
$begingroup$
I need to add a rectangle to my plot that includes being behind the ticks but not the label of my graph.
I know with Prolog
you can add a rectangle, like with the code:
Plot[x^2, {x, 0, 3}, Prolog -> {Red, Rectangle[Scaled[{0., 0.8}], Scaled[{1, 1}]]}, Frame -> True, FrameLabel -> {"x", "y"}]
But I need the rectangle to go beyond where it is now, to be wider, and actually be behind the number 8 (but not behind the frame label) and go passed the frame a little bit on other side too. With Background
I could cover the whole thing but I am only interested in that rectangle and need the rest of the picture to remain backgroundless.
Is it at all posible?
Thank you!
plotting
$endgroup$
I need to add a rectangle to my plot that includes being behind the ticks but not the label of my graph.
I know with Prolog
you can add a rectangle, like with the code:
Plot[x^2, {x, 0, 3}, Prolog -> {Red, Rectangle[Scaled[{0., 0.8}], Scaled[{1, 1}]]}, Frame -> True, FrameLabel -> {"x", "y"}]
But I need the rectangle to go beyond where it is now, to be wider, and actually be behind the number 8 (but not behind the frame label) and go passed the frame a little bit on other side too. With Background
I could cover the whole thing but I am only interested in that rectangle and need the rest of the picture to remain backgroundless.
Is it at all posible?
Thank you!
plotting
plotting
asked Dec 14 '18 at 16:34
M.O.M.O.
1137
1137
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57
add a comment |
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
You can use PlotRangeClipping
->False
and extend the Rectangle
:
Plot[x^2, {x, 0, 3},
Prolog -> {Red, Rectangle[Scaled[{-.03,.8}],Scaled[{1.03,1}]]},
Frame -> True,
FrameLabel -> {"x","y"},
PlotRangeClipping -> False
]
$endgroup$
$begingroup$
Thank you! I had tried negative values ofScaled
but it didnt do anything!
$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is aListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?
$endgroup$
– M.O.
Dec 14 '18 at 17:26
add a comment |
$begingroup$
Here is alternative way to do it.
Show[Graphics[{Red, Rectangle[{-0.1, 7.8}, {3, 9}]},
PlotRange -> {{0, 3}, {0, 9}}, AspectRatio -> 1/GoldenRatio,
Frame -> True, FrameLabel -> {"x", "y"}], Plot[x^2, {x, 0, 3}]]
$endgroup$
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
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%2f187912%2fspecific-part-of-background-in-a-plot-outside-plotting-area%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 PlotRangeClipping
->False
and extend the Rectangle
:
Plot[x^2, {x, 0, 3},
Prolog -> {Red, Rectangle[Scaled[{-.03,.8}],Scaled[{1.03,1}]]},
Frame -> True,
FrameLabel -> {"x","y"},
PlotRangeClipping -> False
]
$endgroup$
$begingroup$
Thank you! I had tried negative values ofScaled
but it didnt do anything!
$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is aListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?
$endgroup$
– M.O.
Dec 14 '18 at 17:26
add a comment |
$begingroup$
You can use PlotRangeClipping
->False
and extend the Rectangle
:
Plot[x^2, {x, 0, 3},
Prolog -> {Red, Rectangle[Scaled[{-.03,.8}],Scaled[{1.03,1}]]},
Frame -> True,
FrameLabel -> {"x","y"},
PlotRangeClipping -> False
]
$endgroup$
$begingroup$
Thank you! I had tried negative values ofScaled
but it didnt do anything!
$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is aListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?
$endgroup$
– M.O.
Dec 14 '18 at 17:26
add a comment |
$begingroup$
You can use PlotRangeClipping
->False
and extend the Rectangle
:
Plot[x^2, {x, 0, 3},
Prolog -> {Red, Rectangle[Scaled[{-.03,.8}],Scaled[{1.03,1}]]},
Frame -> True,
FrameLabel -> {"x","y"},
PlotRangeClipping -> False
]
$endgroup$
You can use PlotRangeClipping
->False
and extend the Rectangle
:
Plot[x^2, {x, 0, 3},
Prolog -> {Red, Rectangle[Scaled[{-.03,.8}],Scaled[{1.03,1}]]},
Frame -> True,
FrameLabel -> {"x","y"},
PlotRangeClipping -> False
]
answered Dec 14 '18 at 16:45
Carl WollCarl Woll
67.9k389176
67.9k389176
$begingroup$
Thank you! I had tried negative values ofScaled
but it didnt do anything!
$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is aListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?
$endgroup$
– M.O.
Dec 14 '18 at 17:26
add a comment |
$begingroup$
Thank you! I had tried negative values ofScaled
but it didnt do anything!
$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is aListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?
$endgroup$
– M.O.
Dec 14 '18 at 17:26
$begingroup$
Thank you! I had tried negative values of
Scaled
but it didnt do anything!$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
Thank you! I had tried negative values of
Scaled
but it didnt do anything!$endgroup$
– M.O.
Dec 14 '18 at 17:19
$begingroup$
My plot is a
ListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?$endgroup$
– M.O.
Dec 14 '18 at 17:26
$begingroup$
My plot is a
ListLinePlot
of imported data. The data beyond the range is showing becuase the plotting area hasnt been clipped. Is there any way to hide it that you know of?$endgroup$
– M.O.
Dec 14 '18 at 17:26
add a comment |
$begingroup$
Here is alternative way to do it.
Show[Graphics[{Red, Rectangle[{-0.1, 7.8}, {3, 9}]},
PlotRange -> {{0, 3}, {0, 9}}, AspectRatio -> 1/GoldenRatio,
Frame -> True, FrameLabel -> {"x", "y"}], Plot[x^2, {x, 0, 3}]]
$endgroup$
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
add a comment |
$begingroup$
Here is alternative way to do it.
Show[Graphics[{Red, Rectangle[{-0.1, 7.8}, {3, 9}]},
PlotRange -> {{0, 3}, {0, 9}}, AspectRatio -> 1/GoldenRatio,
Frame -> True, FrameLabel -> {"x", "y"}], Plot[x^2, {x, 0, 3}]]
$endgroup$
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
add a comment |
$begingroup$
Here is alternative way to do it.
Show[Graphics[{Red, Rectangle[{-0.1, 7.8}, {3, 9}]},
PlotRange -> {{0, 3}, {0, 9}}, AspectRatio -> 1/GoldenRatio,
Frame -> True, FrameLabel -> {"x", "y"}], Plot[x^2, {x, 0, 3}]]
$endgroup$
Here is alternative way to do it.
Show[Graphics[{Red, Rectangle[{-0.1, 7.8}, {3, 9}]},
PlotRange -> {{0, 3}, {0, 9}}, AspectRatio -> 1/GoldenRatio,
Frame -> True, FrameLabel -> {"x", "y"}], Plot[x^2, {x, 0, 3}]]
answered Dec 14 '18 at 17:52
Okkes DulgerciOkkes Dulgerci
4,9521817
4,9521817
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
add a comment |
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
$begingroup$
Very simple! Thanks!
$endgroup$
– M.O.
Dec 14 '18 at 18:35
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%2f187912%2fspecific-part-of-background-in-a-plot-outside-plotting-area%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
$begingroup$
Interestingly, I just got here and had a look at the images. I first saw the images in the two answers and thought, "ugh, this looks ugly with the rectangle extending outside the box". Then I saw the nice image in your question. And finally I was surprised to learn that you actually asked for the style in the answers!
$endgroup$
– Andreas Rejbrand
Dec 14 '18 at 23:07
$begingroup$
Yes. The graph I am trying to make is obviously way more complicated than that but that's what I was looking for. It serves to hightlight other graphics that will be displayed along side this one.
$endgroup$
– M.O.
Dec 15 '18 at 1:57