Specific part of background in a plot - outside plotting area
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
add a comment |
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
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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.
– M.O.
Dec 15 '18 at 1:57
add a comment |
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
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.
1137
1137
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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.
– M.O.
Dec 15 '18 at 1:57
add a comment |
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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.
– M.O.
Dec 15 '18 at 1:57
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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.
– M.O.
Dec 15 '18 at 1:57
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.
– M.O.
Dec 15 '18 at 1:57
add a comment |
2 Answers
2
active
oldest
votes
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
]
Thank you! I had tried negative values ofScaled
but it didnt do anything!
– M.O.
Dec 14 '18 at 17:19
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?
– M.O.
Dec 14 '18 at 17:26
add a comment |
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}]]
Very simple! Thanks!
– 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
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
]
Thank you! I had tried negative values ofScaled
but it didnt do anything!
– M.O.
Dec 14 '18 at 17:19
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?
– M.O.
Dec 14 '18 at 17:26
add a comment |
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
]
Thank you! I had tried negative values ofScaled
but it didnt do anything!
– M.O.
Dec 14 '18 at 17:19
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?
– M.O.
Dec 14 '18 at 17:26
add a comment |
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
]
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 Woll
67.1k388175
67.1k388175
Thank you! I had tried negative values ofScaled
but it didnt do anything!
– M.O.
Dec 14 '18 at 17:19
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?
– M.O.
Dec 14 '18 at 17:26
add a comment |
Thank you! I had tried negative values ofScaled
but it didnt do anything!
– M.O.
Dec 14 '18 at 17:19
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?
– M.O.
Dec 14 '18 at 17:26
Thank you! I had tried negative values of
Scaled
but it didnt do anything!– M.O.
Dec 14 '18 at 17:19
Thank you! I had tried negative values of
Scaled
but it didnt do anything!– M.O.
Dec 14 '18 at 17:19
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?– M.O.
Dec 14 '18 at 17:26
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?– M.O.
Dec 14 '18 at 17:26
add a comment |
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}]]
Very simple! Thanks!
– M.O.
Dec 14 '18 at 18:35
add a comment |
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}]]
Very simple! Thanks!
– M.O.
Dec 14 '18 at 18:35
add a comment |
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}]]
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 Dulgerci
4,0851816
4,0851816
Very simple! Thanks!
– M.O.
Dec 14 '18 at 18:35
add a comment |
Very simple! Thanks!
– M.O.
Dec 14 '18 at 18:35
Very simple! Thanks!
– M.O.
Dec 14 '18 at 18:35
Very simple! Thanks!
– 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
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
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!
– Andreas Rejbrand
Dec 14 '18 at 23:07
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.
– M.O.
Dec 15 '18 at 1:57