Turi Create  4.0
categorical_heatmap.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef __TC_CATEGORICAL_HEATMAP
7 #define __TC_CATEGORICAL_HEATMAP
8 
9 #include <core/data/sframe/gl_sframe.hpp>
10 #include <core/storage/sframe_data/groupby_aggregate_operators.hpp>
11 #include <visualization/server/plot.hpp>
12 #include "transformation.hpp"
13 
14 namespace turi {
15 namespace visualization {
16 
17 class categorical_heatmap_result: public transformation_output,
19  public:
20  virtual std::string vega_column_data(bool sframe) const override;
21 };
22 
23 // expects a gl_sframe of:
24 // "x": str,
25 // "y": float
26 typedef transformation<gl_sframe, categorical_heatmap_result> categorical_heatmap_parent;
27 
28 class categorical_heatmap : public categorical_heatmap_parent {
29  public:
30  virtual std::vector<categorical_heatmap_result> split_input(size_t num_threads) override;
31  virtual void merge_results(std::vector<categorical_heatmap_result>& transformers) override;
32 };
33 
34 std::shared_ptr<Plot> plot_categorical_heatmap(
35  const gl_sarray& x,
36  const gl_sarray& y,
37  const flexible_type& xlabel,
38  const flexible_type& ylabel,
39  const flexible_type& title);
40 
41 }} // turi::visualization
42 
43 #endif // __TC_CATEGORICAL_HEATMAP