8
$\begingroup$

I am reading the paper "Star Coordinates: A Multidimensional Visualization Technique with Uniform Treatment of Dimensions" and trying to plot my data.

Let's say I have $A(2,5,3,1,8)$, a five dimensional data point, and points are calculated by the formula explained in the paper.

The basic idea of Star Coordinates is to arrange the coordinate axes on a circle on a two-dimensional plane with equal (initially) angles between the axes with an origin at the center of the circle (Figure 1). Initially, all axes have the same length. Data points are scaled to the length of the axis, with the minimum mapping to the origin and the maximum to the other end of the axis. Unit vectors are calculated accordingly. ...

This is simply an extension of typical 2d and 3d scatter-plots to higher dimensions with normalization.

I have hard time grasping the idea. How do I plot it? The main problem is I could not understand the formula in the paper.

$\endgroup$
  • $\begingroup$ What do you want to plot ? the 3d representation ? a 2d representation wich would show some clustering ? $\endgroup$ – lcrmorin May 3 '13 at 9:31
  • 2
    $\begingroup$ You are expecting us to Google that, read the paper and find "the formula".... Please provide more information. $\endgroup$ – Nick Cox May 3 '13 at 11:44
  • $\begingroup$ This technique is closely related to a PCA "biplot." I believe "star coordinates" may be the same as those used in a biplot for a PCA in which the first principal component is $(1,1,\ldots,1)$ and the second PC is any vector orthogonal to it. $\endgroup$ – whuber May 3 '13 at 13:35
  • $\begingroup$ thank you guys for response @Imorin I think 2d representation .. @whuber♦ -are biplot and star coordinate similar you mean ? $\endgroup$ – solti May 3 '13 at 15:11
  • $\begingroup$ I have narrowed down my question .. how do I find the unit vector along x and y. $\endgroup$ – solti May 3 '13 at 15:25
10
$\begingroup$

The "star coordinates" are intended to be modified interactively, beginning with a default. This answer shows how to create the default; the interactive modifications are a programming detail.

The data are considered a collection of vectors $x_j = (x_{j1}, x_{j2}, \ldots, x_{jd})$ in $\mathbb{R}^d$. These are first normalized separately within each coordinate, linearly transforming the data $\{x_{ji}, j=1, 2, \ldots\}$ into the interval $[0,1]$. This is done, of course, by first subtracting their minimum from each element and dividing by the range. Call the normalized data $z_j$.

The usual basis of $\mathbb{R}^d$ is the set of vectors $e_i = (0, 0, \ldots, 0, 1, 0, 0, \ldots, 0)$ having a single $1$ in the $i^\text{th}$ place. In terms of this basis, $z_j = z_{j1}e_1 + z_{j2}e_2 + \cdots + z_{jd}e_d$. A "star coordinates projection" chooses a set of distinct unit vectors $\{u_i, i=1, 2, \ldots, d\}$ in $\mathbb{R}^2$ and maps $e_i$ to $u_i$. This defines a linear transformation from $\mathbb{R}^d$ to $\mathbb{R}^2$. This map is applied to the $z_j$--it is just a matrix multiplication--to create a two-dimensional point cloud, depicted as a scatterplot. The unit vectors $u_i$ are drawn and labeled for reference.

(An interactive version will allow the user to rotate each of the $u_i$ individually.)


To illustrate this, here is an R implementation applied to a dataset of automobile performance characteristics. First let's obtain the data:

library(MASS)
x <- subset(Cars93, 
       select=c(Price, MPG.city, Horsepower, Fuel.tank.capacity, Turn.circle))

The initial step is to normalize the data:

x.range <- apply(x, 2, range)
z <- t((t(x) - x.range[1,]) / (x.range[2,] - x.range[1,]))

As a default, let's create $d$ equally spaced unit vectors for the $u_i$. These determine the projection prj which is applied to $z$:

d <- dim(z)[2] # Dimensions
prj <- t(sapply((1:d)/d, function(i) c(cos(2*pi*i), sin(2*pi*i))))
star <- z %*% prj

That's it--we are all ready to plot. It is initialized to provide room for the data points, the coordinate axes, and their labels:

