CBX2 was positively associated with the infiltration of B cells, CD4+ T cells, and neutrophils in colon cancer patients, but there was no significant correlation in rectal cancer patients. Here, CBX2 is linked to rectal cancer.