MCPcopy Create free account
hub / github.com/spotify/chartify / _bar_example_4

Function _bar_example_4

chartify/examples.py:454–476  ·  view source on GitHub ↗

# Plot the data with labels

(quantity_by_fruit)

Source from the content-addressed store, hash-verified

452
453@_print_source
454def _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
479plot_bar.__doc__ = _core.plot.PlotMixedTypeXY.bar.__doc__

Callers 1

plot_barFunction · 0.85

Calls 8

set_titleMethod · 0.95
set_subtitleMethod · 0.95
showMethod · 0.95
barMethod · 0.80
reset_palette_orderMethod · 0.80
set_yaxis_rangeMethod · 0.80
textMethod · 0.45
hide_yaxisMethod · 0.45

Tested by

no test coverage detected