plot(rbind(apply(star, 2, range), apply(prj*1.25, 2, range)), 
     type="n", bty="n", xaxt="n", yaxt="n",
     main="Cars 93", xlab="", ylab="")

Here is the plot itself, with one line for each element: axes, labels, and points:

tmp <- apply(prj, 1, function(v) lines(rbind(c(0,0), v)))
text(prj * 1.1, labels=colnames(z), cex=0.8, col="Gray")
points(star, pch=19, col="Red"); points(star, col="0x200000")

Star plot


To understand this plot, it might help to compare it to a traditional method, the scatterplot matrix:

pairs(x)

Scatterplot matrix


A correlation-based principal components analysis (PCA) creates almost the same result.

(pca <- princomp(x, cor=TRUE))
pca$loadings[,1]
biplot(pca, choices=2:3)

The output for the first command is

Standard deviations:
   Comp.1    Comp.2    Comp.3    Comp.4    Comp.5 
1.8999932 0.8304711 0.5750447 0.4399687 0.4196363 

Most of the variance is accounted for by the first component (1.9 versus 0.83 and less). The loadings onto this component are almost equal in size, as shown by the output to the second command:

     Price           MPG.city         Horsepower Fuel.tank.capacity        Turn.circle 
 0.4202798         -0.4668682          0.4640081          0.4758205          0.4045867 

This suggests--in this case--that the default star coordinates plot is projecting along the first principal component and therefore is showing, essentially, some two-dimensional combination of the second through fifth PCs. Its value compared to the PCA results (or a related factor analysis) is therefore questionable; the principal merit may be in the proposed interactivity.

Although R's default biplot looks awful, here it is for comparison. To make it match the star coordinates plot better, you would need to permute the $u_i$ to agree with the sequence of axes shown in this biplot.

Biplot

$\endgroup$
1
$\begingroup$

In addition to the nice answer by @whuber, I would like to add some other options for displaying multidimensional (multivariate) data in "star coordinates", for the sake of more comprehensive coverage. My answer focuses on performing such visualization of multivariate data in R.

I will start by saying that star plots (in both spider and radar variants) are supported by R's base graphics package via function stars(): http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/stars.html. Next in the R "food chain" goes, obviously, ggplot2 package, which AFAIK currently doesn't have specific functions for this type of plots (please correct me, if I'm not up-to-date on this). However, a basic implementation by Hadley Wickham, using coord_polar(), can be found here. In addition, a ggplot2-based ggsubplot package offers the relevant function geom_star(): http://www.inside-r.org/packages/cran/ggsubplot/docs/geom_star.

Other packages that contain the star plotting functionality include: psych - functions spider() and radar() - http://personality-project.org/r/html/spider.html, plotrix - function radial.plot() - http://onertipaday.blogspot.com/2009/01/radar-chart.html) and, possibly, some others.

In addition to the above, it should be noted that it is possible to create star plots in Web-enabled software, which easily interfaces with R. For example, here is a variation of a star plot in plotly, where it's called polar area chart: https://plot.ly/r/polar-chart/#Polar-Area-Chart. Speaking about R and Web-enabled data visualization, it is impossible not to mention great D3.js library, which also can be accessed from R. Here is how to make a great-looking star plot, using D3.js: http://www.visualcinnamon.com/2013/09/making-d3-radar-chart-look-bit-better.html.

$\endgroup$
  • 2
    $\begingroup$ Your contribution is appreciated. However, it doesn't seem to be directly relevant to this thread. The paper referenced by the OP is interested in visualizations "... for cluster discovery and multi-factor analysis tasks." It views the coordinates, not the form of the plotting, to be the relevant innovation, claiming that they are "... advanced transformations that will improve data understanding in multi-dimensions [sic]." In particular, "star coordinates" are not merely the default coordinates in a radial star plot, as your answer seems to assume. $\endgroup$ – whuber Jan 12 '15 at 15:24
  • 1
    $\begingroup$ @whuber: Thanks for kind words and pointing out the issue. Upon re-reading the paper, I agree with your comment. There is an essential difference between suggested in the paper approach and the standard star plots approach. However, from the data visualization perspective and core idea of presenting (transformed) multidimensional data via polar coordinates system, they are still related. $\endgroup$ – Aleksandr Blekh Jan 12 '15 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.