Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Example for sigmoid function with horizontal lines#15914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
f1883dd
Example for sigmoid function with horizontal lines
kolibril138874536
simplified script and changed title
kolibril13e9538b3
fixed typo
kolibril13eb2647f
Fixing heading markup and specifying purpose of plot
kolibril13ede4800
remove blank line
kolibril130121bb2
added per-file-ignores sigmoid_function.py : E402
kolibril133c91c81
Rename example file sigmoid_function.py to axline.py
timhoffmFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions.flake8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletionsexamples/pyplots/axline.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
====================================== | ||
Infinite horizontal and vertical lines | ||
====================================== | ||
`~.axes.Axes.axvline` and `~.axes.Axes.axhline` draw infinite vertical / | ||
horizontal lines, at given *x* / *y* positions. They are usually used to mark | ||
special data values, e.g. in this example the center and limit values of the | ||
sigmoid function. | ||
""" | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
t = np.linspace(-10, 10, 100) | ||
sig = 1 / (1 + np.exp(-t)) | ||
plt.axhline(y=0, color="black", linestyle="--") | ||
plt.axhline(y=0.5, color="black", linestyle=":") | ||
plt.axhline(y=1.0, color="black", linestyle="--") | ||
plt.axvline(color="grey") | ||
plt.plot(t, sig, linewidth=2, label=r"$\sigma(t) = \frac{1}{1 + e^{-t}}$") | ||
plt.xlim(-10, 10) | ||
plt.xlabel("t") | ||
plt.legend(fontsize=14) | ||
plt.show() | ||
############################################################################# | ||
# | ||
# ------------ | ||
# | ||
# References | ||
# """""""""" | ||
# | ||
# The use of the following functions, methods, classes and modules is shown | ||
# in this example: | ||
import matplotlib | ||
matplotlib.pyplot.axhline | ||
matplotlib.pyplot.axvline | ||
matplotlib.axes.Axes.axhline | ||
matplotlib.axes.Axes.axvline |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.