hi everyone,
I would like to graph a box plot with two boxes within it. Moreover, because my data is kind of binary distributed, I only want to use part them by using if statement.
The data looks as follows:
The code I used for making the plots is very straightforward:
The plot looks like: 
Because the A_value and B_value is equivalent, I only need one Y-axis for both boxes. But the code above will generate two Y-axes. Please give me some advice on this problem. Thanks so much.
I would like to graph a box plot with two boxes within it. Moreover, because my data is kind of binary distributed, I only want to use part them by using if statement.
The data looks as follows:
time_point | A_value | A_label | B_value | B_label |
point 1 | 1 | 1 | 0.1 | . |
point 2 | 0.6 | 1 | 0.2 | . |
point 3 | 0.3 | 1 | 0.1 | 1 |
point 4 | 0.2 | . | 0.1 | 1 |
point 5 | 0.9 | . | 0 | 1 |
point 6 | 0 | 1 | 0 | 1 |
point 7 | 0.7 | . | 0.9 | 1 |
point 8 | 0.3 | 1 | 1 | 1 |
point 9 | 0.2 | 1 | 0.8 | 1 |
point 10 | 0.2 | . | 0.7 | 1 |
point 11 | 0.1 | 1 | 0.3 | 1 |
point 12 | 0.1 | 1 | 0.3 | 1 |
point 13 | 1 | 1 | 1 | . |
point 14 | 0.8 | 1 | 0.6 | . |
Code:
graph box A_value if A_value>0.6& A_value!=.& label_A!=., ytitle("A_value") name(g1, replace ) noout graph box B_value if B_value>0.6& B_value!=.& label_B!=., ytitle("B_value") name(g2, replace ) noout graph combine g1 g2, row(1) ycom //The value ranges from 0~1, but I only want to plot values greater than 0.6 and happen to be "labeled" (i.e. in the label columns is labeled as 1).
Because the A_value and B_value is equivalent, I only need one Y-axis for both boxes. But the code above will generate two Y-axes. Please give me some advice on this problem. Thanks so much.
Comment