Hi,
Because I wanted to customize the properties of the boxplots, I abandoned using --graph box-- and tried the approach presented by Nick Cox in https://www.stata-journal.com/sjpdf....iclenum=gr0039
For each of my 78 values of 'id', I want to graph a box plot for variable 'duration.' I want the figure to be -by(group)-.
I adapted his code and used the following code:
This results in the following figure.
Obviously, the legibility of this figure is limited. There are two things that I want to improve on:
- In each subgraph, omit empty values of 'id' (x-axis)
- In each subgraph, sort the boxes on the median value
Unfortunately I am unable to provide a dataset as it is confidential data.
Because I wanted to customize the properties of the boxplots, I abandoned using --graph box-- and tried the approach presented by Nick Cox in https://www.stata-journal.com/sjpdf....iclenum=gr0039
For each of my 78 values of 'id', I want to graph a box plot for variable 'duration.' I want the figure to be -by(group)-.
I adapted his code and used the following code:
Code:
egen p975 = pctile(duration), p(97.5) by(group) egen p025 = pctile(duration), p(2.5) by(group) twoway (rbar median upq id, pstyle(p1) bfc(gs15) blc(gs8) barw(0.35)) /* */ (rbar median loq id, pstyle(p1) bfc(gs15) blc(gs8) barw(0.35)) /* */ (rspike upq p975 id, pstyle(p1)) /* */(rspike loq p025 id, pstyle(p1)) /* */ (scatter duration id if !inrange(duration, p025, p975), msize(vsmall) ms(Oh) legend(off)), by(group, rows(1))
Obviously, the legibility of this figure is limited. There are two things that I want to improve on:
- In each subgraph, omit empty values of 'id' (x-axis)
- In each subgraph, sort the boxes on the median value
Unfortunately I am unable to provide a dataset as it is confidential data.
Comment