Open JWagnerDE opened 3 years ago
This problem becomes even more problematic when using subplots:
Normal | Bug |
---|---|
fig = make_subplots(1,2)
fig.add_scatter(x=[1,2,3], y=[3, 8, 1], row=1, col=1)
fig.add_scatter(x=[1,2,3], y=[5, 0, 10], row=1, col=2)
fig.update_xaxes(tickmode='array', tickvals=[1,2,3], ticktext=['A', '', 'C'], col=2)
I am experiencing the same problem and ended up using a workaround. Using a newline character ('\n') instead of an empty string ('') seems to solve the formatting issue.
Tickvals: [-2.0, -1.699, -1.523, -1.398, -1.301, -1.222, -1.155, -1.097, -1.046, -1.0, -0.699, -0.523, -0.398, -0.301, -0.222, -0.155, -0.097, -0.046, 0.0, 0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954, 1.0, 1.301, 1.477, 1.602, 1.699, 1.778, 1.845, 1.903, 1.954, 2.0] Ticktext: ['0.01', '\n', '\n', '\n', '0.05', '\n', '\n', '\n', '\n', '0.1', '\n', '\n', '\n', '0.5', '\n', '\n', '\n', '\n', '1', '\n', '\n', '\n', '5', '\n', '\n', '\n', '\n', '10', '\n', '\n', '\n', '50', '\n', '\n', '\n', '\n', '100']
If setting the tick mode to 'array' on y or x axis and giving a ticktext with one ore more elements as empty string, the size of the plot will change.
This effect can be more drastically if using subplots. One time the plot got shrunk down to ~20% in size.
To reproduce just replace one of the strings 'Text *'in line 17 with an empty string "".
Code to reproduce