Frédéric Chopin composed his Scherzo No. 4 in E major, Op. 54, the fourth and the last of his scherzos in 1842. The scherzo was published in 1843. Unlike the preceding three scherzi (Op. 20, Op. 31, Op. 39), the E major is generally calmer in temperament, though it still possesses some exceptionally passionate and dramatic moments.
Scherzo No. 4 (Chopin) Wikipedia
The scherzo is in sonata rondo form. The main theme is in E major. During the first section, the main theme modulates to A flat major and back in the home key. Then it moves to a trio in C-sharp minor and secondly in F major that is based on a Polish folk song. As such, it is the only one of Chopin's four scherzos primarily based on a major key.