| 248 | } |
| 249 | |
| 250 | std::string surface::plot_string() { |
| 251 | std::stringstream ss; |
| 252 | ss.precision(10); |
| 253 | ss << std::fixed; |
| 254 | // plot surface |
| 255 | bool is_solid_surface = palette_map_at_bottom_ || |
| 256 | palette_map_at_surface_ || palette_map_at_top_; |
| 257 | |
| 258 | decltype(C_data_)::value_type::const_iterator min_it, max_it; |
| 259 | if (fences_ && !C_data_.empty()) { |
| 260 | std::tie(min_it, max_it) = |
| 261 | std::minmax_element(C_data_[0].begin(), C_data_[0].end()); |
| 262 | } |
| 263 | |
| 264 | // if we have a waterfall or fences, we create one command per row |
| 265 | // if we have ribbons, we create one command per column |
| 266 | size_t n_plots = (waterfall_ || fences_) ? Z_data_.size() |
| 267 | : ribbons_ ? Z_data_[0].size() |
| 268 | : 1; |
| 269 | for (size_t i = 0; i < n_plots; ++i) { |
| 270 | if (i != 0) { |
| 271 | ss << ",\\\n "; |
| 272 | } |
| 273 | if (is_solid_surface) { |
| 274 | // size_t line_index = create_line_index(); |
| 275 | ss << " '-' with"; |
| 276 | if (!fences_) { |
| 277 | ss << " pm3d at "; |
| 278 | if (palette_map_at_bottom_) { |
| 279 | ss << "b"; |
| 280 | } |
| 281 | if (palette_map_at_surface_) { |
| 282 | ss << "s"; |
| 283 | } |
| 284 | if (palette_map_at_top_) { |
| 285 | ss << "t"; |
| 286 | } |
| 287 | // ss << " linestyle " << line_index; |
| 288 | if (line_spec_.user_color()) { |
| 289 | ss << " " |
| 290 | << line_spec_.plot_string( |
| 291 | line_spec::style_to_plot::plot_line_only, |
| 292 | false); |
| 293 | } else { |
| 294 | // Default line style for surfaces is black |
| 295 | // we don't follow the color order from the axes |
| 296 | // This would just be too ugly for surfaces. |
| 297 | ss << " " |
| 298 | << " linecolor rgb \"black\" dashtype 1 linewidth " |
| 299 | "0.5 linetype -1"; |
| 300 | } |
| 301 | } else { |
| 302 | ss << " zerrorfill"; |
| 303 | if (!line_spec_.user_color()) { |
| 304 | color_array c; |
| 305 | if (C_data_.empty()) { |
| 306 | size_t color_index = |
| 307 | i % parent_->colororder().size(); |
no test coverage detected