Skip to content

Striped/Patterned Bar Plots #552

@bclehmann

Description

@bclehmann

What can we do to make ScottPlot better?
Bar charts are sometimes drawn with striped bars:
image

A good implementation would require support for stripes in the legend as well.

Does your proposed feature allow users to do new things in source code? If so, show us how you'd like to be able to use the new feature:

var barChart = plt.PlotBar(/* parameters */);
barChart.striped[2] = true;

//Conveniently, editing the stripiness this way (instead of through a lengthy `plt.PlotBar()` method means this approach needs no additional changes to work with bar charts created by `plt.PlotBarGroups()`

You may prefer it support multiple patterns (striped one way, striped the other way, checkered, dotted, etc). This could be done with an enum like this:

enum BarPattern{
    solid,
    stripedUpwards,
    stripedDownwards,
    checkered
}

And then barChart.striped[2] = true; becomes barChart.pattern[2] = Config.BarPattern.stripedUpwards. Conveniently, the HatchBrush and it's HatchStyle enum does this all for us. I may not be able to work on this until the weekend with uni but I'll put in a PR unless you want to.

Helpful documentation on hatchbrushes: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.drawing2d.hatchbrush?view=dotnet-plat-ext-3.1

A picture of all the hatchstyles:
image

Check the ScottPlot Roadmap to see if your feature is already planned for an upcoming release:
https://github.com/swharden/ScottPlot/blob/master/dev/roadmap.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions