tilePlot: Make a facet tile plot to view two features.

Description Usage Arguments Value Examples

Description

Scan for patent market gaps. Visualize the features of a set of patents by a category. Can view up to four dimensions of data with this plot (x, y, and optionals fill and facet).

Quickly scan this chart to look for gaps in the feature sets.

Usage

1
2
tilePlot(df, xVal, tileVal, fillVal = NA, xangle = 0, xhjust = 0.5,
  showLegend = FALSE, facetVal = NA, fscale = c("free", "fixed"))

Arguments

df

The patent data frame you want to graph.

xVal

The x value you will be plotting, a character value that is a name of df.

tileVal

The tile value you will be plotting, a character value that is a name of df.

fillVal

An optional value for filling the color of the tiles on a third variable. Default set to NA and evaluates to xVal.

xangle

A numeric 0 to 360 value for the angle of the x axis text

xhjust

Double value between 0 and 1. 0 Means left justified, 1 means right justified, default set to 0.5 (middle), for the x axis text.

showLegend

A logical to allow you to show or hide the legend, which is mapped to the fillVal

facetVal

Optional faceting. A character string of the facet you want for your plot, must be a name of the header in df. Default set to NA.

fscale

Facet scale, a character value chosen from c("free","fixed"). Default set to fixed. It changes the y axis to adjust to each facet and drop unused y (tile) values or keeps them all constant.

Value

A ggplot2 facet plot object.

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
32
33
34
35
36
37
38
39
40
41
42
sumo <- cleanPatentData(patentData = patentr::acars, columnsExpected = sumobrainColumns,
cleanNames = sumobrainNames,
dateFields = sumobrainDateFields,
dateOrders = sumobrainDateOrder,
deduplicate = TRUE,
cakcDict = patentr::cakcDict,
docLengthTypesDict = patentr::docLengthTypesDict,
keepType = "grant",
firstAssigneeOnly = TRUE,
assigneeSep = ";",
stopWords = patentr::assigneeStopWords)

# note that in reality, you need a patent analyst to carefully score
# these patents, the score here is for demonstrational purposes
score <- round(rnorm(dim(sumo)[1],mean=1.4,sd=0.9))
score[score>3] <- 3; score[score<0] <- 0
sumo$score <- score
sumo$assigneeSmall <- strtrim(sumo$assigneeClean,12)
category <- c("system","control algorithm","product","control system", "communication")
c <- round(rnorm(dim(sumo)[1],mean=2.5,sd=1.5))
c[c>5] <- 5; c[c<1] <- 1
sumo$category <- category[c]
feature1 <- c("adaptive", "park", "lane", NA,NA,NA,NA,NA, 
"brake", "steer","accelerate","deactivate")
f <- round(rnorm(dim(sumo)[1],mean=5,sd=1))
l <- length(feature1)
f[f>l] <- l; f[f<1] <- 1
sumo$feature1 <- c(feature1,feature1[f])[1:dim(sumo)[1]]

tilePlot(sumo, "category", "feature1")

tilePlot(sumo, xVal = "assigneeSmall", tileVal = "feature1", fillVal = "category",
xangle=90, xhjust=0, showLegend = TRUE)

tilePlot(sumo, xVal = "assigneeSmall", tileVal = "feature1", fillVal = "category",
xangle=90, xhjust=0, showLegend = TRUE, facetVal = "docType", fscale = "fixed")

tilePlot(sumo, xVal = "assigneeSmall", tileVal = "feature1", fillVal = "category",
xangle=90, xhjust=0, showLegend = TRUE, facetVal = "docType", fscale = "free")

tilePlot(sumo, xVal = "assigneeSmall", tileVal = "feature1", fillVal = "category",
xangle=90, xhjust=0, showLegend = TRUE, facetVal = "score", fscale = "free")

kamilien1/patentR documentation built on May 20, 2019, 7:19 a.m.