You seem to have confused the roles of a and b. The amplitude of is 2, while the amplitude of the graph is 4. The period of is , while the period of the function in the graph is .