GPy: model.plot() not working
Not sure if this is an actual issue or if I am doing something wrong, but I can’t seem to get model.plot() working.
I have the following code, where the times and years variables contain some olympic data.
kernel = GPy.kern.rbf(1, variance=1, lengthscale=1)
model = GPy.models.GPRegression(times, years, kernel)
model.plot()
A separate window which should contain the plot does open, but closes instantly, without displaying anything.
Any ideas as to why this is happening?
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 15 (7 by maintainers)
I had the same issue. The fix: matplotlib.pylab.show(block=True) Worked fine and the above explanation is a valid one.
Too bad I had to google to find this issue as the documentation does not work outside of ipython.
Plotting in matplotlib is a daemon task. Thus, when the plot shows up, it gets drawn, but the main python process is done. This makes the program (python process) stop.
You need to stop the python program to close. The block=True argument does exactly that. ipython does it as well. That is why your code behaved as it did.