Added styles_order argument to allow order of stacked data to be specified; reintroduced option for tests to output to pdf (but switched off).