Fix auto scale domain on stacked plot.

Retarget fo #1360.
Close #1340.