Generally the gas metallicity in distant galaxies can only be inferred by
using a few prominent emission lines. Various theoretical models have been used
to predict the relationship between emission line fluxes and metallicity,
suggesting that some line ratios can be used as diagnostics of the gas
metallicity in galaxies. However, accurate empirical calibrations of these
emission line flux ratios from real galaxy spectra spanning a wide metallicity
range are still lacking. In this paper we provide such empirical calibrations
by using the combination of two sets of spectroscopic data: one consisting of
low-metallicity galaxies with a measurement of [OIII]4363, and the other one
consisting of galaxies in the SDSS DR4 whose metallicity has been determined
from various strong emission lines in their spectra. This combined data set
constitutes the largest sample of galaxies with information on the gas
metallicity available so far and spanning the widest metallicity range. Our
empirical diagrams show that the line ratio [OIII]/[OII] is a useful tool to
break the degeneracy in the R_23 parameter when no information on the [NII]
line is available. The line ratio [NeIII]/[OII] also results to be a useful
metallicity indicator for high-z galaxies. Finally, we compare these empirical
relations with photoionization models. We find that the empirical
R_23-metallicity sequence is strongly discrepant with respect to the trend
expected by models with constant ionization parameter, which is interpreted as
a consequence of a strong metallicity dependence of the average ionization
parameter in galaxies. This result should warn about the use of theoretical
models with constant ionization parameter to infer metallicities from observed
line ratios. (abbreviated)Comment: 27 pages, 19 figures, Astronomy and Astrophysics, in press. (Replaced
with the accepted version.