Created
September 11, 2020 09:53
-
-
Save sverhoeven/25d0df5238e989215d3ac1be453a3d61 to your computer and use it in GitHub Desktop.
newtonraphson-equation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
| "width": 800, | |
| "height": 600, | |
| "title": {"text": "2x^3 - 4x^2 + 6", "fontSize": 20, "fontWeight": "normal"}, | |
| "layer": [ | |
| { | |
| "data": {"sequence": {"start": -4, "stop": 4, "step": 0.1, "as": "x"}}, | |
| "transform": [ | |
| { | |
| "calculate": "2 * datum.x * datum.x * datum.x - 4 * datum.x * datum.x + 6", | |
| "as": "y" | |
| } | |
| ], | |
| "mark": "line", | |
| "selection": {"grid": {"type": "interval", "bind": "scales"}}, | |
| "encoding": { | |
| "x": {"type": "quantitative", "field": "x", "axis":{"tickCount": 9}}, | |
| "y": { | |
| "field": "y", | |
| "type": "quantitative", | |
| "scale": {"domainMin": -0.5, "domainMax": 9.5} | |
| }, | |
| "color": {"value": "#f00"} | |
| } | |
| }, | |
| { | |
| "data": {"values": [{"x": -1}]}, | |
| "encoding": {"x": {"field": "x", "type": "quantitative"}}, | |
| "layer": [ | |
| {"mark": {"type": "rule", "strokeDash": [4, 8]}}, | |
| { | |
| "mark": { | |
| "type": "text", | |
| "align": "right", | |
| "baseline": "bottom", | |
| "dx": -4, | |
| "dy": 10, | |
| "x": "width", | |
| "fontSize": 20, | |
| "text": "root = -1.0" | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment