Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:37:02+00:00 2026-06-18T02:37:02+00:00

I want to plot multiple parallel coordinate plots from one dataset. Currently I have

  • 0

I want to plot multiple parallel coordinate plots from one dataset. Currently I have a working solution with split and l_ply which produces 4 ggplot2 objects. I would like to solve this with facet_wrap or facet_grid to have a more compact layout and a single legend. Is this possible?

With a normal ggplot2 object (boxplot) facet_wrap works perfectly. With the GGally functionggparcoord() I get the error Error in layout_base(data, vars, drop = drop) :
At least one layer must contain all variables used for facetting

What am I doing wrong?

require(GGally)
require(ggplot2)
# Example Data
x <- data.frame(var1=rnorm(40,0,1),
                var2=rnorm(40,0,1),
                var3=rnorm(40,0,1),
                type=factor(rep(c("x", "y"), length.out=40)),
                set=factor(rep(c("A","B","C","D"), each=10))
                )
# this works
p1 <- ggplot(x, aes(x=type, y=var1, group=type)) + geom_boxplot()
p1 <- p1 + facet_wrap(~ set)
p1 
# this does not work
p2 <- ggparcoord(x, columns=1:3, groupColumn=4) 
p2 <- p2 + facet_wrap(~ set)
p2 

Any suggestions are appreciated! Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:37:04+00:00Added an answer on June 18, 2026 at 2:37 am

    You can’t use directly facet_wrap() with function ggparcoord() because this function use as data only those columns which are specified in call to this function. It can be seen by looking on data element of p2. There is no column named set.

     p2 <- ggparcoord(x, columns=1:3, groupColumn=4)
     head(p2$data)
      type .ID anyMissing variable       value
    1    x   1      FALSE     var1  0.95473093
    2    y   2      FALSE     var1 -0.05566205
    3    x   3      FALSE     var1  2.57548872
    4    y   4      FALSE     var1  0.14508261
    5    x   5      FALSE     var1 -0.92022584
    6    y   6      FALSE     var1 -0.05594902
    

    To get the same type of plot with faceting, first, you need to add new column (contains just numbers corresponding to number of cases) to existing data frame and then reshape this data frame.

    x$ID<-1:40
    df.x<-melt(x,id.vars=c("set","ID","type"))
    

    Then use function ggplot() and geom_line() to plot data.

    ggplot(df.x,aes(x=variable,y=value,colour=type,group=ID))+
       geom_line()+facet_wrap(~set)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple sets of xy pairs that I want to plot. I want
I have a plot in matplotlib with multiple subplots(axes), and I want to annotate
I want to plot multiple bounded functions in gnuplot. I.e. plot x from 0
I want to have multiple lines on the same plot. Multiple data points. In
I have multiple datasets I want to plot in a single figure: plot data1a.txt,
I want to plot multiple rowstacked histograms on the same graph using gnuplot. A
I want to plot email from and to in world. For example, I received
I have a data which I want to plot in cumulative function. The R
I have the data in two files. I want to plot a graph the
With this approach. I have a line plot graph. I want to plot 'two'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.