The Matsubara formalism, also referred to as imaginary time formalism, can be extended to systems with thermal variations. In this approach, the variation in the temperature is recast as a variation in the Euclidean metric. Analysis of the partition function leads to an equivalence between thermal variations and the curvature of the Euclidean space.