added handling of margins for axis labels