subPlot1 = svg => {
svg.selectAll("*").remove();
const margins = ({
top: 5,
right: 10,
bottom: 25,
left: 130
})
const x = d3.scaleLinear(d3.extent(dataMLP_50, d => d.time), [margins.left, width - margins.right])
const y = d3.scaleLinear()
.domain([0.075, 0.13]).nice()
.range([chartHeight - margins.bottom, margins.top])
const legend = svg
.append("g")
.attr("transform", `translate(${width - 80}, 15)`)
.call((container) => colorLegend(container))
const lineTrain = d3.line()
.x(d => x(d.time))
.y(d => y(d.train))
const lineVal = d3.line()
.x(d => x(d.time))
.y(d => y(d.val))
svg.append("g")
.attr("transform", `translate(0,${chartHeight - margins.bottom})`)
.call(d3.axisBottom(x).ticks(width / 80))
.call(g => g.select(".domain").remove())
.call((g) => g.append("text")
.attr("x", width - margins.right)
.attr("y", margins.bottom - 10)
.attr("fill", "currentColor")
.attr("text-anchor", "end")
.attr("font-weight", "bold")
.text("epoch"))
svg.append("g")
.attr("transform", `translate(${margins.left},0)`)
.call(d3.axisLeft(y))
.call(g => g.select(".domain").remove())
.call(g => g.selectAll(".tick line")
.clone()
.attr("x2", width - margins.right - margins.left)
.attr("stroke-opacity", d => d === 0 ? 1 : 0.1))
.call(g => g.append("text")
.attr("fill", "#000")
.attr("x", 5)
.attr("y", margins.top)
.attr("dy", "0.32em")
.attr("text-anchor", "start")
.attr("font-weight", "bold")
.text("mean absolute error"))
svg.append("path")
.attr("fill", "none")
.attr("stroke", "teal")
.attr("stroke-width", 2)
.attr("d", lineTrain(dataMLP_50))
svg.append("path")
.attr("fill", "none")
.attr("stroke", "#E4572E")
.attr("stroke-width", 2)
.attr("d", lineVal(dataMLP_50))
const title = svg.append("g")
.append("text")
.attr("x", margins.left / 3)
.attr("y", (chartHeight / 2))
.attr("text-anchor", "middle")
.attr("front-weight", "bold")
.attr("font-family", "Helvetica Neue, Arial")
.attr("font-size", "15px")
.text("MLP")
return svg.node();
}