Based on the first principles calculation combined with quasi-harmonic approximation, in this work we focus on the analysis of temperature dependent lattice geometries, thermal expansion coefficients, elastic constants and ultimate strength of graphene and graphyne. For the linear thermal expansion coefficient, both graphene and graphyne show a negative region in the low temperature regime. This coefficient increases up to be positive at high temperatures. Graphene has superior mechanical properties, with Young modulus E 11 =371.0 N/m, E 22 =378.2 N/m and ultimate tensile strength of 119.2 GPa at room temperature. Based on our analysis, it is found that graphene's mechanical properties have strong resistance against temperature increase up to 1200 K. Graphyne also shows good mechanical properties, with Young modulus E 11 =224.7 N/m, E 22 =223.9 N/m and ultimate tensile strength of 81.2 GPa at room temperature, but graphyne's mechanical properties have a weaker resistance with respect to the increase of temperature than that of graphene.