Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

[plotly]Why there is have unaviable sample in the x axis

Create a Bar illustration with plotly, assign a list to x axis which value is uncontinuous, but there is still have unavible label in x axis. how to remove them. Code:

from plotly.graph_objs import Bar, Layout
from plotly import offline
from die import Die

die1 = Die(num_sides=6)
die2 = Die(num_sides=6)

results = []
for roll_num in range(100_000):
    result = die1.roll()*die2.roll()

frequencies = []

x_sample_list = []
for i in range(1, die1.num_sides+1):
    for j in range(1, die2.num_sides+1):
        x = i*j
        if x in x_sample_list:

x_values = x_sample_list[:]

for value in x_values:
    frequency = results.count(value)

data = [Bar(x=x_values, y=frequencies)]

x_axis_config = {'title': 'Sample', 'dtick': 1}
y_axis_config = {'title': 'Frequency'}

my_layout = Layout(title='roll out for 1000 times of a six side Die', xaxis=x_axis_config, yaxis=y_axis_config)

offline.plot({'data': data, 'layout': my_layout}, filename='die.html')

from random import randint

from random import randint

The Die class is for genarate a number in random, value between 1~6

class Die:

def __init__(self, num_sides=6):
    self.num_sides = num_sides

def roll(self):
    return randint(1, self.num_sides)