factor histogram into its own class