0

I have a csv file with x, y data and x,y location columns. i.e.

Test,Xloc,Yloc,X,Y
1,1,1,1,1
1,1,1,2,2
1,1,1,3,3
1,1,1,4,4
2,4,4,1,1
2,4,4,2,2
2,4,4,3,3
2,4,4,4,4

Assuming the subplot is 4x4 how could I put a line plot at the 1,1 location for test 1, and the 4,4 location for test 2?

I have ggplot2, and ggsubplot packages installed. Seems maybe it's facet_grid, but not sure and not finding o good examples. Basically there is going to be areas on the figure where there is no subplot.

Jaap
  • 81,064
  • 34
  • 182
  • 193
user3646105
  • 2,459
  • 4
  • 14
  • 18
  • 1
    So this is the data you want to plot? How do you plan to use subplot with this? Can you give some idea what the output will be? – MrFlick May 30 '14 at 04:39
  • Not the data I want to plot, but you have to start small. The file I am using has over 1 million lines. I am going to pull the X,Y values from specific tests given a criteria and then plot those all onto one figure depending on their XY locations contained in the csv file. I can read the file and get all the data I want no problem. The best pic I have found that is somewhat similar is here http://revolution-computing.typepad.com/.a/6a010534b1db25970b0177448319ad970d-pi Mine would be line plots not bar plots. In python I used subplot2grid to accomplish this. – user3646105 May 30 '14 at 04:56
  • Even in that picture though not really what I will do. I want each plot to have it's own X and Y axis values to show for each sub plot. – user3646105 May 30 '14 at 05:00
  • 1
    It's best to edit your original question rather than adding info in comments. It can be more neatly organized that way. I must admit i'm still having a hard time understanding this because it's abstract. See the guide on [how to create reproducible examples](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for ideas about building sample data sets to illustrate your point. Please don't post 1 million lines, just enough to get the idea of what you want. – MrFlick May 30 '14 at 05:04
  • This python plot is closer to what I want to do http://matplotlib.org/users/tight_layout_guide-5.png but what I am plotting is tested over a circular pattern, so the sub plots would be laid out in a circular fasion. Basically trying to see if issues exist on certain areas of the surface tested. – user3646105 May 30 '14 at 05:13
  • OK, I'll start adding to the original question instead. – user3646105 May 30 '14 at 05:15

1 Answers1

0

Is this is what you are trying to achieve?

temp <- read.csv(text = "
Test,Xloc,Yloc,X,Y
1,1,1,1,1
1,1,1,2,2
1,1,1,3,3
1,1,1,4,4
2,4,4,1,1
2,4,4,2,2
2,4,4,3,3
2,4,4,4,4")

library(ggplot2)
ggplot(temp, aes(X, Y)) + geom_line() + facet_wrap(~ Test, scales = "free")

enter image description here

David Arenburg
  • 91,361
  • 17
  • 137
  • 196