Implementing R drawing under CentOS6.5

Source: Internet
Author: User
Tags cairo cairo package

1 , first install R's drawing package Cairo


[[email protected] mysofts] # R CMD INSTALL cairo_1.5-9.tar.gz

2 , check

> Library (Cairo)         load Cairo package > Cairo.capabilities ()  #png    JPEG   TIFF      PDF    svg     PS      X11    win     true    true  FALSE   TRUE   TRUE   TRUE   TRUE  FALSE   TRUE

Compatibility check Cairo supported graphics output formats:

Support: PNG, JPEG, PDF, SVG, PS, X11 (Linux desktop), raster

Not supported: TIFF, WIN (Windows desktop)

Note: If it is a Windows system, X11 is false and win is true.

3 , Instance

> X<-rnorm  #> Y<-rnorm (> png (file=)pic_ Plot.png", width=640, height=480)  png functions > plot (x, y, col=" #ff0000 ", pch=19, cex=2, main="plot")> ()

Results such as:

4 , you may encounter an error:

1) No PNG support in this version of R

Your r software does not support images in PNG format, use the capabilities () function to print a picture format that your environment supports.

cause of error: unknown, General re-assembly can solve the problem.

2) Unable to open connection to X11 display

cause of Error: installation of the X11 drawing device is not installed.

How do I install it?

Install a software called Xmanager locally (I am xp locally). Its main function is to accept the drawing instructions uploaded from the server, and then install this command locally.

It actually listens on a port, this port (port number 11th?). ) is related to drawing. So now the local run Xmanager, and then on the SSH R in the drawing, you can! Command capabilities (), we can also see that X11 becomes true.


How to use:

A , open the software


cause of error: X11 forwarding relies on the "Xorg-x11-xauth" package, you must first install the "Xorg-x11-xauth" package.

[[Email protected] ~] # Yum Install Xorg-x11-xauth

Error :"No such file or directory" errors.

Error reason: Your Linux host does not have Xterm installed, please install:

[[Email protected] ~] # Yum install–y xterm

B , successful connection

C , connecting the shell

Special Note: Be sure to tick options such as X11 channel. Each shell client is different, but it has the option.

Enter the shell interface check:

[[Email protected] ~] # Echo $DISPLAY

If nothing is output, please set it up:

[[Email protected] ~] # export display=localhost:10.0        #10.0 is the port of localhost. 

D , then enter R

>capabilities ()

You can see that X11 has turned true.

Then execute the 3 instance again.

3) Semi-transparency is isn't supported on this device

Remember to load the Cairo package:

>library (Cairo)    # loading the Graphics rendering library

Ubuntu system error Reason: because the machine is missing some X11-related libraries, please update R-base-dev previously installed it all the libraries required.

[[Email protected] ~] # sudo apt-get build-dep r-base-dev        #在线安装 for Ubuntu Systems

Implementing R drawing under CentOS6.5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.