Heterogeneity is likely to be an important determinant of the shape of optimal tax schemes. This article addresses the issue in a model à la Mirrlees with a continuum of agents. The agents differ in their productivities and opportunity costs of work, but their labor supplies depend only on a unidimensional combination of their two characteristics. Conditions are given under which the standard result that marginal tax rates are everywhere non-negative holds. This is in particular the case when work opportunity costs are distributed independently of productivities. But one can also get negative marginal tax rates: economies where negative tax rates are optimal at the bottom of the income distribution are studied, and a numerical illustration is given, based on UK data.