Deviation from ideal gas law curves So I was reading through my textbook on deviations from an ideal gas, and they had plotted a curve of experimental PV/nRT against the pressure.



They talk a lot about why the volume is really smaller than what the ideal gas predicts, and so on, and thats why as the pressure increases, the deviation from the ideal gas law increases. They further accredit the imbalances to IMFs, and how when the molecules are in closer contact, they tend to form stronger and more IMFs. This all makes sense. This would imply that as the pressure increases or as the temperature decreases, the deviation from the ideal gas would be increasingly over 1. However, when looking at the curve they present, it isn't a clear direct path from no deviation to much deviation. For example, when looking at Methane, CH4, at 200 atm it has a certain negative magnitude, yet at 400 atm, it is back to acting like a ideal gas. 

What causes this section of the curve[P=0 to P=400] of Methane that doesn't follow the general trend of increasing pressure --> more deviation from ideal gas?
There are 2 deviation terms of the opposite sign. 

The negative deviation term relates to the attractive forces between molecules, decreasing pressure,and is directly related to condensation ability of real gases.

The positive deviation term  relates to non-negligible own volume of molecules, compared to the total gas volume, leading to higher than ideal pressure, as with the higher own volume, the frequency of collisions with wall is higher.

These 2 effects sum to the overall deviation and in some circumstances may cancel each other.

For "permanent gasses" like hydrogen, helium, neon, nitrogen, the negative term is small and there is more or less steady increase of positive deviation with pressure.

For gases that are easy to turn into liquid ( see critical temperature and pressure ) like methane or carbon dioxide, the negative term is dominant for lower pressures and temperatures. If they are high enough, the dominance is overtaken by the positive term.

A lot of insight can be gained from van der Waals equation Wikipedia page