| 52 | {{{ |
| 53 | #!cpp |
| 54 | |
| 55 | vector<double> data1; |
| 56 | deque<double> data2; |
| 57 | boost::array<double, 10> data3; |
| 58 | |
| 59 | svg_plot my_plot; |
| 60 | |
| 61 | // size/scale settings |
| 62 | my_plot.set_image_size(500, 350) |
| 63 | .set_x_scale(-3, 10); |
| 64 | |
| 65 | // Text settings |
| 66 | my_plot.set_title("Oh My!") |
| 67 | .set_title_font_size(29) |
| 68 | .set_x_label_text("Time in Months"); |
| 69 | |
| 70 | // command settings |
| 71 | my_plot.set_axis(true) |
| 72 | .set_legend(true) |
| 73 | .set_plot_window(true) |
| 74 | .set_x_label(true) |
| 75 | .set_x_major_labels(true); |
| 76 | |
| 77 | // color settings |
| 78 | my_plot.set_background_color(svg_color(67, 111, 69)) |
| 79 | .set_legend_background_color(svg_color(207, 202,167)) |
| 80 | .set_plot_background_color(svg_color(136, 188, 126)) |
| 81 | .set_title_color(white) |
| 82 | .set_x_axis_color(black) |
| 83 | .set_x_major_tick_color(black) |
| 84 | .set_legend_border_color(svg_color(102, 102, 84)) |
| 85 | .set_x_minor_tick_color(black); |
| 86 | |
| 87 | //axis settings |
| 88 | my_plot.set_x_major_tick(2) |
| 89 | .set_x_num_minor_ticks(3) |
| 90 | .set_x_major_tick_length(14) |
| 91 | .set_x_minor_tick_length(7) |
| 92 | .set_x_major_tick_width(1) |
| 93 | .set_x_minor_tick_width(1); |
| 94 | |
| 95 | //legend settings |
| 96 | my_plot.set_legend_title_font_size(15); |
| 97 | |
| 98 | plot_range(my_plot, data2.begin(), data2.end(), "Lions", blue); |
| 99 | plot_range(my_plot, data1.begin(), data1.end(), "Tigers", purple); |
| 100 | plot_range(my_plot, data3.begin(), data3.end(), "Bears", red); |
| 101 | |
| 102 | my_plot.write("D:/1d_complex.svg"); |
| 103 | |
| 104 | }}} |