This document provides an overview of various plotting functions in R for visualizing data including quantile-quantile plots, barplots, boxplots, interaction plots, density plots, 3D plots, and adjusting graphical parameters such as colors, sizes, fonts and saving plots. Key functions discussed are qqnorm, qqline, barplot, boxplot, interaction.plot, density, persp, contour, par, and devices like pdf, jpeg for saving plots.
I survey three approaches for data visualization in R: (i) the built-in base graphics functions, (ii) the ggplot2 package, and (iii) the lattice package. I also discuss some methods for visualizing large data sets.
I survey three approaches for data visualization in R: (i) the built-in base graphics functions, (ii) the ggplot2 package, and (iii) the lattice package. I also discuss some methods for visualizing large data sets.
Abstract: This PDSG workshop introduces the basics of Python libraries used in machine learning. Libraries covered are Numpy, Pandas and MathlibPlot.
Level: Fundamental
Requirements: One should have some knowledge of programming and some statistics.
AdRoll Tech Talk Presentation:
In this talk I present three approaches to understanding monads:
- How Monads Arise Naturally
- Monads as Implemented in Haskell
- Monads in Category Theory
download for better quality - Learn about the sequence and traverse functions
through the work of Runar Bjarnason and Paul Chiusano, authors of Functional Programming in Scala https://www.manning.com/books/functional-programming-in-scala
Symmetry in the interrelation of flatMap/foldMap/traverse and flatten/fold/se...Philip Schwarz
(download for perfect quality) A simple but nice example of the symmetries that help us reason about functional programs.
Errata: in "foldMapping is mapping and then folding – folding is just flatMapping identity", flatMapping should of course be foldMapping - spotted by Vasco Figueira
Chart and graphs in R programming language CHANDAN KUMAR
This slide contains basics of charts and graphs in R programming language. I also focused on practical knowledge so I tried to give maximum example to understand the concepts.
Abstract: This PDSG workshop introduces the basics of Python libraries used in machine learning. Libraries covered are Numpy, Pandas and MathlibPlot.
Level: Fundamental
Requirements: One should have some knowledge of programming and some statistics.
AdRoll Tech Talk Presentation:
In this talk I present three approaches to understanding monads:
- How Monads Arise Naturally
- Monads as Implemented in Haskell
- Monads in Category Theory
download for better quality - Learn about the sequence and traverse functions
through the work of Runar Bjarnason and Paul Chiusano, authors of Functional Programming in Scala https://www.manning.com/books/functional-programming-in-scala
Symmetry in the interrelation of flatMap/foldMap/traverse and flatten/fold/se...Philip Schwarz
(download for perfect quality) A simple but nice example of the symmetries that help us reason about functional programs.
Errata: in "foldMapping is mapping and then folding – folding is just flatMapping identity", flatMapping should of course be foldMapping - spotted by Vasco Figueira
Chart and graphs in R programming language CHANDAN KUMAR
This slide contains basics of charts and graphs in R programming language. I also focused on practical knowledge so I tried to give maximum example to understand the concepts.
statistical computation using R- an intro..Kamarudheen KV
This presentation deals with some basics of R language. It is very useful for benners in R. It describes the basics in a very easy manner, so those who are not familiar with R it would be very helpful.
A short list of the most useful R commands
reference: http://www.personality-project.org/r/r.commands.html
R programı ile ilgilenen veya yeni öğrenmeye başlayan herkes için hazırlanmıştır.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
5. Interaction plot
Display means by 2 variables (in a two-way analysis
of variance)
interaction.plot(x1, x2, y)
fun (option to change default statistic which is the
mean)
6. Empirical probability density plot
Density plots are non-parametric estimates of the
empirical probability density function
#univariate density
plot(density(x))
One could compare groups
by looking at kernel density
plots
7. 3 – D plots
persp(x, y, z)
contour(x, y, z)
Image(x, y, z)
OR
library(scatterplot3d)
scatterplot3d(x, y, z)
The values for x and y must be in ascending order
8. A list of graphical parameters that define the
default behavior of all plot functions.
Just like other R objects, par elements are similarly
modifiable, with slightly different syntax.
◦ e.g. par(“bg”=“lightcyan”)
◦ This would change the background color of all
subsequent plots to light cyan
When par elements are modified directly (as above,
this changes all subsequent plotting behavior.
9. Size of margins
◦ par(mar=c(bot, left, top, right))
Save graphical settings
◦ par() #view currents settings
◦ opar <- par() #make a copy of current settings
◦ par(opar) #restore original settings
Multiple plots per page
◦ par(mfrow=c(a, b)) #a rows and b columns
◦ par(mfcol=c(a,b))
10. bg – plot background color
lty – line type (e.g. dot, dash, solid)
lwd – line width
col – color
cex – text size inside plot
xlab, ylab – axes labels
main – title
pch – plotting symbol
11. Add an arbitrary straight line:
plot(x, y)
abline(intercept, slope)
Plot symbols
plot(x, y, pch=pchval)
PCH symbols used in R
“col=“ and “bg=” are also specified
PCH can also be in characters such as
“A”, “a”, “%” etc.
14. Line styles, line width and colors
plot(….)
lines(x, y, lty=ltyval, lwd = lwdval,
col=colval)
col Default plotting color. Some functions (e.g. lines)
accept a vector of values that are recycled.
col.axis color for axis annotation
col.lab color for x and y labels
col.main color for titles
col.sub color for subtitles
fg plot foreground color (axes, boxes - also sets col= to
same)
bg plot background color
15. Legend
plot(x, y)
legend(xval, yval, legend = c(“Grp1”, “Grp2”),
lty=1:2, col=3:4, bty=“box type”)
Add a legend at the location at (xval, yval)
A vector of legend labels, line types,
and colors can be specified
using legend, lty and col options.
bty =“o” or “n”
16. Adding Points or Lines to an Existing Graphic
plot(x, y)
points(x, y)
lines(x, y, type=“type”)
type =
p points
l lines
o overplotted points and lines
b, c points (empty if "c") joined by lines
s, S stair steps
h histogram-like vertical lines
n does not produce any points or lines
OLS line fit to the points
plot(x, y)
abline(lm(y~x))
17. Graph Size
pdf(“filename.pdf”, width = Xin, height = Yin)
Point and text size
plot(x, y, cex = cexval)
cex number indicating the amount by which
plotting text and symbols should be scaled relative to the
default. 1=default, 1.5 is 50% larger, 0.5 is 50% smaller,
etc.
cex.axis magnification of axis annotation relative to cex
cex.lab magnification of x and y labels relative to cex
cex.main magnification of titles relative to cex
cex.sub magnification of subtitles relative to cex
Box around plots
plot(x, y, bty = btyval)
18. Axis labels, values, and tick marks
◦ plot(x, y, lab=c(x, y, len), #number of tick marks
las=lasval, #orientation of tick marks
tck = tckval, #length of tick marks
xaxp = c(x1, x2, n), #coordinates of the extreme tick
marks
yaxp = c(x1, x2, n),
xlab = “X axis label”, ylab=“Y axis label”)
◦ las = 0 labels are parallel to axis
◦ las=2 labels are perpendicular to axis
◦ tck = 0 suppresses the tick mark
19. Axis Range and Style
◦ plot(x, y, xlim = c(minx, maxx), ylim = c (miny, maxy),
xaxs=“i”, yaxs=“i”)
The xaxs and yaxs control whether the tick marks extend
beyond the limits of the plotted observations (default) or are
constrained to be internal (“i”)
See also:
axis()
mtext()
Omit axis
◦ plot(x, y, xaxt = “n”, yaxy=“n”)
20. Fonts
font Integer specifying font to use for text.
1=plain, 2=bold, 3=italic, 4=bold italic,
5=symbol
font.axis font for axis annotation
font.lab font for x and y labels
font.main font for titles
font.sub font for subtitles
ps font point size (roughly 1/72 inch)
text size=ps*cex
family font family for drawing text. Standard values
are "serif", "sans", "mono", "symbol".
21. More on how to change colors
◦ You can specify colors in R by index, name,
hexadecimal, or RGB.
◦ For example col=1, col="white", and col="#FFFFFF"
are equivalent.
◦ colors() #list of color names
22. The number of plots on a page, and their placement on the page,
can be controlled using par() or layout().
The number of figure regions can be controlled using mfrow and
mfcol.
e.g. par(mfrow=c(3,2)) # Creates 6 figures arranged in
3 rows and 2 columns
layout() allows the creation of multiple figure regions of unequal
sizes.
e.g. layout(matrix(c(1,2)), heights=c(2,1))
23. Many statistical functions (regression, cluster
analysis) create special objects. These arguments
will automatically format graphical output in a
specific way.
e.g. Produce diagnostic plots from a linear model
analysis (see R code)
# Reg = lm()
# plot(Reg)
hclust()
agnes() # hierarchical cluster analysis
24. Specify destination of graphics output or simply right
click and copy
Could be files
◦ Not Scalable
JPG # not recommended, introduces blurry artifacts
around the lines
BMP
PNG
◦ Scalable:
Postscript # preferred in LaTex
Pdf # great for posters
25. pdf(“file.pdf”)
plot(….)
dev.off()
jpeg(“file.jpeg”)
plot(…)
dev.off()
win.metafile(file.wmf)
plot(…)
dev.off()
Similar code for BMP, TIFF, PNG, POSTSCRIPT
PNG is usually recommended
The dev.off() function is used to close the graphical device