How to display single points with line trace?

Hi Plotly community,

As this is my first message I’d like to say big thanks to Plotly developers for the good work :slight_smile:

I have a question: I use a line trace (see minimal example). At the middle, there is a single point which is not displayed.

My goal is to display lines without markers, and single points with markers.

If I enable `“mode”: “lines+markers”, there is a marker for every point. I would like to render markers only for single points not connected to any line, because with a very large number of points, the chart is too heavy visually if every point has a marker.

Is there any option allowing me to achieve what I want? Or should I use two traces, one with lines and the other with markers (for single points), and pre-process my data first? (something like this example)

Does the data belong to the same graph? Or is it one graph with both continuous lines and points? Or is it more like the line is a fit of a Scatter plot? I’m a little confused. Because in that case I would use separate traces. Can you give an image of what it should look like?

Thanks @klnrdknt

Data is one time series in my case. Could be like:

  ["2000", 10],
  ["2001", 11],
  ["2002", null],
  ["2003", 15],
  ["2004", null],

To be more concrete here is an image of the expected result:

The user should feed like it’s a single time series.

I would like:

  • uninterrupted successions of points to be rendered as lines without markers (like the 2 first points of the list)
  • single points (like ["2003", 15]) to be rendered as markers

Maybe I’m missing some trivial point. I’m open to other approaches.

For the record, I answer myself because I found a solution.

    type: "scattergl",
    x: x,
    y: y,
    mode: "lines+markers",
    marker: {
        size: 3,

In my first post I eliminated the "mode": "lines+markers" solution because markers were too big, but I discovered that marker size can be modified.

Note: I used “scattergl” for performance reasons because x and y are large.

Now I can see markers and lines: