Conversation
- `DrawMarkers` method default to 1px pen width if nothing is provided - Adapt plottables accordingly
…lly by default to preserve size consistency
…imensions. This breaks legends for pie charts (and maybe others)
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
Hi @BambOoxX, I think I'm mostly done reviewing this PR but can you help me understand the intent behind this modifications to scatter plots? public double LineWidth
{
get => IsHighlighted ? _lineWidth * HighlightCoefficient : _lineWidth;
set { _lineWidth = value; _markerLineWidth = (float)value / 2; _markerSize = (float)value * 2; }
}It seems a little strange to me that changing the EDIT: I'm going to merge but feel free to continue the discussion here or open a new PR if you have suggestions |
|
This landed in an awesome spot, thanks so much @BambOoxX! var plt = new ScottPlot.Plot();
double[] ys1 = DataGen.Sin(30);
var cmap1 = ScottPlot.Drawing.Colormap.Viridis;
double[] ys2 = DataGen.Cos(30);
var cmap2 = ScottPlot.Drawing.Colormap.Turbo;
for (int i = 0; i < ys1.Length; i++)
{
double frac = i / (ys1.Length - 1f);
var circle = plt.AddMarker(i, ys1[i]);
circle.MarkerShape = MarkerShape.openCircle;
circle.MarkerSize = i + 5;
circle.MarkerLineWidth = 1 + i / 2;
circle.MarkerColor = cmap1.GetColor(1 - frac, .8);
var triangle = plt.AddMarker(i, ys2[i]);
triangle.MarkerShape = MarkerShape.openTriangleUp;
triangle.MarkerSize = i + 5;
triangle.MarkerLineWidth = 1 + i / 4;
triangle.MarkerColor = cmap2.GetColor(frac, .8);
} |
|
The idea behind changing the marker properties when changing the line width is only to preserve consistency. The main point is that if you draw a thick line to make it very visible, ans that it has markers, you probably want to see the markers pretty well too. In a more marker-centric context, it could be interesting that setting the marker size sets the marker line width because large markers with thin lines look correct but small markers with thick lines are very distorded |

This PR implements a
MarkerLineWidthproperty and subsequent modifications to allow to change the stroke width of a marker.This is still a WIP.
Commit cea4994 breaks the legend for pie chart and maybe other plot types.
This might be the occasion to create a
IHasAreainterface handling all plots that are related (visually at least) to an area / surface with respect toIHasLine. This would avoid to use theisRectangleproperty inLegend.Here is how looks the "All Markers" example with the new capabilities and
sp.LineWidth = 2 --> sp.LineWidth = i;