Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
timhoffm merged 7 commits intomatplotlib:masterfromkolibril13:patch-1
Dec 16, 2019
Merged

Example for sigmoid function with horizontal lines#15914

timhoffm merged 7 commits intomatplotlib:masterfromkolibril13:patch-1
Dec 16, 2019

Conversation

kolibril13
Copy link
Contributor

An example for a sigmoid functions with axhline.
image

@story645
Copy link
Member

Thanks for the PR! While we value your contribution, there is concern that the gallery is getting unwieldy. Can you please explain what this example is demonstrating that is not currently being documented in the gallery?

@kolibril13
Copy link
ContributorAuthor

Thanks for this kind message.
I was looking for a way to add axes into my plots.
First I found solutions, which suggested
plt.plot([-10, 10], [0, 0], "k-")
but I think thatplt.axvline() is more elegant.
From the existing examples in the api, the use case ofplt.axvline() as axes is in my optinion not covered.(https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axvline.html?highlight=axvline#matplotlib.axes.Axes.axvline).
Therefore my idea to add this example.

@jklymak
Copy link
Member

You could add this to the annotating plots example rather than making a new example.

@kolibril13
Copy link
ContributorAuthor

@jklymak : Good point.
I think it's a tradeoff between showing only one idea per example and keeping as few examples as possible.
When I am searching for examples, I prefer to have only one thing that gets explained, ready to copy and paste.
I could also add theaxvline to the annotation example , like this:
image
However I would prefer to make it a new example.

@jklymak
Copy link
Member

I think grouping similar functionality into fewer examples makes it easier to find things visually rather than having to search a huge page.

@timhoffm
Copy link
Member

IMHO having a dedicated example for axhline/axvline makes sense. (Annotations are quite something different.) For this purpose, I actually like the proposed example. It contains both cases. It‘s a realistic example but still simple enough. However, the title and description should focus on the purpose; something like „Infinite horizontal and vertical lines“ not „Sigmoid function“. The text should explain what the functions create (the infinite h/v Lines at given y/x coordinates) and what this is commonly used for (indicate special values).

@timhoffm
Copy link
Member

Fake8 issues:

./examples/pyplots/sigmoid_function.py:37:1: E402 module level import not at top of file./examples/pyplots/sigmoid_function.py:42:1: W391 blank line at end of file

The second one is straight forward to solve. To solve the first one, add

    examples/pyplots/sigmoid_function.py : E402

to theper-file-ignores section of.flake8.

@kolibril13
Copy link
ContributorAuthor

That was quite a journey.
@timhoffm Thanks a lot for beeing so patient and guiding me through my first pull request to matplotlib. I think I learned a lot, and hopefully apply this knowledge very soon.

@timhoffm
Copy link
Member

I took the liberty to push a commit renaming the file fromsigmoid_function.py toaxline.py. - I intend to expand the example with (or at least mention) the recently addedaxline() function.

Will squash-merge after CI pass.

Thanks a lot, and congratulations on your first contribution to Matplotlib! Hope to see you back some time.

kolibril13 reacted with hooray emoji

@timhoffmtimhoffm added this to thev3.2.0 milestoneDec 16, 2019
@timhoffmtimhoffm merged commitbebd7f1 intomatplotlib:masterDec 16, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestDec 17, 2019
timhoffm added a commit that referenced this pull requestDec 17, 2019
…914-on-v3.2.xBackport PR#15914 on branch v3.2.x (Example for sigmoid function with horizontal lines)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.2.0
Development

Successfully merging this pull request may close these issues.

5 participants
@kolibril13@story645@jklymak@timhoffm@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp