Specific part of background in a plot - outside plotting area












5














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


enter image description here



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!










share|improve this question






















  • 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 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 at 1:57
















5














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


enter image description here



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!










share|improve this question






















  • 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 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 at 1:57














5












5








5







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


enter image description here



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!










share|improve this question













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


enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 14 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 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 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 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 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 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 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 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 at 1:57










2 Answers
2






active

oldest

votes


















6














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
]


enter image description here






share|improve this answer





















  • Thank you! I had tried negative values of Scaled but it didnt do anything!
    – M.O.
    Dec 14 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 at 17:26



















4














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


enter image description here






share|improve this answer





















  • Very simple! Thanks!
    – M.O.
    Dec 14 at 18:35











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
});


}
});














draft saved

draft discarded


















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









6














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
]


enter image description here






share|improve this answer





















  • Thank you! I had tried negative values of Scaled but it didnt do anything!
    – M.O.
    Dec 14 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 at 17:26
















6














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
]


enter image description here






share|improve this answer





















  • Thank you! I had tried negative values of Scaled but it didnt do anything!
    – M.O.
    Dec 14 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 at 17:26














6












6








6






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
]


enter image description here






share|improve this answer












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
]


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 14 at 16:45









Carl Woll

66.7k385174




66.7k385174












  • Thank you! I had tried negative values of Scaled but it didnt do anything!
    – M.O.
    Dec 14 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 at 17:26


















  • Thank you! I had tried negative values of Scaled but it didnt do anything!
    – M.O.
    Dec 14 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 at 17:26
















Thank you! I had tried negative values of Scaled but it didnt do anything!
– M.O.
Dec 14 at 17:19




Thank you! I had tried negative values of Scaled but it didnt do anything!
– M.O.
Dec 14 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 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 at 17:26











4














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


enter image description here






share|improve this answer





















  • Very simple! Thanks!
    – M.O.
    Dec 14 at 18:35
















4














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


enter image description here






share|improve this answer





















  • Very simple! Thanks!
    – M.O.
    Dec 14 at 18:35














4












4








4






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


enter image description here






share|improve this answer












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


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 14 at 17:52









Okkes Dulgerci

3,7951816




3,7951816












  • Very simple! Thanks!
    – M.O.
    Dec 14 at 18:35


















  • Very simple! Thanks!
    – M.O.
    Dec 14 at 18:35
















Very simple! Thanks!
– M.O.
Dec 14 at 18:35




Very simple! Thanks!
– M.O.
Dec 14 at 18:35


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

How did Captain America manage to do this?

迪纳利

南乌拉尔铁路局