Skip to content

Radar: ShowCategoryLabels#1262

Merged
swharden merged 2 commits intoScottPlot:masterfrom
Rayffer:master
Sep 12, 2021
Merged

Radar: ShowCategoryLabels#1262
swharden merged 2 commits intoScottPlot:masterfrom
Rayffer:master

Conversation

@Rayffer
Copy link
Contributor

@Rayffer Rayffer commented Sep 11, 2021

Purpose:
This pull request intends to give RadarPlot users the option to show category labels instead of it being shown when IndependentAxes property is set to true. Solves #1261

New Functionality:
There is no new functionality apart from giving the RadarPlot users direct control whether to show category labels or not.

@bclehmann
Copy link
Member

Good catch! I thought this was a regression from #1188 but it looks like it always acted this way. I have two small questions:

  • Do we need to demo this, such as with a cookbook recipe?
  • Should the default for this property be true? It's a sensible default (otherwise why would the user provide category labels), but it is a breaking change
    • If the default changes to be dependent on whether IndependentAxes is set then we might need to allow the user to disable drawing category labels when IndependentAxes is enabled.

@swharden swharden linked an issue Sep 11, 2021 that may be closed by this pull request
@swharden swharden changed the title Add ShowCategoryLabels property to control whether to show category labels Radar: ShowCategoryLabels Sep 11, 2021
@swharden
Copy link
Member

As a reminder, this is what we're discussing

double[,] values = {
    { 5, 3, 10, 15, 3, 2, 256 },
    { 5, 2, 10, 10, 1, 4, 252 },
};
var radar = plt.AddRadar(values, independentAxes: true);
radar.CategoryLabels = new string[] { "Wins", "Poles", "Podiums", "Points Finishes", "DNFs", "Fastest Laps", "Points" };
radar.GroupLabels = new[] { "Sebastian Vettel", "Fernando Alonso" };
radar.ShowCategoryLabels = true; // <-- this is what we are discussing
plt.Title("2010 Formula One World Championship");
plt.Legend();
ShowCategoryLabels = true ShowCategoryLabels= false
image image

Original Behavior / Issue this PR fixes

When I disable the independent axis feature, the labels go away while they can be seen when using independent axis

This seems like a good fix! Thanks @Rayffer

Do we need to demo this, such as with a cookbook recipe?

@bclehmann I imagine the majority of people will want to show the labels if they go through the effort of populating them, and this is probably easy enough to figure out that an explicit example isn't required.

Should the default for this property be true?

Is this variable actually necessary? What if we simplified the rule to "if category labels exist, show them". This property could be refactored to something like:

private bool ShowCategoryLabels => CategoryLabels is not null;

I'll go ahead and merge this now but if you think a change would make radar plots easier to use feel free to open-up a new PR to refine this behavior 👍

It's a sensible default ... but it is a breaking change

I'm pretty comfortable with small breaking changes if it makes the library less confusing for future users 😎

@swharden swharden merged commit 83b3da7 into ScottPlot:master Sep 12, 2021
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.

Radar: category labels only appear when independent axis are used

3 participants