The atmosphere of the temperature varies from place to place
because of the composition of the gases in each layer of the atmosphere doesn't change as per say. Our atmosphere is made of about 80 percent nitrogen, 20 percent oxygen and various so-called rare gases in minute quantities.
But as pressure and solar radiation changes with altitude, it reacts differently and e.g. radiation is responsible for the ozone found in the stratosphere. But you also have ozone created at the earth surface, but then, from another origin; from human fuel consumption.
In any case, the temperature sinks with the average lapse rate of 0.65 per 100 meter, as you probably know, and this, to the tropopause; the top of our troposphere. From here, the temperature starts, first slowly to rise as we move into the stratosphere, then the mesosphere, and the ionosphere. So I am sure that it is due to composition of gases in the atmosphere