-1

I use python code

    ### Show the MSE for 0 to 60 degree
plt.figure(figsize=(15,6))
angle = Angle_MSE.values[:, 0]
MSE = Angle_MSE.values[:, 1]
plt.plot(angle, MSE, marker = 'o', color = 'red')
plt.legend(['MSE'], loc='upper right', fontsize= 15)
plt.title('MSE of angle prediction for each angle', fontsize= 25)
plt.ylabel('MSE of predictions', fontsize= 25)
plt.xlabel('Actual Angle', fontsize= 25)
plt.yticks(np.arange(0, 10000, step=1000))
plt.xticks(np.arange(0, 181, step=10))

Although it gives me the correct plot, it also shows information like this enter image description here

How to remove the information it shows up?

Thanks in advance!

Guanlin Chen
  • 59
  • 1
  • 9
  • Does this answer your question? [Hiding axis text in matplotlib plots](https://stackoverflow.com/questions/2176424/hiding-axis-text-in-matplotlib-plots) – user8108136 Jan 19 '21 at 01:34

2 Answers2

0

Ending the last line in a semicolon should do:

 plt.xticks(np.arange(0, 181, step=10));

Can't seem to find the relevant documentation page, but a semicolon is used to suppress the output of the commands in the interactive environments.

  • 1
    Here is an explanation of what a semicolon does in general: https://stackoverflow.com/questions/12335358/what-does-a-semicolon-do – zvone Jan 19 '21 at 01:58
0

If you are running some code in jupyter notebook, the result of the last line is printed out.

The last line here is plt.xticks(np.arange(0, 181, step=10)) and xticks returns a list of info about each x-tick set up.

A solution is to finish with a statement or an expression which returns None, so that nothing is printed.

As another answer suggests, this can be accomplished by adding a semicolon (;) at the end. A semicolon separates two statements, so this way the last statement becomes empty and nothing is printed.

zvone
  • 18,045
  • 3
  • 49
  • 77