Genes are ordered by descending alteration frequency, then samples are ordered so that the most frequently altered gene's carriers come first, ties broken by the next gene down. This is the "memo sort" cBioPortal popularised; it is what makes mutual exclusivity between drivers visible as a staircase.
Details
Exposed separately so a caller can compute the order once and reuse it for
both an interactive oncoplot() and a static rendering, rather than letting
two implementations tie-break differently.