Ways to customize a splom() graph.

Ways to customize a splom() graph.

book

Article ID: KB0080945

calendar_today

Updated On:

Products Versions
Spotfire S+ All supported versions

Description

Customer may want to to customize a splom() graph.

 

Environment

Product: TIBCO Spotfire S+ Version: All supported versions OS: All supported operating systems --------------------

Resolution

1.  How can I add a fitted line to my splom() chart?

Create a vector of fitted values, ensuring that they are not out of range in each of the panels.  Here is an example using the ozone.data object.


splom( ~ ozone.data,
    panel = function(x, y){
    panel.xyplot(x, y)    
    lm.loc <- lm(y ~ x)
    x.seq <- seq(min(x), max(x), length=100)
    pred <- predict(lm.loc, data.frame(x = x.seq))
    ok <- rep(T, length(pred))
    ok[pred < min(y)] <- F
    ok[pred > max(y)] <- F
    lines(x.seq[ok], pred[ok])
    })

2.  What if I want to make the splom() graph into a pairwise QQ plot?

You'll need to sort each of the columns you pass into the graph, and use segments() to draw the 45-degree reference lines.  Here's an example using fuel.frame.

splom(~data.frame(Weight=sort(fuel.frame[,1]), Disp.=sort(fuel.frame[,2]),
Mileage=sort(fuel.frame[,3]), Fuel=sort(fuel.frame[,4])),
    panel=function(x,y,...){
    panel.splom(x,y,...)
    segments(min(x), min(y), max(x), max(y))
    })

Issue/Introduction

Ways to customize a splom() graph.