Correct setup of margins for logarithmic plots

The current formula for setting margins is false in case of log plots. Here is a tested suggestion handling the special case. Please see if this can be backported to the current release candidate (perhaps even beyond), as it seems mandatory to have a correct way of setting margins for log plots.