What is a good, default backend for matplotlib












4















I've decided to setup a custom matplotlibrc, and thus I need to pick a backend for matplotlib. What is the best one in terms of not needing to install other additional packages?



I tend to use matplotlib via ipython --pylab, so I want interactive window based plots (when I don't I can switch to Agg).



I've tried WXAgg, but this requires (sensibly enough) WX.










share|improve this question





























    4















    I've decided to setup a custom matplotlibrc, and thus I need to pick a backend for matplotlib. What is the best one in terms of not needing to install other additional packages?



    I tend to use matplotlib via ipython --pylab, so I want interactive window based plots (when I don't I can switch to Agg).



    I've tried WXAgg, but this requires (sensibly enough) WX.










    share|improve this question



























      4












      4








      4








      I've decided to setup a custom matplotlibrc, and thus I need to pick a backend for matplotlib. What is the best one in terms of not needing to install other additional packages?



      I tend to use matplotlib via ipython --pylab, so I want interactive window based plots (when I don't I can switch to Agg).



      I've tried WXAgg, but this requires (sensibly enough) WX.










      share|improve this question
















      I've decided to setup a custom matplotlibrc, and thus I need to pick a backend for matplotlib. What is the best one in terms of not needing to install other additional packages?



      I tend to use matplotlib via ipython --pylab, so I want interactive window based plots (when I don't I can switch to Agg).



      I've tried WXAgg, but this requires (sensibly enough) WX.







      python matplotlib plot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 9 '18 at 8:55









      karel

      58.6k13128147




      58.6k13128147










      asked Jun 11 '18 at 20:40









      DaveDave

      166110




      166110






















          2 Answers
          2






          active

          oldest

          votes


















          4














          Both Agg and TkAgg do not require any dependencies beyond Python's standard library.



          I have had some issues with TkAgg and multi-threading, so if you only need to save to files (and not plt.show()), I would recommend using Agg instead (just replace it where TkAgg appears below).



          Either add the following line to your ~/.config/matplotlib/matplotlibrc:



          backend: TkAgg


          Or the following lines to your python file:



          import matplotlib
          matplotlib.use('TkAgg') # MUST BE CALLED BEFORE IMPORTING plt
          import matplotlib.pyplot as plt





          share|improve this answer

































            0














            I prefer inline plots with matplotlib to plots in a separate window because it makes it easier to see what I'm doing when I'm fine tuning the Python code.



            Python IDE for scientists (spyder) can do inline plotting. To try out this feature open the terminal and type:



            sudo apt install python2.7 python-matplotlib spyder ipython  


            After the ipython prompt in the IPython console copy/paste the below code and press the Enter key to run it.



            import matplotlib.pyplot as plt   
            x, y = [-1, 12], [1, 4]
            plt.plot(x, y, marker = 'o')


            enter image description here



            Atom text editor with the Hydrogen package for Atom installed can also do inline plotting. I find the Atom interface more complicated to configure than Spyder in which inline plotting with matplotlib works out of the box. I got started with inline plotting in Atom because I wanted to use Atom to make inline plots with other programming languages too.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1045720%2fwhat-is-a-good-default-backend-for-matplotlib%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              Both Agg and TkAgg do not require any dependencies beyond Python's standard library.



              I have had some issues with TkAgg and multi-threading, so if you only need to save to files (and not plt.show()), I would recommend using Agg instead (just replace it where TkAgg appears below).



              Either add the following line to your ~/.config/matplotlib/matplotlibrc:



              backend: TkAgg


              Or the following lines to your python file:



              import matplotlib
              matplotlib.use('TkAgg') # MUST BE CALLED BEFORE IMPORTING plt
              import matplotlib.pyplot as plt





              share|improve this answer






























                4














                Both Agg and TkAgg do not require any dependencies beyond Python's standard library.



                I have had some issues with TkAgg and multi-threading, so if you only need to save to files (and not plt.show()), I would recommend using Agg instead (just replace it where TkAgg appears below).



                Either add the following line to your ~/.config/matplotlib/matplotlibrc:



                backend: TkAgg


                Or the following lines to your python file:



                import matplotlib
                matplotlib.use('TkAgg') # MUST BE CALLED BEFORE IMPORTING plt
                import matplotlib.pyplot as plt





                share|improve this answer




























                  4












                  4








                  4







                  Both Agg and TkAgg do not require any dependencies beyond Python's standard library.



                  I have had some issues with TkAgg and multi-threading, so if you only need to save to files (and not plt.show()), I would recommend using Agg instead (just replace it where TkAgg appears below).



                  Either add the following line to your ~/.config/matplotlib/matplotlibrc:



                  backend: TkAgg


                  Or the following lines to your python file:



                  import matplotlib
                  matplotlib.use('TkAgg') # MUST BE CALLED BEFORE IMPORTING plt
                  import matplotlib.pyplot as plt





                  share|improve this answer















                  Both Agg and TkAgg do not require any dependencies beyond Python's standard library.



                  I have had some issues with TkAgg and multi-threading, so if you only need to save to files (and not plt.show()), I would recommend using Agg instead (just replace it where TkAgg appears below).



                  Either add the following line to your ~/.config/matplotlib/matplotlibrc:



                  backend: TkAgg


                  Or the following lines to your python file:



                  import matplotlib
                  matplotlib.use('TkAgg') # MUST BE CALLED BEFORE IMPORTING plt
                  import matplotlib.pyplot as plt






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 22 at 17:00

























                  answered Aug 30 '18 at 1:57









                  matwilsomatwilso

                  1415




                  1415

























                      0














                      I prefer inline plots with matplotlib to plots in a separate window because it makes it easier to see what I'm doing when I'm fine tuning the Python code.



                      Python IDE for scientists (spyder) can do inline plotting. To try out this feature open the terminal and type:



                      sudo apt install python2.7 python-matplotlib spyder ipython  


                      After the ipython prompt in the IPython console copy/paste the below code and press the Enter key to run it.



                      import matplotlib.pyplot as plt   
                      x, y = [-1, 12], [1, 4]
                      plt.plot(x, y, marker = 'o')


                      enter image description here



                      Atom text editor with the Hydrogen package for Atom installed can also do inline plotting. I find the Atom interface more complicated to configure than Spyder in which inline plotting with matplotlib works out of the box. I got started with inline plotting in Atom because I wanted to use Atom to make inline plots with other programming languages too.






                      share|improve this answer






























                        0














                        I prefer inline plots with matplotlib to plots in a separate window because it makes it easier to see what I'm doing when I'm fine tuning the Python code.



                        Python IDE for scientists (spyder) can do inline plotting. To try out this feature open the terminal and type:



                        sudo apt install python2.7 python-matplotlib spyder ipython  


                        After the ipython prompt in the IPython console copy/paste the below code and press the Enter key to run it.



                        import matplotlib.pyplot as plt   
                        x, y = [-1, 12], [1, 4]
                        plt.plot(x, y, marker = 'o')


                        enter image description here



                        Atom text editor with the Hydrogen package for Atom installed can also do inline plotting. I find the Atom interface more complicated to configure than Spyder in which inline plotting with matplotlib works out of the box. I got started with inline plotting in Atom because I wanted to use Atom to make inline plots with other programming languages too.






                        share|improve this answer




























                          0












                          0








                          0







                          I prefer inline plots with matplotlib to plots in a separate window because it makes it easier to see what I'm doing when I'm fine tuning the Python code.



                          Python IDE for scientists (spyder) can do inline plotting. To try out this feature open the terminal and type:



                          sudo apt install python2.7 python-matplotlib spyder ipython  


                          After the ipython prompt in the IPython console copy/paste the below code and press the Enter key to run it.



                          import matplotlib.pyplot as plt   
                          x, y = [-1, 12], [1, 4]
                          plt.plot(x, y, marker = 'o')


                          enter image description here



                          Atom text editor with the Hydrogen package for Atom installed can also do inline plotting. I find the Atom interface more complicated to configure than Spyder in which inline plotting with matplotlib works out of the box. I got started with inline plotting in Atom because I wanted to use Atom to make inline plots with other programming languages too.






                          share|improve this answer















                          I prefer inline plots with matplotlib to plots in a separate window because it makes it easier to see what I'm doing when I'm fine tuning the Python code.



                          Python IDE for scientists (spyder) can do inline plotting. To try out this feature open the terminal and type:



                          sudo apt install python2.7 python-matplotlib spyder ipython  


                          After the ipython prompt in the IPython console copy/paste the below code and press the Enter key to run it.



                          import matplotlib.pyplot as plt   
                          x, y = [-1, 12], [1, 4]
                          plt.plot(x, y, marker = 'o')


                          enter image description here



                          Atom text editor with the Hydrogen package for Atom installed can also do inline plotting. I find the Atom interface more complicated to configure than Spyder in which inline plotting with matplotlib works out of the box. I got started with inline plotting in Atom because I wanted to use Atom to make inline plots with other programming languages too.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jan 10 at 16:40

























                          answered Nov 13 '18 at 16:02









                          karelkarel

                          58.6k13128147




                          58.6k13128147






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1045720%2fwhat-is-a-good-default-backend-for-matplotlib%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Human spaceflight

                              Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                              張江高科駅