ggFFClusScatPlot: Cluster Scatter Plot using GGPlot2 and FatFonts

Description Usage Arguments Examples

Description

ggFFClusScatPlot() produces Cluster Scatter Plot using GGPlot2 and FatFonts. The FatFonts numbers in each grid represents the number of points within each grid.

Usage

1
2
3
4
5
ggFFClusScatPlot(x, y, xAxisTitle = 'x', yAxisTitle = 'y', panelFill = '#FAFAFA',
pointColor = '#C2C2C2', xBinLength = 3, yBinLength = 3, tileBorderColor = '#C2C2C2',
tileBorderSize = 0.1, tileFill = 'transparent', shrink = -1, font = 'Cubica',
fontSize = -1, fontColor = '#000000', isSquare = TRUE, showPoints = FALSE,
adjustPos = 1, changeFontColValue = NULL, changeFontColDigit = NULL, changeBackCol = NULL, ...)

Arguments

x

A vector containing the x values of each data point. x and y should be of the same length.

y

A vector containing the y values of each data point. x and y should be of the same length.

xAxisTitle

The title of x axis. (default:'x')

yAxisTitle

The title of y axis. (default: 'y')

panelFill

The color of the fill of the panel. (default: '#FAFAFA')

pointColor

The color of the points. (default: '#C2C2C2')

xBinLength

The difference between each two neighboring numbers on the x axis. (default: 3)

yBinLength

The difference between each two neighboring numbers on the y axis. (default: 3)

tileBorderColor

The color of the border of the tiles. (default: '#C2C2C2')

tileBorderSize

The size of the border of the tiles. (default: 0.1)

tileFill

The fill color of the tiles. (default: 'transparent')

shrink

To what extent are the raw values reduced. For instance, if shrink = 1000 and the original data is D, then the values displayed by FatFonts will be 1000D. If shrink = -1, then shrink will be chosen automatically. (default: -1)

font

The FatFonts family used in the plot. There are currently three FatFonts types available: "Cubica", "Miguta" and "Rotunda". (default: 'Cubica')

fontSize

The font size of the smallest FatFonts digit. If fontSize = -1, then font size will be chosen automatically. (default: -1)

fontColor

The font color of FatFonts digits. (default: '#000000')

isSquare

If each grid is square. It is better to display FatFonts numbers in square rather than rectangle grids. (default: TRUE)

showPoints

If normal scatter plot is shown at the lowest layer. (default: FALSE)

adjustPos

Parameter used to slightly adjust the location of FatFonts digits. (default: 1)

changeFontColValue

A function used to change font color based on value. An example function can be defined as follow: changeFontColValueFunc <- function(oldPlot)newPlot <- oldPlot + scale_color_gradient2(); return(newPlot). (default: NULL)

changeFontColDigit

A vector containing the 9 colors used to represent each digit respectively (in the order of 1 to 9). You can also use color combinations provided by the system (e.g. topo.colors(9)). (default: NULL)

changeBackCol

A function used to change tile fill color based on value. An example function can be defined as follow: changeBackColFunc <- function(oldPlot)newPlot <- oldPlot + scale_fill_gradient(low = 'white', high = 'purple'); return(newPlot). (default: NULL)

...

Other arguments passed on to methods. Not currently used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy')

ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 xBinLength = 5, yBinLength = 10, adjustPos = 1.5)

ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 font = 'Rotunda', adjustPos = 1.1)

ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 tileFill = 'black', fontColor = 'white')

ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 isSquare = FALSE, adjustPos = 1.5)

changeBackColFunc <- function(oldPlot){
  newPlot <- oldPlot + scale_fill_gradient(low = 'white', high = 'purple')
  return(newPlot)
}
ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 changeBackCol = changeBackColFunc)

changeFontColValueFunc <- function(oldPlot){
  newPlot <- oldPlot + scale_color_continuous(low = 'dark grey', high = 'purple')
 return(newPlot)
}
ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 changeFontColValue = changeFontColValueFunc)

cols <- topo.colors(9)
ggFFClusScatPlot(mpg$cty, mpg$hwy, xAxisTitle = 'cty', yAxisTitle = 'hwy',
 changeFontColDigit = cols)

purpleleaf95/ggFatFonts documentation built on May 15, 2019, 1:18 p.m.