question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

line chart with different point marker?

See original GitHub issue

How can I give different lines a different type of point marker, say a cross (+) symbol? For example, the following chart with point=True will have data points as solid circle, but it won’t work well when print black & white.

import altair as alt
from vega_datasets import data

source = data.stocks()

alt.Chart(source).mark_line(point=True).encode(
    x='date',
    y='price',
    color='symbol'
)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jakevdpcommented, Apr 30, 2019

You can get the result you want by carefully defining legends and scale resolution:

import altair as alt
from vega_datasets import data

source = data.stocks()

line = alt.Chart(source).mark_line().encode(
    x='date',
    y='price',
    color=alt.Color('symbol', legend=None)
)

points = line.mark_point(filled=True).encode(
    color='symbol',
    shape='symbol'
)

alt.layer(
    line,
    points
).resolve_scale(
    color='independent',
    shape='independent'
)

visualization (12)

1reaction
jakevdpcommented, Feb 20, 2020

In Altair’s docs, it’s under shape here: https://altair-viz.github.io/user_guide/marks.html#mark-properties

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change data markers in a line, scatter, or radar chart
Change data markers in a line, scatter, or radar chart ; In the Type box, select the marker type that you want to...
Read more >
Customizing Lines and Data Points in a Line Chart - IBM
Data points represent series values for each category on the Y-axis. You can show special data markers that represent statistically significant values, ...
Read more >
Create Line Plot with Markers - MATLAB & Simulink - MathWorks
Adding markers to a line plot can be a useful way to distinguish multiple lines or to highlight particular data points. Add markers...
Read more >
5 Ways to Improve Your Line Charts in Excel 2016
Right-click the line to which you want to add data markers and select 'Format Data ... Another way you can draw attention to...
Read more >
Line Chart with Point Markers | Vega-Lite
Notes: (1) This is equivalent to adding another layer of point marks. (2) While "point" marks are normally semi-transparent, the overlay point marker...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found