In this graph 81 cells have being ordered by pseudo time. For example cell s0.76 has been placed at the start of pseudo time and cell s0.11 placed at the end of pseudo time.

![enter image description here][1]

This is the expression profile of this gene on this pseudo time

    > Data

    s0.76     s0.52     s0.72     s0.36     s0.18     s0.60     s0.54     s0.65     s0.56      s0.4     s0.14     s0.67      s0.1     s0.22     s0.28     s0.80     s0.16     s0.32 
     6354.316  2376.278  8037.063  4879.946  4989.872  5382.370 13239.227 12085.752  5510.481  9311.501  5303.664 13480.634  9085.402  9585.708 12678.642  8595.338 13901.138  9809.339 
         s0.8     s0.55     s0.71     s0.41     s0.40     s0.48     s0.68     s0.81     s0.29     s0.78     s0.34     s0.42     s0.13      s0.9      s0.7     s0.24     s0.62     s0.35 
    12554.518 11001.622  6676.949  9266.956  5303.998 13405.392  8327.440  6903.236  9319.111  4427.627 11029.422  5370.687  4854.454 13199.522  5125.644 11687.103  7546.622  8656.206 
        s0.23     s0.21     s0.37     s0.25     s0.79     s0.64     s0.44     s0.15     s0.43     s0.63     s0.10      s0.6     s0.19     s0.31     s0.38     s0.39     s0.73     s0.59 
     4578.953 15771.795  3217.201  6362.859 11523.728  5977.613  4805.703  5373.737  2393.996  9104.929  3532.215  7974.742  4949.271  3285.566 10896.503  3746.348  4296.337  6510.001 
         s0.2     s0.12     s0.61     s0.66     s0.51     s0.58     s0.50     s0.27     s0.77     s0.69     s0.33     s0.17     s0.74     s0.26     s0.57     s0.49     s0.70     s0.53 
     3728.896  8761.615  3896.014  2618.151  4106.299 11898.634  2978.410  3129.880  5571.995  4314.655  3867.158  2209.066  1723.784  2741.320  4570.466  5506.473  3120.334  7284.682 
        s0.30     s0.45      s0.5     s0.47     s0.46     s0.75     s0.20      s0.3     s0.11 
     9454.997  7446.095  4765.971  7861.282 10393.357  4809.735 12421.501 12615.785 22238.399 

Now, my question is, how I could color the plot by knowing a set of cells are in G2 and another set are in S/M phase of cell cycle like this picture?

![enter image description here][2]

These cells are at G2

    [1] "s0.1"  "s0.2"  "s0.3"  "s0.6"  "s0.7"  "s0.8"  "s0.9"  "s0.10" "s0.12" "s0.13" "s0.14" "s0.15" "s0.16" "s0.19" "s0.21" "s0.22" "s0.23" "s0.24" "s0.25" "s0.28" "s0.29" "s0.31"
    [23] "s0.32" "s0.34" "s0.35" "s0.37" "s0.38" "s0.39" "s0.42" "s0.43" "s0.44" "s0.48" "s0.50" "s0.51" "s0.54" "s0.55" "s0.56" "s0.59" "s0.60" "s0.61" "s0.62" "s0.63" "s0.64" "s0.65"
    [45] "s0.66" "s0.67" "s0.68" "s0.70" "s0.71" "s0.73" "s0.78" "s0.79" "s0.80" "s0.81"


these cells are in M/S


     [1] "s0.4"  "s0.5"  "s0.11" "s0.17" "s0.18" "s0.20" "s0.26" "s0.27" "s0.30" "s0.33" "s0.36" "s0.40" "s0.41" "s0.45" "s0.46" "s0.47" "s0.49" "s0.52" "s0.53" "s0.57" "s0.58" "s0.69"
    [23] "s0.72" "s0.74" "s0.75" "s0.76" "s0.77"


I tried to do that by this codes but the order of cells is not based on the pseudo time

    > head(data)
             value  cell capture
    1  30.59486 s0.76      G2
    2  78.12876 s0.52      G2
    3  63.36236 s0.72      G2
    4  54.48303 s0.36     m/s
    5 196.49463 s0.18     m/s
    6  59.76789 s0.60      G2
    > 


![enter image description here][3]


  [1]: https://image.ibb.co/gEKXsK/Rplot.jpg
  [2]: https://image.ibb.co/c5PJzz/btw372f3p.jpg
  [3]: https://image.ibb.co/gptvCK/Rplot01.jpg

    > p=ggplot(data, aes(x=cell, y=value, color=capture))
    > p+geom_point(alpha=.3)
    p+geom_point(alpha=.3)+scale_x_discrete(limits=as.factor(data$cell))