When I call pyplot.title(\'some string\')
it throws the exception, \'str\' object is not callable\'
.
I copied the following from the matplotlib onl
I had the same problem. The code was fine, but in the interpreter, I had previoulsy used incorrect xlabel() calls. re-starting the interpreter (close and reopen it) was enough for me, no need to reinstall all python/matplotlib !
It happened to me because I tried to do plot.title = "Some string"
so that rewrote the title()
method. That's the exact reason why it happens :) .
As others have said you just need to restart the kernel, no need to reinstall.
plt.title('xyz') :'str' object is not callable.
just give a restart of your terminal/ide. That ll fix the issue .
I've had this happen when I've previously accidentally plt.title = ''
After that that function is no longer a function. Restarting python kernel or re-importing plt library can fix it.
Not re-installing. Re-IMPORTING.
I encountered the same problem where I wrote plt.title = "This is a sample plot"
instead of plt.title("This is a sample plot")
. I was getting the error:
typeerror 'str' object is not callable
Restarting the Spyder IDE fixed the issue for me.
Had the same problem olben1, using ipython, anaconda and the --pylab flag. Reinstalled and it worked. Fwiw, using an anaconda env makes the uninstall/reinstall easier..