Skip to content

r scripting charts scatter

Sebastian Seitner edited this page Jan 4, 2018 · 4 revisions

Scatter Chart

To use a scatter chart you have to import the according classes via:

import(at.gmi.djamei.viz.charts.gral.ScatterChart)

Parameters

A scatter chart has the following parameter options

Name Type
data A Matrix of data points, (x,y) value pairs per row
groups A Factor listing the group association of the rows in the data matrix
colors A character vector containing the color values to be used for the different groups
legend A character vector representing the text which should be shown in the legend for the corresponding group
xLabel The label for the X axis
yLabel The label for the Y axis
title The title of the plot

Example

data <- cbind(c(-4,-3,-2,-1,0,0,1,2,3,4),c(-5,-4,-3,-2,-1.5,0,1,2,3,4))
colors=rainbow(2)
scatter <- ScatterChart$new(
    data = data,
    groups = as.factor(c("G1","G1","G1","G1","G1","G2","G2","G2","G2","G2")),
    colors = colors,
    legend = c("Group 1", "Group 2"),
    xLabel = "X",
    yLabel = "Y",
    title = "Testplot"
)
phenopipe_add_chart(scatter)

Scatter Plot Example