Skip to content

This add the fill_colors option to the add_barplot method.#1441

Open
pstaabp wants to merge 1 commit into
openwebwork:PG-2.21from
pstaabp:statplot-fillcolors-barplot
Open

This add the fill_colors option to the add_barplot method.#1441
pstaabp wants to merge 1 commit into
openwebwork:PG-2.21from
pstaabp:statplot-fillcolors-barplot

Conversation

@pstaabp

@pstaabp pstaabp commented Jun 16, 2026

Copy link
Copy Markdown
Member

Adds a fill_color option to the add_barplot method. This uses the same options as the add_piechart method.

Here's an example:

DOCUMENT();

loadMacros("PGstandard.pl", "PGML.pl", 'StatisticalPlots.pl');

$statplot = StatPlot(
    xmin        => -1,
    xmax        =>  5,
    xminor      =>  0,
    xtick_delta =>  1,
    ymin        => -1,
    ymax        =>  6,
    ytick_delta =>  1,
    yminor      =>  0,
    show_grid   => 0
);

$statplot->add_barplot(
    [ 1 .. 4 ], [ 3, 5, 2, 1 ],
    bar_width => 0.9,
    # fill_colors => 'blues',
    # fill_colors => {palette_name => 'random', num_colors => 4},
    fill_colors =>
        [ 'LightYellow', 'DarkSalmon', 'CornflowerBlue', 'MediumAquamarine' ]
);

BEGIN_PGML
>>[!!]{$statplot}{400} <<
END_PGML

ENDDOCUMENT();

@pstaabp pstaabp force-pushed the statplot-fillcolors-barplot branch from 5a94858 to 09316d5 Compare June 16, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant