vega: Missing documentation on how to use vega-scale api with linear or log scale
In our project we are using vega-scale to generate heatmaps for numeric data. We managed to use a sequential scheme like viridis with scale = vega.scale('sequential').interploate(vega.scheme('viridis'));. I can’t seem to figure out from the documentation how to differentiate between for example a linear and log scale.
Also the previously mentioned vega-scale repository is archived now. The README.md file explains that everything has been moved here for further development but i can’t seem to find any documentation on how to use the scale api. Could someone point me to the documentation for it?
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 22 (9 by maintainers)
After some testing I was not able get the Vega Extensibility API for Scale to work.
If your goal is to have a javascript function to convert a value on log scale to color scale such as “viridis”, then it is easier to just use d3.js. For example:
Note: Include d3.js library in your html file:
<script src="https://cdn.jsdelivr.net/npm/d3@5"></script>See d3.js documentation and examples: https://github.com/d3/d3-scale-chromatic https://github.com/d3/d3-scale#scaleSequentialLog https://observablehq.com/@d3/sequential-scales
Like this Open the Chart in the Vega Editor