Plotting graph in R with X11 window system using Cygwin

Submitted by Dickens A S on Tue, 09/07/2021 - 03:02

This article demonstrates how to show a simple graph with help X11 system available in Cygwin/X

1.) How to install X11 in Cygwin

Double click the setup and launch the list of software shown in the previous article

choose the below two softwares



Compete the installation 

2.) How to start the X11

Go to Start Menu

Click on "XWin Server"

Wait for 30 seconds

in your taskbar you will see two icons as below

Cygwin X11 taskbar icons

Right Click the second icon and choose the menu option

System Tools -> Cygwin Terminal

Cygwin Terminal

Write your R code as below "sample2.r"

x <- seq(0, 10, by = 0.01)
y <- sin ( x )
plot ( x, y, type = "l" )
Sys.sleep ( 10 )

in your terminal you issue the below command

rscript sample2.r

You will see the graph window which will show for 10 seconds and disappear


You have successfully created a R code for GUI graph



Add new comment