-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix code formatting of some examples #7730
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rossbar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eriknw !
Co-authored-by: Ross Barnowski <rossbar@caltech.edu>
| G = nx.soft_random_geometric_graph(50, 0.2) | ||
| >>> G = nx.soft_random_geometric_graph(50, 0.2) | ||
| Custom Graph: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, just came accross this PR. If I understand correctly, the example for Custom Graph is in the Notes section, a few lines below in the source code.
However, in the doc, the Notes section appears above the Examples section, which makes this example confusing. I think it would be perfect if both examples for Default Graph and Custom Graph could be placed in the same Examples section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. It is weird that Examples is at the bottom... below even References. I never gave this thought, but Examples does come at the end with numpydoc style: https://numpydoc.readthedocs.io/en/latest/format.html#examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am (as usual) confused. It looks to me like both the Default Graph example and the Custom Graph example appear together in an Examples section after the References section. I see that the Notes section is above both Refernece and Examples. That is, the section order changes between the doc_string in the code and the HTML generated by sphinx using the theme. But both examples are in the same examples section.
Is that different from what you are seeing @yuanx749 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dschult What I feel confusing is that there is only instruction ('Create a soft random...') under Custom Graph, but no code example. (Default Graph has example code.)
My understanding may be wrong. The code snippet in the Notes section could be used as an example for custom graph, but it appears above Examples section due to the section order changes after sphinx rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh.... I understand what you are saying now. :)
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rossbar Yes, I think it would be better to update the examples with a separate PR. (I may open one in a couple of days if I have time).
| G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1) | ||
| >>> G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1) | ||
| Custom Graph: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Some
Examplessections in the docs aren't being displayed correctly. These are the ones I was able to catch at a quick glance: