0

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.

Community
  • 1
  • 1
user1772218
  • 125
  • 1
  • 7
  • 1
    When you say your code "compiles" with no errors, do you actually mean that it runs with no errors? And how do you expect people to diagnose your errors if you don't show anyone what they are? – DaveP Jun 27 '13 at 00:52
  • Please include the code you are running. – wflynny Jun 27 '13 at 01:23
  • You need to use one of the interactive backend (qtkagg or qt4agg). – tacaswell Jun 27 '13 at 03:05
  • My apologies, the code was sample code provided by the matplotlib. The code was running, without showing the graph. I tried the suggested answers, however it did not work. I reinstalled the library again from source and now the graph is shown after setting up Qtkagg. Somehow my env settings were not working. Really appreciate your responses. Thank you. – user1772218 Jun 27 '13 at 04:57

1 Answers1

1

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?

Community
  • 1
  • 1
Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
  • 1
    Thank you! appreciate your response. I was using the right backend, somehow it wasn't working. I re-installed the whole library from source and then changed the backend to QtkAgg and it works now. Really appreciate your response. Thank you very much. – user1772218 Jun 27 '13 at 04:59