MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / plotWrapper

Function plotWrapper

src/api/c/plot.cpp:131–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131af_err plotWrapper(const af_window window, const af_array in,
132 const int order_dim, const af_cell* const props,
133 fg_plot_type ptype = FG_PLOT_LINE,
134 fg_marker_type marker = FG_MARKER_NONE) {
135 try {
136 if (window == 0) { AF_ERROR("Not a valid window", AF_ERR_INTERNAL); }
137
138 const ArrayInfo& info = getInfo(in);
139 af::dim4 dims = info.dims();
140 af_dtype type = info.getType();
141
142 DIM_ASSERT(0, dims.ndims() == 2);
143 DIM_ASSERT(0, dims[order_dim] == 2 || dims[order_dim] == 3);
144
145 makeContextCurrent(window);
146
147 fg_chart chart = NULL;
148
149 switch (type) {
150 case f32:
151 chart = setup_plot<float>(window, in, dims[order_dim], props,
152 ptype, marker);
153 break;
154 case s32:
155 chart = setup_plot<int>(window, in, dims[order_dim], props,
156 ptype, marker);
157 break;
158 case u32:
159 chart = setup_plot<uint>(window, in, dims[order_dim], props,
160 ptype, marker);
161 break;
162 case s16:
163 chart = setup_plot<short>(window, in, dims[order_dim], props,
164 ptype, marker);
165 break;
166 case u16:
167 chart = setup_plot<ushort>(window, in, dims[order_dim], props,
168 ptype, marker);
169 break;
170 case s8:
171 chart = setup_plot<schar>(window, in, dims[order_dim], props,
172 ptype, marker);
173 break;
174 case u8:
175 chart = setup_plot<uchar>(window, in, dims[order_dim], props,
176 ptype, marker);
177 break;
178 default: TYPE_ERROR(1, type);
179 }
180
181 auto gridDims = forgeManager().getWindowGrid(window);
182
183 ForgeModule& _ = forgePlugin();
184 if (props->col > -1 && props->row > -1) {
185 FG_CHECK(_.fg_draw_chart_to_cell(
186 window, gridDims.first, gridDims.second,
187 props->row * gridDims.second + props->col, chart,
188 props->title));

Callers 10

af_draw_plot_ndFunction · 0.85
af_draw_plot_2dFunction · 0.85
af_draw_plot_3dFunction · 0.85
af_draw_plotFunction · 0.85
af_draw_plot3Function · 0.85
af_draw_scatter_ndFunction · 0.85
af_draw_scatter_2dFunction · 0.85
af_draw_scatter_3dFunction · 0.85
af_draw_scatterFunction · 0.85
af_draw_scatter3Function · 0.85

Calls 9

makeContextCurrentFunction · 0.85
getWindowGridMethod · 0.80
isVectorMethod · 0.80
af_join_manyFunction · 0.70
af_release_arrayFunction · 0.70
af_joinFunction · 0.70
dimsMethod · 0.45
getTypeMethod · 0.45
ndimsMethod · 0.45

Tested by

no test coverage detected