I apologise if this is a simple question but I could not find an answer online.
For a simple line/scatter plot with one trace, I would like the y-axis line to be located at a location other than at x=0.
The range of my x-axis is from -4.6 to 0. Plotly keeps placing the y-axis line on the right hand side (at x=0) but I want it on the left hand side (at x=-4.6).
The location of the tick marks/labels is not an issue - these stay on the left . . .but. I want the axis line to be on the left too.
Many thanks
Dan
Found a solution.
βzerolineβ: false in x-axis layout to remove the axis line - not sure why it needed to be in β β
then add a vertical line definition as a shape in layout. color black and weight 1 matches the default axis line.
shapes: [
//line vertical
{
type: 'line',
x0: Math.log(.01),
y0: 0,
x1: Math.log(.01),
y1: 1.05,
line: {
color: 'black',
width: 1,
}
},
]
1 Like
Hello @dcornfel,
Welcome to the community!
Glad you figured out a solution, and that you for posting it here!
Often times, with plotly.js questions, it is nice to include a MRE or a jsfiddle so that people can just in and help you right away. 