user1772218
user1772218

Reputation: 125

matplotlib- code compiles but does not display graph

I have been struggling a lot with matplotlib. Some solutions have already been given for my problem here - matplotlib does not show my drawings although I call pyplot.show()

I have tried all possible suggested backend however, code compiles with no errors for many backends. For some I get errors. I also tried with virtalenv but no luck with it too. Is there something I am missing.

Ubuntu 12.04 python 2.7.3

following is the output of running a sample graph file in verbose mode:

 matplotlib version 1.2.1
 verbose.level helpful
 interactive is False
 platform is linux2
 Using fontManager instance from /home/ravi/.matplotlib/fontList.cache
 backend agg version v2.2

I would really appreciate any suggestion or link to solutions. I have already tried all possible backends.

Upvotes: 0

Views: 232

Answers (1)

Eric O. Lebigot
Eric O. Lebigot

Reputation: 94475

You should first make sure that you use the right backend. If you run IPython, the backend is normally displayed at start time. You can also get it with print matplotlib.get_backend().

If the backend is not the one you want, you can do matplotlib.use('backend name') first thing, where the backend name is from the matplotlib.rcsetup.all_backends list (not all backends work; for instance, the template backend is supposed to not do anything, but it allows you to check that your code runs). You can set the default backend as explained in the question you linked to.

I'm not sure if the following can help too, but have you tried to use matplotlib.pylot.ion(), which switches to interactive mode?

Upvotes: 1

Related Questions