Work and heat on a pressure-volume plot
A P-V diagram plots pressure on the vertical axis and volume on the horizontal. Each point represents one equilibrium state of the gas. When a gas expands (moving right), the area under the curve is the work done by the gas on its surroundings: W = integral of P dV. A steep vertical line represents a constant-volume process (isochoric), doing zero work. A flat horizontal line represents constant pressure (isobaric), doing work P times delta V. A hyperbolic curve (PV = constant) represents an isothermal process at fixed temperature. When a cyclic process closes on itself, the enclosed area is the net work done by the gas per cycle. If the loop goes clockwise (expanding at high pressure, compressing at low pressure), the engine extracts net work. If counterclockwise, the engine requires net work input (as in a refrigerator).
Thermodynamic processes and efficiency
The path a gas takes on the P-V diagram determines how much heat and work are exchanged, not just the initial and final states. A gas returning to the same pressure and volume after a round trip has zero change in internal energy (since U depends only on T for an ideal gas), so Q = W: the heat absorbed equals work done. But the heat absorbed on the high-pressure leg of the cycle may differ from heat rejected on the low-pressure leg. The ratio W/Q_in is the cycle efficiency. For a heat engine operating between two temperatures, the best possible cycle is the Carnot cycle, which appears as a specific shape on the P-V diagram and achieves the Carnot efficiency limit.