Filling in Area Under Curve Causes Alignment Issues
Clash Royale CLAN TAG#URR8PPP
I am trying to fill in the area under the curve of sin(x)/x. Here is my code:
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
usepackagetkz-euclide
pgfplotssetcompat=1.15
usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing,intersections
usepgfplotslibrarypolar,colormaps,fillbetween
usepgflibraryshapes.geometric
usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[scale=1.5,line width=1pt]
beginaxis[
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
%addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
I have the code in a larger document, so here is the output:
When I un-comment out the line to fill in the area, this happens:
There is a noticeable vertical gap and the image is pushed to the left. Any idea why this is happening?
pgfplots fillbetween
add a comment |
I am trying to fill in the area under the curve of sin(x)/x. Here is my code:
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
usepackagetkz-euclide
pgfplotssetcompat=1.15
usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing,intersections
usepgfplotslibrarypolar,colormaps,fillbetween
usepgflibraryshapes.geometric
usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[scale=1.5,line width=1pt]
beginaxis[
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
%addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
I have the code in a larger document, so here is the output:
When I un-comment out the line to fill in the area, this happens:
There is a noticeable vertical gap and the image is pushed to the left. Any idea why this is happening?
pgfplots fillbetween
add a comment |
I am trying to fill in the area under the curve of sin(x)/x. Here is my code:
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
usepackagetkz-euclide
pgfplotssetcompat=1.15
usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing,intersections
usepgfplotslibrarypolar,colormaps,fillbetween
usepgflibraryshapes.geometric
usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[scale=1.5,line width=1pt]
beginaxis[
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
%addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
I have the code in a larger document, so here is the output:
When I un-comment out the line to fill in the area, this happens:
There is a noticeable vertical gap and the image is pushed to the left. Any idea why this is happening?
pgfplots fillbetween
I am trying to fill in the area under the curve of sin(x)/x. Here is my code:
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
usepackagetkz-euclide
pgfplotssetcompat=1.15
usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing,intersections
usepgfplotslibrarypolar,colormaps,fillbetween
usepgflibraryshapes.geometric
usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[scale=1.5,line width=1pt]
beginaxis[
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
%addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
I have the code in a larger document, so here is the output:
When I un-comment out the line to fill in the area, this happens:
There is a noticeable vertical gap and the image is pushed to the left. Any idea why this is happening?
pgfplots fillbetween
pgfplots fillbetween
asked Mar 5 at 14:54
Aiden KennyAiden Kenny
4677
4677
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The culprit is scale=1.5
, which you should pass to the axis
, and not to the tikzpicture
. I guess you confuse pgfplots
otherwise, see this answer. If you wish to have a core-level explanation, I am afraid I cannot provide it, but given this answer one of my first guesses was to change the position of scale
, and it seems to work. Notice also that the pgfplots library fillbetween
loads intersections
, but a slightly advanced version, so you should not load intersections
(again). I also removed tkz-euclide
and unused libraries (in order to keep the code tidy), but you may resurrect them and the code still works as it should.
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
%usepackagetkz-euclide
pgfplotssetcompat=1.15
usepgfplotslibrary%polar,colormaps,
fillbetween
% usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing
% usepgflibraryshapes.geometric
%usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[line width=1pt]
beginaxis[scale=1.5,
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
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%2ftex.stackexchange.com%2fquestions%2f477872%2ffilling-in-area-under-curve-causes-alignment-issues%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The culprit is scale=1.5
, which you should pass to the axis
, and not to the tikzpicture
. I guess you confuse pgfplots
otherwise, see this answer. If you wish to have a core-level explanation, I am afraid I cannot provide it, but given this answer one of my first guesses was to change the position of scale
, and it seems to work. Notice also that the pgfplots library fillbetween
loads intersections
, but a slightly advanced version, so you should not load intersections
(again). I also removed tkz-euclide
and unused libraries (in order to keep the code tidy), but you may resurrect them and the code still works as it should.
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
%usepackagetkz-euclide
pgfplotssetcompat=1.15
usepgfplotslibrary%polar,colormaps,
fillbetween
% usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing
% usepgflibraryshapes.geometric
%usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[line width=1pt]
beginaxis[scale=1.5,
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
add a comment |
The culprit is scale=1.5
, which you should pass to the axis
, and not to the tikzpicture
. I guess you confuse pgfplots
otherwise, see this answer. If you wish to have a core-level explanation, I am afraid I cannot provide it, but given this answer one of my first guesses was to change the position of scale
, and it seems to work. Notice also that the pgfplots library fillbetween
loads intersections
, but a slightly advanced version, so you should not load intersections
(again). I also removed tkz-euclide
and unused libraries (in order to keep the code tidy), but you may resurrect them and the code still works as it should.
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
%usepackagetkz-euclide
pgfplotssetcompat=1.15
usepgfplotslibrary%polar,colormaps,
fillbetween
% usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing
% usepgflibraryshapes.geometric
%usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[line width=1pt]
beginaxis[scale=1.5,
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
add a comment |
The culprit is scale=1.5
, which you should pass to the axis
, and not to the tikzpicture
. I guess you confuse pgfplots
otherwise, see this answer. If you wish to have a core-level explanation, I am afraid I cannot provide it, but given this answer one of my first guesses was to change the position of scale
, and it seems to work. Notice also that the pgfplots library fillbetween
loads intersections
, but a slightly advanced version, so you should not load intersections
(again). I also removed tkz-euclide
and unused libraries (in order to keep the code tidy), but you may resurrect them and the code still works as it should.
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
%usepackagetkz-euclide
pgfplotssetcompat=1.15
usepgfplotslibrary%polar,colormaps,
fillbetween
% usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing
% usepgflibraryshapes.geometric
%usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[line width=1pt]
beginaxis[scale=1.5,
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
The culprit is scale=1.5
, which you should pass to the axis
, and not to the tikzpicture
. I guess you confuse pgfplots
otherwise, see this answer. If you wish to have a core-level explanation, I am afraid I cannot provide it, but given this answer one of my first guesses was to change the position of scale
, and it seems to work. Notice also that the pgfplots library fillbetween
loads intersections
, but a slightly advanced version, so you should not load intersections
(again). I also removed tkz-euclide
and unused libraries (in order to keep the code tidy), but you may resurrect them and the code still works as it should.
PassOptionsToPackageusenames,dvipsnames,table,x11namesxcolor
documentclass[a4paper, 12pt]article
usepackageamsmath
usepackageamssymb
usepackagepgfplots
%usepackagetkz-euclide
pgfplotssetcompat=1.15
usepgfplotslibrary%polar,colormaps,
fillbetween
% usetikzlibraryarrows,shadows,positioning, calc, decorations.markings, hobby, quotes,angles,decorations.pathreplacing
% usepgflibraryshapes.geometric
%usepackagexcolor
begindocument
beginfigure[ht]
centering
begintikzpicture[line width=1pt]
beginaxis[scale=1.5,
color= black,
xmin=-1,
xmax=7.9,
ymin=-1,
ymax=2,
axis equal image,
axis lines=middle,
font=scriptsize,
xtick distance=1,
ytick distance=1,
%xticklabels=,
%yticklabels=,
inner axis line style=stealth-stealth,
xlabel = $x$,
ylabel = $f(x)$,
ticks=none,
]
addplot[black, opacity = 0, domain=0:10, name path = 1]0;
addplot[Tan, smooth, domain=0.01:7.5, samples = 300, name path=2, thick] sin(deg(x))/x;
addplot[Tan, fill opacity=0.25] fill between [of=1 and 2,soft clip=domain=0:3.1415];
endaxis
endtikzpicture
captionIntegrating $sin(x)/x$ from $0 le x < infty$.
label1
endfigure
enddocument
edited Mar 5 at 15:25
answered Mar 5 at 15:15
marmotmarmot
114k5145276
114k5145276
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
add a comment |
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
2
2
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
Perfect, thanks. I'm always curious about small issues like this because the solution is not at all obvious.
– Aiden Kenny
Mar 5 at 16:30
add a comment |
Thanks for contributing an answer to TeX - LaTeX 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.
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%2ftex.stackexchange.com%2fquestions%2f477872%2ffilling-in-area-under-curve-causes-alignment-issues%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