Adding Legend in Selective Lines Chart based on Color and Thickness
See original GitHub issueHi,
I have been trying to create Line chart with selectively highlighting few lines. Although I got success in that by using layering but not able to figure out how to plot legend in this case.
Help appreciated !
base = alt.Chart(result1,title='Multivariate, pure factor returns'.upper()).encode(
x=alt.X('date_str:T', scale=alt.Scale(domain=['2011-12-31','2017-10-31']),
axis=alt.Axis(title=''.upper(),format=("%b-%Y"))),
)
chart=alt.layer(
base.mark_line(color='blue',strokeWidth=0.5).encode(y='Best Price Correlation'),
base.mark_line(color='red').encode(y='Percent Change YoY')
)
chart
Format for result1 is as below
And how not to include y axis titles ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Can we add an interactive legend to the interactive line chart ...
See interactive line chart. On click in the legend, increase the thickness of the line, gray-out all other lines, and gray out all...
Read more >How to Change the Color Coding on a Microsoft Excel Graph ...
Color Your Legend Open Excel's Format Legend pane by right-clicking the legend in a chart and selecting "Format Legend." Click the window's Fill...
Read more >Video: Customize a line chart - Microsoft Support
Click the chart you want to change. · In the upper-right corner, next to the chart, click Chart Styles. · Click Color and...
Read more >Add a legend, gridlines, and other markings in Keynote on iPad
Tap Chart, then turn on Legend. Tap the legend to select it, then do any of the following: Change the style of the...
Read more >Dynamically Highlight Line Chart Series in Power BI - YouTube
In this Power BI tutorial, learn how to dynamically highlight a specific line in a line chart by slicer selection!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ashutosh29
Hi there,
It seems that you are looking to make a line chart with specific colors for each line, and a legend. If that is correct, you may be able to extend from this example:
Wondeful, thanks a lot !