{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ { "yield_error": 7.5522, "yield_error2": -10.5522, "yield_center": 32.4, "variety": "Glabron" }, { "yield_error": 6.9775, "yield_error2": -3.9775, "yield_center": 30.96667, "variety": "Manchuria" }, { "yield_error": 3.9167, "yield_error2": -0.9167, "yield_center": 33.966665, "variety": "No. 457" }, { "yield_error": 11.9732, "yield_error2": -15.9732, "yield_center": 30.45, "variety": "No. 462" } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "formula", "expr": "datum[\"yield_center\"] + datum[\"yield_error\"]", "as": "upper_yield_center" }, { "type": "formula", "expr": "datum[\"yield_center\"] + datum[\"yield_error2\"]", "as": "lower_yield_center" }, { "type": "filter", "expr": "isValid(datum[\"lower_yield_center\"]) && isFinite(+datum[\"lower_yield_center\"])" } ] }, { "name": "data_2", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"yield_center\"]) && isFinite(+datum[\"yield_center\"])" } ] } ], "signals": [ {"name": "y_step", "value": 20}, {"name": "height", "update": "bandspace(domain('y').length, 0, 0) * y_step"} ], "marks": [ { "name": "layer_0_marks", "type": "rule", "style": ["rule", "errorbar-rule"], "from": {"data": "data_1"}, "encode": { "update": { "ariaRoleDescription": {"value": "errorbar"}, "stroke": {"value": "black"}, "tooltip": { "signal": "{\"yield_center\": format(datum[\"yield_center\"], \"\"), \"yield_center + yield_error\": format(datum[\"upper_yield_center\"], \"\"), \"yield_center + yield_error2\": format(datum[\"lower_yield_center\"], \"\"), \"variety\": isValid(datum[\"variety\"]) ? datum[\"variety\"] : \"\"+datum[\"variety\"]}" }, "description": { "signal": "\"yield: \" + (format(datum[\"lower_yield_center\"], \"\")) + \"; variety: \" + (isValid(datum[\"variety\"]) ? datum[\"variety\"] : \"\"+datum[\"variety\"]) + \"; upper_yield_center: \" + (format(datum[\"upper_yield_center\"], \"\")) + \"; yield_center: \" + (format(datum[\"yield_center\"], \"\")) + \"; yield_center + yield_error: \" + (format(datum[\"upper_yield_center\"], \"\")) + \"; yield_center + yield_error2: \" + (format(datum[\"lower_yield_center\"], \"\"))" }, "x": {"scale": "x", "field": "lower_yield_center"}, "x2": {"scale": "x", "field": "upper_yield_center"}, "y": {"scale": "y", "field": "variety", "band": 0.5} } } }, { "name": "layer_1_marks", "type": "symbol", "style": ["point"], "from": {"data": "data_2"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "black"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"yield_center: \" + (format(datum[\"yield_center\"], \"\")) + \"; variety: \" + (isValid(datum[\"variety\"]) ? datum[\"variety\"] : \"\"+datum[\"variety\"])" }, "x": {"scale": "x", "field": "yield_center"}, "y": {"scale": "y", "field": "variety", "band": 0.5} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "lower_yield_center"}, {"data": "data_1", "field": "upper_yield_center"}, {"data": "data_2", "field": "yield_center"} ] }, "range": [0, {"signal": "width"}], "zero": false, "nice": true }, { "name": "y", "type": "band", "domain": { "fields": [ {"data": "data_1", "field": "variety"}, {"data": "data_2", "field": "variety"} ], "sort": true }, "range": {"step": {"signal": "y_step"}}, "paddingInner": 0, "paddingOuter": 0 } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "yield", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "variety", "zindex": 0 } ] }