geom_tile : How to group by individual sequences of two different plots?


I would like to group sequence plots by individual.

I use ggpattern() to visualize the intertwining of the administrative and economic paths of foreigners who go through the French asylum system. The "administrative states" are coded as administrative situations of the individuals ((il)legality and protection of the stay in France) and the economic states are coded as income brackets (from aid or work). The time step is monthly. The number of invididuals is about 20. This is why I don't use the Traminer package dedicated to sequences but the 'ggplot2' builer add-in which is more intuitive and better adapted to my level on R and my objectives: to visualize paths and not to statistically build a typology of transitions.

For each pathway (administrative and economic), I built a distinct table in .csv format according to the principle: one row per individual, one column per monthly observation. Then I put them in tidy format with the function "gather" to have one line per individual and per time step. With geom_tile() I have drawn independently the two sequence index plots (administrative and economic).

With plot_grid() I can put these graphs one above the other, see figure 1.

This does not correspond to what I want to do, see figure 2 (handmade for two individuals only).

Do you know if it is possible to do this? Is it necessary to restructure the data or is it done at the time of the production of the plots?

Thanks in advance.


I'd suggest the same thing as was suggested at your cross-posted question at StackOverflow: it will be much easier for people to help if you can make your question reproducible, by including some sample data and code that people can run. Prose descriptions of your data and code leave a lot of room for misunderstanding, and require each person who wants to try to help to create their own data set to test potential solutions on.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.