# Plot the data with labels
(quantity_by_fruit)
| 452 | |
| 453 | @_print_source |
| 454 | def _bar_example_4(quantity_by_fruit): |
| 455 | """# Plot the data with labels""" |
| 456 | ch = chartify.Chart(x_axis_type="categorical", blank_labels=True) |
| 457 | ch.set_title("Vertical bar plot with labels") |
| 458 | ch.set_subtitle("Hidden y-axis") |
| 459 | ch.plot.bar( |
| 460 | data_frame=quantity_by_fruit, |
| 461 | categorical_columns="fruit", |
| 462 | numeric_column="quantity", |
| 463 | color_column="fruit", |
| 464 | ) |
| 465 | ch.style.color_palette.reset_palette_order() |
| 466 | ch.plot.text( |
| 467 | data_frame=quantity_by_fruit, |
| 468 | categorical_columns="fruit", |
| 469 | numeric_column="quantity", |
| 470 | text_column="quantity", |
| 471 | color_column="fruit", |
| 472 | ) |
| 473 | # Adjust the axis range to prevent clipping of the text labels. |
| 474 | ch.axes.set_yaxis_range(0, 1200) |
| 475 | ch.axes.hide_yaxis() |
| 476 | ch.show(_OUTPUT_FORMAT) |
| 477 | |
| 478 | |
| 479 | plot_bar.__doc__ = _core.plot.PlotMixedTypeXY.bar.__doc__ |
no test coverage detected