buildGraph: IFC Graph Coercion

View source: R/buildGraph.R

buildGraphR Documentation

IFC Graph Coercion

Description

Helper to build a list to allow graph export.

Usage

buildGraph(
  type = c("histogram", "scatter", "density")[3],
  xlocation = 0,
  ylocation = 0,
  f1 = "Object Number",
  f2 = "Object Number",
  scaletype = 1,
  xmin = -1,
  xmax = 1,
  ymin = 0,
  ymax = 1,
  title = paste0(unlist(lapply(BasePop, FUN = function(x) x$name)), collapse = ", "),
  xlabel = f1,
  ylabel = f2,
  axislabelsfontsize = 10,
  axistickmarklabelsfontsize = 10,
  graphtitlefontsize = 12,
  regionlabelsfontsize = 10,
  bincount = 0,
  freq = c("T", "F")[1],
  histogramsmoothingfactor = 0,
  xlogrange = "P",
  ylogrange = "P",
  maxpoints = +Inf,
  stats = c("true", "false")[2],
  xsize = c(320, 480, 640)[1],
  ysize = xsize + ifelse(stats == "true", splitterdistance, 0),
  splitterdistance = 120,
  xstats = "Count|%Gated|Mean",
  ystats = xstats,
  order,
  xstatsorder,
  Legend,
  BasePop = list(list()),
  GraphRegion = list(list()),
  ShownPop = list(list()),
  ...
)

Arguments

type

Graph's type. Either "histogram", "scatter" or "density". Default is "density".

xlocation

Integer. Graph's x location. Default is 0.

ylocation

Integer. Graph's x location. Default is 0.

f1

Character. Graph x axis parameter. Default is "Object Number".

f2

Character. Graph y axis parameter. Default is "Object Number". Only used when 'type' is not "histogram".

scaletype

Integer. Graph scale. Either 0 (auto), 1 (manual). Default is 1.

xmin

Double. Graph's xmin. Default -1.

xmax

Double. Graph's xmax. Default 1.

ymin

Double. Graph's xmin. Default 0.

ymax

Double. Graph's xmax. Default 1.

title

Character. Graph title label. Default will use names of BasePop collapse with ', '.

xlabel

Character. Graph x axis label.

ylabel

Character. Graph y axis label.

axislabelsfontsize

Integer. Axis label font size. Default is 10. Allowed are: 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28.
Checked but not yet implemented.

axistickmarklabelsfontsize

Integer. Axis tick font size. Default is 10. Allowed are: 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28.
Checked but not yet implemented.

graphtitlefontsize

Integer. Axis title font size. Default is 12. Allowed are: 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28.
Checked but not yet implemented.

regionlabelsfontsize

Integer. Axis region font size. Default is 10. Allowed are: 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28.
Checked but not yet implemented.

bincount

Integer. Histogram bin count. Default is 0. Allowed are: 0, 8, 16, 32, 64, 128, 256, 512, 1024.

freq

Character. Histogram with frequency normalization of not. Default is "T", allowed are "T" or "F".

histogramsmoothingfactor

Integer. Histogram smoothing factor. Allowed are [0-20]. Only partly implemented, default is 0 for no smoothing other values will produce same smoothing.

xlogrange

determines transformation instruction for x-axis. Default is "P" for no transformation.

ylogrange

determines transformation instruction for y-axis. Default is "P" for no transformation.

maxpoints

determines the maximum number of points to display. Default is +Inf to display all points.
If provided, values from ]0,1] will be used as a proportion of the total number of points to show.
While values values superior to 1 will be interpreted as the maximal number of points to show.
It only applies to 2D graphs. When 'type' is "histogram", +Inf will be used whatever the value provided as input.

stats

Character. Either "true" or "false" to display stats. Default is "false".

xsize

Integer. Graph's x size. Default is 320 for small. Regular are: 320 (small), 480 (medium), 640 (big). Checked but not yet implemented.

ysize

Integer. Graph's y size. Default is 'ysize' + 'splitterdistance' when 'stats' is set to "true". Checked but not yet implemented.

splitterdistance

Integer. Default is 120. Checked but not yet implemented.

xstats

Character. x stats to be computed. Default is 'Count|%Gated|Mean'. It has to be a filled with the concatenation of 'Count', '%Total', '%Gated', '%Plotted', 'Objects/mL', 'Mean', 'Median', 'Std. Dev.', 'MAD', 'CV', 'Minimum', 'Maximum', 'Geo. Mean', 'Mode', 'Variance' and /or 'NaN', collapse with '|'. Checked but not yet implemented.

ystats

Character. y stats to be computed. Should be identical to 'xstats'. Default is xstats. Checked but not yet implemented.

order

Character. Order to display populations. When 'type' is "density" it will be BasePop[[1]]$name. When 'type' is "histogram" or "density" 'ShownPop' are not allowed Otherwise, it will use each of 'GraphRegion', 'BasePop' and 'ShownPop' names, collapse with '|'.

xstatsorder

Character. Order of stat rows. It will use each of 'GraphRegion' names & each of 'BasePop' names, reverted and collapse with '|'.

Legend

Default is list(list(onoff='false',x='0',y='0',witdh='96',height='128')). Not yet implemented.

BasePop

Default is list(list()). See details.

GraphRegion

Default is list(list()). Only allowed member are sub-list(s) with only one character component named 'name'.

ShownPop

Default is list(list()). Only allowed member are sub-list(s) with only one character component named 'name'.

...

Other arguments to be passed.

Details

Many parameters are not used or are only partly implemented, but most are checked in order to be compatible for further export.
For 'BasePop', if left as is "All" will be used as default.
This parameter will be built / checked according to 'type' argument.
'BasePop' has to be a list of list(s) and each sub-list should can contain several elements, but only "name" is mandatory.
The sublist members are:
-"name", "linestyle", "fill",
and only when 'type' is "density"
-"densitybincount", "densitymin", "densitymax",
-"densitycolors", "densitycolorslightmode", "densitycolorsdarkmode",
-"densitylevel", "densitytrans".
Each sub-list will be created automatically with the following default values (except if explicitly provided):
-linestyle="Solid",
-fill="true",
-densitybincount="128",densitymin="0",densitymax="0",
-densitycolors="-16776961|-13447886|-256|-23296|-65536|",
-densitycolorslightmode="-16776961|-13447886|-256|-23296|-65536|",
-densitycolorsdarkmode="-16776961|-13447886|-256|-23296|-65536|",
-densitylevel="",
*when provided it has to be in a format of "fill[true,false]|lines[true,false]|nlevels[integer>1]|lowest[numeric[0-1[]|" *describing how the levelplot should be drawn.
*Besides, 'densitrans' will not be used. -densitytrans="asinh"
*it can take a function to be applied to the 2D local densities
*or a name of a feature within 'IFC_data' object to draw a gradient against this feature
Note that when 'type' is "density", 'BasePop' should be of length one.
and fill will be overwritten to "true".

Value

a list containing all graph information.


IFC documentation built on Sept. 14, 2023, 1:08 a.m.