VOOZH about

URL: https://www.geeksforgeeks.org/r-language/parallel-chart-with-the-mass-library-in-r/

⇱ Parallel chart with the MASS library in R - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Parallel chart with the MASS library in R

Last Updated : 23 Jul, 2025

To analyze and visualize high-dimensional data, one can use Parallel Coordinates. A background is drawn consisting of n parallel lines, often vertical and evenly spaced, to display a set of points in an n-dimensional space. A point in n-dimensional space is represented by a polyline with vertices on parallel axes; the ith coordinate of the point corresponds to the position of the vertex on the ith axis.

Parallel chart with the MASS library in R Programming Language

This representation is similar to time series visualization, except that it is used with data that does not have a natural order because the axes do not correlate to points in time. As a result, several axis layouts may be of interest.

Parallel Coordinates with MASS Library

The parcoord() function in the MASS package creates a parallel coordinates chart automatically. A data frame with solely numeric variables can be used as the input dataset. Each variable will be utilized to construct one of the chart's vertical axes.

Output:

 Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
👁 Image

Customizing the Color Palette

Basically, there are not any built-in methods or attributes in this package for color customization. We will use colorRampPalette() methods color range between two colors specified points

Output:

 Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
👁 Image
Comment
Article Tags:
Article Tags:

Explore