Let's pretend I want to add an hyperbolic curve to this plot
data(cars)
xyplot(dist ~ speed, cars)
Even though, such function won't fit data, the curve should be like the one you see in the picture. Could you please suggest to me the proper code?

You can add the various components as a function provided to the
panelparameter ofxyplot().In this case we can use:
panel.xyplot()to plot the points.panel.lines()for the horizontal line at the mean.panel.text()for the label saying "mean".panel.curve()for the hyperbolic function. As you've said it doesn't fit the data I've just eyeballed a function that looks similar. You can change this by editing thefunandline_scaleparameters.All these functions and their parameters are set it out in the
latticepanel functions docs.