'Draw distributions with discrete attributes'

def draw_distributions(self):

    if (not (self.show_distributions and (self.data is not None) and self.domain.has_discrete_class)):
        return
    class_count = len(self.domain.class_var.values)
    class_ = self.domain.class_var
    if (self.domain_contingencies is None):
        self.domain_contingencies = dict(zip([attr for attr in self.domain if attr.is_discrete], get_contingencies(self.data, skipContinuous=True)))
        self.domain_contingencies[class_] = get_contingency(self.data, class_, class_)
    max_count = max(([contingency.max() for contingency in self.domain_contingencies.values()] or [1]))
    sorted_class_values = get_variable_values_sorted(self.domain.class_var)
    for (axis_idx, attr_idx) in enumerate(self.attribute_indices):
        attr = self.domain[attr_idx]
        if attr.is_discrete:
            continue
        contingency = self.domain_contingencies[attr]
        attr_len = len(attr.values)
        sorted_variable_values = get_variable_values_sorted(attr)
        for j in range(attr_len):
            attribute_value = sorted_variable_values[j]
            value_count = contingency[:, attribute_value]
            for i in range(class_count):
                class_value = sorted_class_values[i]
                color = QColor(*self.colors[i])
                color.setAlpha(self.alpha_value)
                width = (float((value_count[class_value] * 0.5)) / float(max_count))
                y_off = (float((1.0 + (2.0 * j))) / float((2 * attr_len)))
                height = (0.7 / float((class_count * attr_len)))
                y_low_bottom = ((y_off + (float((class_count * height)) / 2.0)) - (i * height))
                curve = PolygonCurve(QPen(color), QBrush(color), xData=[axis_idx, (axis_idx + width), (axis_idx + width), axis_idx], yData=[y_low_bottom, y_low_bottom, (y_low_bottom - height), (y_low_bottom - height)], tooltip=attr.name)
                curve.attach(self)
