I am trying to use plotly in python to create a bar-chart, x and y values as below
x_val = [1,3,4,7,10]
y_val = [1,2,3,4,5]
Here is the script I used to create a plot
from plotly.offline import plot
import plotly.graph_objs as go
trace = go.Bar(x=x_val, y=y_val)
layout = go.Layout(autosize=True)
fig = go.Figure(data=[trace], layout=layout)
plot(fig)
As the x-axis does not have the values of 2,5,6,8,9, thus there are gaps in a bar chart. I do not want to have a gap between them, however converting all x-values to string/object does not help at all. Would you please advise how to resolve this issue? Thank you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.