I just wanted to get started on using the matplotlib library for the first time.
So I type the following commands:
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
data = sp.genfromtxt("web_traffic.tsv", delimiter = "\t");
x = data[:, 0];
y = data[:, 1];
x = x[~sp.isnan(y)];
y = y[~sp.isnan(y)];
plt.scatter(x, y);
And I have received the following error :
<matplotlib.collections.PathCollection object at 0x246abd0>
I have no idea what is causing this, I have just installed the required packages, scipy
, matplotlib
and it returned to me that particular error. I tried to google it but with no results.
I am using openSuse as OS and python came by default. My main purpose is to start learning using the scykit learn
package.
Can you give me any advice on how to get over this error?
Matplotlib removes both labels and ticks by using xaxis. set_visible() set_visible() method removes axis ticks, axis tick labels, and axis labels also.
To hide or remove X-axis labels, use set(xlabel=None). To display the figure, use show() method.
It's not an error message. It's a string representation of an object.
If you ran the code above in an interactive shell, then what you see is a string representation of the value returned by the plt.scatter
function.
To actually open the window, you usually need to call plt.show()
at the end.
Or if you want it to be interactive, it is suggested to set interactive: True
in your .matplotlibrc
.
On an unrelated note, semicolons are not needed at the end of the line in Python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With