dist_plot = {
let data_to_plot = data_fetched_joined.filter(e=>e.xlabel == bias_dimension_labels_new[bias_dimensions_selection])[0];
if (data_to_plot["bars"] !== undefined) {
return Plot.plot({
width: 1200,
x: {axis: null},
y: {tickFormat: "s"},
color: {range: ["#5e569b","#EDC951","#CC333F","#00A0B0","#ab3da9","#a6d75b", "#115f9a"], legend: true},
marks: [
Plot.barY(dist_plot_data_formatted, {
x: "AS",
y: "value",
fill: "AS",
fx: d => d[bias_dimensions_selection],
sort: {x: null, color: null, fx: "y", order: "descending", reduce: "max"}
}),
Plot.axisX({
tickFormat: d => d[bias_dimensions_selection],
label: bias_dimensions_selection,
}),
Plot.ruleY([0]),
]
})
} else {
return Plot.plot({
width: 1200,
color: {range: ["#5e569b","#EDC951","#CC333F","#00A0B0","#ab3da9","#a6d75b", "#115f9a"], legend: true},
x: {
type: "log",
},
y: {
grid: true,
label: `↑ ${data_to_plot['ylabel']}`
},
marks: [
Plot.ruleY([0]),
Plot.lineY(dist_plot_data_formatted, {x: data_to_plot['xlabel'], y: data_to_plot['ylabel'], z: "AS", stroke: "AS"})
]
})
}
}