()
| 359 | |
| 360 | #[test] |
| 361 | fn draw_works_2() { |
| 362 | let xx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; |
| 363 | let yy = [5, 4, 3, 2, 1, 0, 1, 2, 3, 4]; |
| 364 | let mut bar = Barplot::new(); |
| 365 | bar.set_label("LABEL") |
| 366 | .set_colors(&vec!["red", "green"]) |
| 367 | .set_width(10.0) |
| 368 | .set_bottom(&[1.0, 2.0, 3.0]) |
| 369 | .set_with_text("center") |
| 370 | .set_extra("edgecolor='black'") |
| 371 | .draw(&xx, &yy); |
| 372 | let b: &str = "x=np.array([0,1,2,3,4,5,6,7,8,9,])\n\ |
| 373 | y=np.array([5,4,3,2,1,0,1,2,3,4,])\n\ |
| 374 | colors=['red','green',]\n\ |
| 375 | bottom=np.array([1,2,3,])\n\ |
| 376 | p=plt.bar(x,y\ |
| 377 | ,label=r'LABEL'\ |
| 378 | ,color=colors\ |
| 379 | ,width=10\ |
| 380 | ,bottom=bottom\ |
| 381 | ,edgecolor='black')\n\ |
| 382 | plt.gca().bar_label(p,label_type='center')\n"; |
| 383 | assert_eq!(bar.buffer, b); |
| 384 | bar.clear_buffer(); |
| 385 | bar.set_with_text(""); |
| 386 | assert_eq!(bar.buffer, ""); |
| 387 | } |
| 388 | |
| 389 | #[test] |
| 390 | fn draw_with_str_works_1() { |
nothing calls this directly
no test coverage detected