簡體   English   中英

為什么 R 可以開箱即用繪圖,但 Python (matplotlib) 需要 tkinter?

[英]Why can R plot out-of-the-box but Python (matplotlib) needs tkinter?

我現在在 *nix 服務器上,安裝權限有限,我很欣賞R 相對於 Python明顯優勢在 R 中繪制所需的依賴項更少 我設置了 X-forwarding 並且可以在 R 中繪圖,但是由於缺少后端,我不能使用 Python。

對於 Python,我不得不安裝 Tkinter幾次 - 沒什么大不了的 - 但現在我處於一種不明顯的情況,我很欣賞用 R 繪圖的便利性。 Python 不是應該的成為“包括電池”的語言?

那么R是如何做到的呢? 每次安裝 R 都附帶 Tkinter 嗎? 或者它是否使用其他東西來創建它的圖?

R 隨所有發行tcltk提供了一個名為tcltk的包。

packageDescription("tcltk")
#----output--------
Package: tcltk
Version: 3.6.1
Priority: base
Title: Tcl/Tk Interface
Author: R Core Team
Maintainer: R Core Team <R-core@r-project.org>
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 

您可以從Priority: base行中看出它將出現在每個發行版中。 您還可以通過以下方式了解有關可選圖形設備的更多信息:

 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 

可以通過以下幫助頁面的各種鏈接找到特定圖形設備詳細信息的列表:

?Devices

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM