Force-displacement graph and work done by gases
If the force varies in magnitude with the displacement of the object, the total work done by the force is given by the area under the graph of $$F$$ vs $$s$$.
$$F=$$force; $$s=$$displacement in the direction of the force.
The expansion or compression of a gas acted on by an external pressure also involves work.
This is because a gas exerts a force on the inner surfaces of a container due to pressure. When the volume of the container changes, work is done by the gas (or the container).