Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graph panel data and color according to group

    Hi everyone,

    I’m working with panel data containing information on id, blood sampling date, protein levels and sex. Blood is sampled twice in some study participants and three and four times in others. There is usually 3-12 months between each sampling time.

    I can display the individual graphs of these protein levels over time using xtline. However, now I’d like to graph them and color them according to sex. Does anyone know how to do this? I’ve tried with xtline, twoway graph and linkplot but nothing has worked so for.

    My code for xtline is: xtline protein, overlay i(id) t(days_from_first_sampling)

    And the graph that is generated is attached.

    I'm using Stata v16.1 (on Mac).

    Hope someone has a solution to this. Many thanks!

    Gunnar
    Last edited by Gunnar Ek; 09 Feb 2023, 09:53.

  • #2
    Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	632.1 KB
ID:	1700945


    Here's the graph, but without coloring according to sex
    Last edited by Gunnar Ek; 09 Feb 2023, 09:54.

    Comment

    Working...
    X