I need to draw a line and a triangle. The triangle needs to be added to the end of the line, i.e. it ends at the end of the line, it does not extend beyond the line, it is placed straight on the line. It should look as follows
I tried to implement this using symbols or plain text but the triangle is not perfectly straight on the line. In addition, its end is beyond the end of the line.
var trace1 = {
x: [5, 5],
y: [20, 5],
type: 'scatter'
};
var trace2 = {
x: [5],
y: [5],
type: 'markers',
marker: {
size: 15,
symbol: 'triangle-right',
line: {
color: 'orange'
}
}
};
var data = [trace1, trace2];
var layout = {showlegend: false};
Plotly.newPlot('myDiv', data, layout);
I added a red line to pinpoint where the triangle should end (on y-axis).
I tried to set x/y coordinates for the symbol such as
x: [5.01],
y: [5.49],
and it looks good as long as I do not zoom in. Once I do, the triangle is no more on the line