Drawing a sigmoid function and its derivative in tikzRotate a node but not its content: the case of the ellipse decorationTiKZ drawing routine or functionDrawing function in tikzHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Graph of Derivative functionTikz drawing with functionHow to plot a function and its derivativepgfplots: modify axis after end axis / cut tikzpicture after drawingDrawing a function without knowing its definitionHow to properly arrange group plot for bar chart using pgfplot?
Why doesn't SpaceX land boosters in Africa?
Installed software from source, how to say yum not to install it from package?
Robots in a spaceship
How is it possible for tall trees to pull water to heights more than 10m?
What is the lowest possible AC?
Fitting large table to single page
What is my external HDD doing?
Disk usage buggy: 10G missing on Linux home partition on SSD
Identifying positions of the last TRUEs in a sequence of TRUEs and FALSEs
Odd PCB Layout for Voltage Regulator
My mom helped me cosign a car and now she wants to take it
Two palindromes are not enough
How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?
Where to connect the fuse and why?
Drawing a sigmoid function and its derivative in tikz
How to track mail undetectably?
When should the dialogue reference be written, before or after the dialogue?
Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?
Could you fall off a planet if it was being accelerated by engines?
Checkmate in 1 on a Tangled Board
Understanding the as-if rule, "the program was executed as written"
Does "boire un jus" tend to mean "coffee" or "juice of fruit"?
How did they film the Invisible Man being invisible in 1933?
How does mmorpg store data?
Drawing a sigmoid function and its derivative in tikz
Rotate a node but not its content: the case of the ellipse decorationTiKZ drawing routine or functionDrawing function in tikzHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Graph of Derivative functionTikz drawing with functionHow to plot a function and its derivativepgfplots: modify axis after end axis / cut tikzpicture after drawingDrawing a function without knowing its definitionHow to properly arrange group plot for bar chart using pgfplot?
I created a graph of the sigmoid function using the following tikz code:
documentclassminimal
usepackagetikz,pgfplots
begindocument
begintikzpicture
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
]
addplot%
[
blue,%
mark=none,
samples=100,
domain=-6:6,
]
(x,1/(1+exp(-x)));
endaxis
endtikzpicture
enddocument
Is it possible to add the derivative of the sigmoid function to the graph using a red dotted line, including a legend in the topright corner for both lines without leaving the tikz environment?
Sigmoid function: σ = 1/(1+exp(-x))
Derivative: σ(x)(1−σ(x)
tikz-pgf
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I created a graph of the sigmoid function using the following tikz code:
documentclassminimal
usepackagetikz,pgfplots
begindocument
begintikzpicture
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
]
addplot%
[
blue,%
mark=none,
samples=100,
domain=-6:6,
]
(x,1/(1+exp(-x)));
endaxis
endtikzpicture
enddocument
Is it possible to add the derivative of the sigmoid function to the graph using a red dotted line, including a legend in the topright corner for both lines without leaving the tikz environment?
Sigmoid function: σ = 1/(1+exp(-x))
Derivative: σ(x)(1−σ(x)
tikz-pgf
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I created a graph of the sigmoid function using the following tikz code:
documentclassminimal
usepackagetikz,pgfplots
begindocument
begintikzpicture
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
]
addplot%
[
blue,%
mark=none,
samples=100,
domain=-6:6,
]
(x,1/(1+exp(-x)));
endaxis
endtikzpicture
enddocument
Is it possible to add the derivative of the sigmoid function to the graph using a red dotted line, including a legend in the topright corner for both lines without leaving the tikz environment?
Sigmoid function: σ = 1/(1+exp(-x))
Derivative: σ(x)(1−σ(x)
tikz-pgf
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I created a graph of the sigmoid function using the following tikz code:
documentclassminimal
usepackagetikz,pgfplots
begindocument
begintikzpicture
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
]
addplot%
[
blue,%
mark=none,
samples=100,
domain=-6:6,
]
(x,1/(1+exp(-x)));
endaxis
endtikzpicture
enddocument
Is it possible to add the derivative of the sigmoid function to the graph using a red dotted line, including a legend in the topright corner for both lines without leaving the tikz environment?
Sigmoid function: σ = 1/(1+exp(-x))
Derivative: σ(x)(1−σ(x)
tikz-pgf
tikz-pgf
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 8 hours ago
bjornvandijkman
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 8 hours ago
bjornvandijkmanbjornvandijkman
205 bronze badges
205 bronze badges
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
bjornvandijkman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The arguably most convenient way is to declare functions with the declare function key, and plot them.
documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=sigma(x)=1/(1+exp(-x));
sigmap(x)=sigma(x)*(1-sigma(x));]
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
samples=100,
domain=-6:6,
legend style=at=(1,0.9)
]
addplot[blue,mark=none] (x,sigma(x));
addplot[red,dotted,mark=none] (x,sigmap(x));
legend$sigma(x)$,$sigma'(x)$
endaxis
endtikzpicture
enddocument

Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,addplot[blue,mark=none] sigma(x);will also work.
– marmot
6 hours ago
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
);
);
bjornvandijkman is a new contributor. Be nice, and check out our Code of Conduct.
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%2f497949%2fdrawing-a-sigmoid-function-and-its-derivative-in-tikz%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 arguably most convenient way is to declare functions with the declare function key, and plot them.
documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=sigma(x)=1/(1+exp(-x));
sigmap(x)=sigma(x)*(1-sigma(x));]
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
samples=100,
domain=-6:6,
legend style=at=(1,0.9)
]
addplot[blue,mark=none] (x,sigma(x));
addplot[red,dotted,mark=none] (x,sigmap(x));
legend$sigma(x)$,$sigma'(x)$
endaxis
endtikzpicture
enddocument

Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,addplot[blue,mark=none] sigma(x);will also work.
– marmot
6 hours ago
add a comment |
The arguably most convenient way is to declare functions with the declare function key, and plot them.
documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=sigma(x)=1/(1+exp(-x));
sigmap(x)=sigma(x)*(1-sigma(x));]
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
samples=100,
domain=-6:6,
legend style=at=(1,0.9)
]
addplot[blue,mark=none] (x,sigma(x));
addplot[red,dotted,mark=none] (x,sigmap(x));
legend$sigma(x)$,$sigma'(x)$
endaxis
endtikzpicture
enddocument

Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,addplot[blue,mark=none] sigma(x);will also work.
– marmot
6 hours ago
add a comment |
The arguably most convenient way is to declare functions with the declare function key, and plot them.
documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=sigma(x)=1/(1+exp(-x));
sigmap(x)=sigma(x)*(1-sigma(x));]
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
samples=100,
domain=-6:6,
legend style=at=(1,0.9)
]
addplot[blue,mark=none] (x,sigma(x));
addplot[red,dotted,mark=none] (x,sigmap(x));
legend$sigma(x)$,$sigma'(x)$
endaxis
endtikzpicture
enddocument

