The solar panels should never be flush with the roof. This is because, on very hot days, the heat generated can leak through to your attic and cause it to overheat. Therefore, most manufacturers recommend a gap of four inches between the panels and the roof itself.The gap between the last row of solar panels and the roof's edge should be a minimum of 12 inches or one foot. This ensures the panels are accommodated as they expand and contract during the day. See also: Mounting Solar Panels: A Complete Beginner's Guide to InstallationIt is best to leave four to seven inches of space between two solar panels. Again, this accommodates the solar panels' expansion and contraction during the day.The gap between solar panel rows should be around five to six inches, but it is also recommended that you leave one to three feet of space between every second or third row. This is because maintenance workers need enough room to get on the roof and make repairs whenever necessary.Flexible solar panels are used on cars, RVs, boats, and so on, and they are sometimes installed directly onto the surface of these devices without an air gap between them. Studies in Australia and other countries have proven that when flexible solar panels are placed next to one another, with one set having an air gap and another not having a gap,.