-1

I'm on a *nix server right now with limited install privileges and I'm appreciating a distinct advantage of R over Python: you need fewer dependencies to plot in R. I have X-forwarding set up and can plot away in R, but I can't with Python due to lack of a backend.

For Python, I've had to install Tkinter a few times - not a big deal - but now I'm in a situation where it's not obvious how to and I'm appreciating the ease of plotting with R. Wasn't Python supposed to be the "batteries included" language?

So how does R do it? Does every install of R come with Tkinter? Or is it using something else to create its plots?

7
  • Python includes tkinter in the windows distro but not in the others OS distro's. Like linux. Not sure about OSX but I think it is missing from OSX as well. That said no language can cover every need right out of the box. Commented Feb 13, 2020 at 18:49
  • @Mike. Wikipedia page says all three OS types have Tkinker in their Pythin distros. Commented Feb 13, 2020 at 18:53
  • 1
    @42 I have seen a lot of post about OSX and Linux missing tkinter. Here is one post stating it needs to be installed manually for OSX post. Commented Feb 13, 2020 at 18:57
  • @42 that is just the 1st post that popped up when I googled it. I have seen several over the years with that same issue. Commented Feb 13, 2020 at 19:04
  • wiki.tcl-lang.org/page/Apple+Macintosh+and+Tcl%2FTk I think that link is fairly conclusive evidence that Tcl is part of macOS. And there is reasonably firm evidence that Tkinker is part of binary distributions: python.org/about/apps Commented Feb 13, 2020 at 19:10

1 Answer 1

2

R ships a package named tcltk with all distributions.

packageDescription("tcltk")
#----output--------
Package: tcltk
Version: 3.6.1
Priority: base
Title: Tcl/Tk Interface
Author: R Core Team
Maintainer: R Core Team <[email protected]>
Description: Interface and language bindings to Tcl/Tk GUI elements.
License: Part of R 3.6.1
Imports: utils
NeedsCompilation: yes
Built: R 3.6.1; x86_64-pc-linux-gnu; 2019-07-26 13:35:28 UTC; unix

-- File: /usr/lib/R/library/tcltk/Meta/package.rds 

You can tell it's going to be in every distribution from the line that says Priority: base. You can also find out more about optional graphics devices with:

 capabilities()
 #--- output -----

   jpeg         png        tiff       tcltk         X11        aqua    http/ftp 
   TRUE        TRUE        TRUE        TRUE        TRUE       FALSE        TRUE 
sockets      libxml        fifo      cledit       iconv         NLS     profmem 
   TRUE        TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
  cairo         ICU long.double     libcurl 
   TRUE        TRUE        TRUE        TRUE 

And a list of specific graphics device details can be found by following various links for the help page:

?Devices
Sign up to request clarification or add additional context in comments.

3 Comments

Cool! Any chance you could use R's tcl/tk as a matplotlib backend?
I'm pretty sure you can call R plot routines through the 'reticulate' python package but I don't know about matplotlib.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.