The arguably most convenient way is to declare functions with the declare function key, and plot them.
documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[declare function=sigma(x)=1/(1+exp(-x));
sigmap(x)=sigma(x)*(1-sigma(x));]
beginaxis%
[
grid=major,
xmin=-6,
xmax=6,
axis x line=bottom,
ytick=0,.5,1,
ymax=1,
axis y line=middle,
samples=100,
domain=-6:6,
legend style=at=(1,0.9)
]
addplot[blue,mark=none] (x,sigma(x));
addplot[red,dotted,mark=none] (x,sigmap(x));
legend$sigma(x)$,$sigma'(x)$
endaxis
endtikzpicture
enddocument

answered 7 hours ago
marmotmarmot
140k6 gold badges184 silver badges338 bronze badges
140k6 gold badges184 silver badges338 bronze badges
Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,addplot[blue,mark=none] sigma(x);will also work.
– marmot
6 hours ago
add a comment |
Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,addplot[blue,mark=none] sigma(x);will also work.
– marmot
6 hours ago
Perfect, thanks!
– bjornvandijkman
7 hours ago
Perfect, thanks!
– bjornvandijkman
7 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,
addplot[blue,mark=none] sigma(x); will also work.– marmot
6 hours ago
@bjornvandijkman You're welcome! You do not necessarily need to do a parametric plot here,
addplot[blue,mark=none] sigma(x); will also work.– marmot
6 hours ago
add a comment |
bjornvandijkman is a new contributor. Be nice, and check out our Code of Conduct.
bjornvandijkman is a new contributor. Be nice, and check out our Code of Conduct.
bjornvandijkman is a new contributor. Be nice, and check out our Code of Conduct.
bjornvandijkman is a new contributor. Be nice, and check out our Code of Conduct.
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%2f497949%2fdrawing-a-sigmoid-function-and-its-derivative-in-tikz%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