i am trying to plot individual longitudinal growth trajectories for height data. i have 876 individuals and would like the trajectory for each individual. if i use the code below the graphs are so tiny as to be of no use. is there way of increasing the size of the graphs so they become visible.
a snippet of the data is given below.
id_comb
ht
black
female
age
203
148.1
0
1
9.804444992
203
154.2
0
1
10.68057523
203
162.8
0
1
11.76752432
203
169.7
0
1
12.777812
203
169.6
0
1
13.76619643
203
170.6
0
1
14.691609
203
171.9
0
1
15.77582017
203
172.1
0
1
16.6848053
203
171.1
0
1
17.69783089
203
172.5
0
1
18.82858649
203
172.1
0
1
22.14966769
207
137.1
0
1
9.790755457
207
146.0
0
1
10.93520059
207
157.8
0
1
12.90923154
207
162.7
0
1
13.96058783
207
164.2
0
1
14.92159319
207
165.5
0
1
16.04139715
207
166.0
0
1
17.31999973
207
165.7
0
1
18.10304113
208
132.2
0
0
9.911223365
349
148.5
1
1
12.80792898
349
152.1
1
1
14.15224132
349
152.8
1
1
14.71351226
349
152.4
1
1
15.54309808
349
153.9
1
1
16.58350274
349
153.8
1
1
17.72247206
349
153.3
1
1
18.73002183
the code i have used is below.
library(ggplot2)
library(nlme)
library(haven)
females_black <- read_sas("C:/Users/rchiruka/Desktop/phd r code/females_black.sas7bdat",
NULL)
I'll start by saying your goal is not going to work well. Showing 876 groups of data simultaneously, with each meant to be examined individually, isn't feasible. You might need to focus more on what you're looking for to choose an appropriate visualization.
If you're looking for "weird" trajectories, then write a test for weirdness. Plot only trajectories flagged as weird.
If you have no idea what you're looking for, plot each trajectory individually, but use the same scales for all of them. Maybe save the plots with ggsave, and then browse the output files with your image viewer of choice. Hopefully, you'll find out what's "important" and go to option #1.
If this is for a report which requires you to include trajectories for all individuals, then you could stick them all in the back as an appendix. If the report will be HTML and you're comfortable with JavaScript, you could include a <select> control which lets you see only a handful at once.
As one option that doesn't require any knowledge of Javascript, I can recommend this package - trelliscopejs. It's quite good for exactly this purpose - visualizing small multiples in an interactive manner.