I want to hide the label being printed using matplotlib plt.xticks (rotation=90).

Asked 2 years ago, Updated 2 years ago, 59 views

I used plt.xticks (rotaion=90) to rotate the X axis in matplot.
The label will be printed on the jupyter notebook using plt.xticks().
I don't want this print statement to be displayed because I'm creating a report on the jupyter notebook.
Is there any way?
Thank you for your cooperation.

The following code

import numpy as np
import pandas aspd
import matplotlib.pyplot asplt
import seaborn as sns
import japanize_matplotlib

data=pd.DataFrame ([[1,2], [4,5], [6,7]], columns=['x', 'y'])

data.plot()
plt.xticks (rotation=90)

Output below
Enter a description of the image here

 (array([0., 0.25, 0.5, 0.75, 1.75, 1.25, 1.5, 1.75, 2.],
 <a list of 9 Textxticklabel objects>)

I don't want to show the .

python matplotlib

2022-09-30 17:48

2 Answers

plt.xticks(rotation=90) followed by ; (semi-colon), or add plt.show() to the last line.


2022-09-30 17:48

For example, store the return value in a variable (rather than leaving it thrown).

_=plt.xticks(rotation=90)


2022-09-30 17:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.