I’d like to combine two things: a single tick value, and the default ticks on a y axis.
I can do either or, by writing figure.update_yaxes(tickvals=[average], ticktext['Average: ’ + str(average)]) and then I get the lefthand case above, or not doing it and then I get the righthand case.
Can you append to default ticks? Or maybe the default tick function can be re-used, modified and applied explicitly if one knows it?
Bro did you find any solution for this?. I am stuck at the same thing but found a workaround. You can just add a hline and annotate it
fig.add_hline(y=tick_value,opacity=0.3,line=dict(dash="dash")
fig.add_annotation(x=0,y=tick_value,text=f"Average {tick_value} km",xref="x",yref="paper",yanchor="top")
#If you want the text to appear on the other end of the line make x=1
If anyone knows a better solution please do reply!
You can also use annotation as parameter in add_hline(), which can be more convenient to position the annotation, relative to the hline.
Try different positions using combinations of: (None|'top'|'bottom') + (None|'left'|'right')