Skip to content

Legend should consider lineWidth: 0 #790

Closed

Description

@AlgoExecutor

If you use AddScatter and lineWidth: 0 to visualize point clouds, the legend should also show them as points. Currently it is still displayed as line + point. Otherwise it confuses the viewer. Here is an example:

image

Used Version: ScottPlot 4.1.6-beta

Used Code:

...
 formsPlot.Plot.AddScatter(xDate.ToArray(), ci.Data.ToArray(), Color.DeepPink, lineWidth: 0, 5, MarkerShape.filledSquare, label: "2");
formsPlot.Plot.XAxis.DateTimeFormat(true);
formsPlot.Plot.Title($"Test");
formsPlot.Plot.Legend();
formsPlot.Render();

Activity

  1. swharden commented on Feb 16, 2021

    @swharden
    Member

    Thanks for reporting this @AlgoExecutor! I fixed this and will upload a NuGet package in a few minutes 👍

    The problem was that System.Drawing renders a 1px line when asked to draw a line with a pen that has a line width of 0 🙄

    After the fix things look good!

    var plt = new ScottPlot.Plot();
    plt.AddScatter(new double[] { 1, 2, 3 }, new double[] { 1, 4, 9 }, lineWidth: 0, label: "no line");
    plt.AddScatter(new double[] { 1, 2, 3 }, new double[] { 2, 5, 10 }, markerSize: 0, label: "no marks");
    plt.Legend();

    image

  2. AlgoExecutor commented on Feb 16, 2021

    @AlgoExecutor
    Author

    Thank you @swharden for the quick fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions