def test_only_major_dots_count(): line = Line(show_only_major_dots=True) line.add('test', range(12)) line.x_labels = map(str, range(12)) line.x_labels_major_count = 2 q = line.render_pyquery() assert len(q(".dots")) == 2
def draw_number_line(name, list_x, list_y, max_y = 0): line = Line() line.disable_xml_declaration = True line.js = [] line.x_label_rotation = 45 line.x_labels_major_count = 31 #line.y_labels_major_every = 3 line.show_legend = False line.print_values = False line.print_zeroes = False line.width = 1280 line.height = 720 line.value_formatter = lambda x:str(int(x)) #line.major_label_font_size = 20 #line.print_zeroes = True line.show_minor_x_labels = False #line.show_minor_y_labels = True line.show_dots = False #line.interpolate = 'hermite' line.title = name list_int_y = [0] for y in list_y: if y != None: list_int_y.append(y) line.range = (0, max(int(max(list_int_y)*1.1), max_y)) line.x_labels = list_x #line.y_labels = map(lambda x:x*100, range(int((min(list_y)/100)-1), int((max(list_y)/100+4)))) line.add(name, list_y) return line.render()
def plot_disp(self): s1, s2, s3, x = self.badanie.plotdata() chart = Line() chart.x_title = 'Czas' chart.y_title = 'Ugięcie' # chart.title = 'Wykres ugięcia gruntu przy badaniu' chart.x_labels = map(str, x) chart.x_labels_major_count = 20 chart.show_minor_x_labels = False chart.x_label_rotation = 60 chart.add('Zrzut 1', s1) chart.add('Zrzut 2', s2) chart.add('Zrzut 3', s3) chart.render(is_unicode=True) plotpath = 'plots/plot.svg' chart.render_to_file(plotpath) ploturl = "file:///home/macwojs/PycharmProjects/Terratest/" + plotpath self.main_screen.plotview.load(QUrl(ploturl))