Create a ggplot style legend using Plot | Ashish Singh | Observable
ojs
Author
Ashish Singh
@iashishsingh
Data Visualization Consultant, and an enthusiastic generalist in building software systems
Comments (5)
Jason J. Benedict
May 26, 2022
Hi Ashish, thanks for this wonderful tool. I wanted to check with you if it's possible to change the font of the legend?
Ashish Singh
May 26, 2022
Hi Jason. You can pass in the fontFamily key. I've updated the notebook to use that. Cheers.
Jason J. Benedict
May 26, 2022
Thanks a lot for this, Ashish. Just another minor query - do you know how I can use my own font and change the color of it as well?
Ashish Singh
May 26, 2022
You would need to add the fonts/import the css in the notebook and then use the font. For coloured text, try adding a "fill" property to Plot.textY in plotLegend(). Cheers.
Jason J. Benedict
May 27, 2022
Thanks Ashish!
Reply
Add comment
Subscribe to notifications
© 2026 Observable, Inc.
Terms of service
Privacy policy
Product
About
Pricing
Documentation
Release notes
Contact us
Open source
Notebook Kit
Plot
D3
Community
Public
Forum
Bluesky
YouTube
X
Observable
Sign up
Ashish Singh
11
Reply
Add comment
Subscribe to notifications
2
Create a ggplot style legend using Plot | Ashish Singh | Observable