-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: add a semicolon to hide long matplotlib axes return value #34393
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
add a semicolon to hide debug messages like: Out[85]: array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0ad6e3d0>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0ad4a350>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0aa10250>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a6367d0>], [<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d088c2d50>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d089ea310>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d08d89890>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a76ae10>], [<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a756090>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a8dd750>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d096aaed0>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0937d490>], [<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d09f49a10>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a0551d0>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a418550>, <matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a6f0ad0>]], dtype=object) which you can see here: https://pandas.pydata.org/docs/user_guide/visualization.html
@@ -821,7 +821,7 @@ You can create a scatter plot matrix using the | |||
df = pd.DataFrame(np.random.randn(1000, 4), columns=['a', 'b', 'c', 'd']) | |||
|
|||
@savefig scatter_matrix_kde.png | |||
scatter_matrix(df, alpha=0.2, figsize=(6, 6), diagonal='kde') | |||
scatter_matrix(df, alpha=0.2, figsize=(6, 6), diagonal='kde'); |
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.
Does using plt.show() have the same effect? May look a bit more natural.
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 not sure how to do this using plt.show()
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 think this is fine. IPython will show any output of each line. So adding a plt.show()
will not prevent printing the output of this line.
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.
This seems like a strange one-off so would prefer what @dsaxton suggests if it works
IPython will show any output of each line.
Is that a general comment or specific to just doc rendering? Running this in ipython:
a = [1, 2, 3]
a
print("done")
Only prints "done"
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.
Is that a general comment or specific to just doc rendering?
The IPython directive runs line by line (so it's not the same copy pasting it in an ipython console, but rather as copy pasting line by line)
This seems like a strange one-off
We already do this in several places in this visualization.rst
, so it's not a one-off
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.
Ah OK thanks for the explanation. lgtm to then
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 are about 40 semicolons in visualization.rst but there are also many plots which don't have semicolons and show the debug messages.
Should we put a semicolon after every plot in visualization.rst?
Thanks @partev |
add a semicolon to hide debug messages like:
Out[85]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0ad6e3d0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0ad4a350>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0aa10250>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a6367d0>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d088c2d50>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d089ea310>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d08d89890>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a76ae10>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a756090>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a8dd750>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d096aaed0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0937d490>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d09f49a10>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a0551d0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a418550>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f3d0a6f0ad0>]],
dtype=object)
which you can see here:
https://pandas.pydata.org/docs/user_guide/visualization.html
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff