Reputation: 444
I tried running plt.show() but no plot is shown. I had tried lots of solutions from stackoverflow including setting matplotlib backend to Qt4Agg, switching to other backends (i.e. TkAgg, Agg) and reinstalling matplotlib package but still not solving the issue. Some solutions that I had tried but not working are:
matplotlib does not show my drawings although I call pyplot.show()
Matplotlib.Pyplot does not show output; No Error
Matplotlib does not show labels or numbers
Below is the code that I tried to run:
plt.scatter(pf["age"], pf["friend_count"])
plt.xlabel = "age"
plt.ylabel = "friends count"
plt.title = "Facebook Friends count by Age"
plt.show()
When plt.scatter(pf["age"], pf["friend_count"])
code was run, a scatter plot was shown but with no labels and title. Running plt.show()
did not plot and no error was shown. Appreciate any help.
I installed Anaconda with Python 3 for Windows OS. My Mac laptop is running on Bootcamp.
Upvotes: 1
Views: 5010
Reputation: 9170
The labels must use parentheses such as plt.xlabel("text")
, not assigned to a string with =
like you have in your example code. Make the changes in your code, save the changes, quit and reopen Spyder or whatever interpreter you are running, then run the code again.
plt.figure(1)
plt.scatter(pf["age"], pf["friend_count"])
plt.xlabel("age")
plt.ylabel("friends count")
plt.title("Facebook Friends count by Age")
plt.show()
Upvotes: 2