Crashes when using funcion_plot without h_labels

Bug #314063 reported by Magnun Leno
2
Affects Status Importance Assigned to Milestone
Cairo Plot
Fix Committed
Medium
Rodrigo Moreira Araújo

Bug Description

When using function_plot like this CairoPlot crashes:

meusdados = lambda x : [1,2,3,4][x]
CairoPlot.function_plot('function4.png', meusdados, 400, 300, grid = True, dots=True, h_bounds=(0,4), step = 1, discrete=True)

After following the execution in the source I found that the problem is in te following pice of render_horz_labels:
if not labels:
        labels = []
        i = self.bounds[HORZ][0]
        while i<self.bounds[HORZ][1]:
            labels.append(str(i*self.step))
            i += (self.bounds[HORZ][1] - self.bounds[HORZ][0])/10
        #labels = [str(i*self.step) for i in range(self.bounds[HORZ][0], self.bounds[HORZ][1])]
    border = self.borders[HORZ]

Testing with h_labels it didn't crashes but the the labels aren't drawn:

meusdados = lambda x : [1,2,3,4][x]
labels = ["a","b","c","d"]
CairoPlot.function_plot('function4.png', meusdados, 400, 300, grid = True, dots=True, h_labels = labels, h_bounds=(0,4), step = 1, discrete=True)

Thanks for this great module!!

Revision history for this message
Magnun Leno (magnun-leno) wrote :
Changed in cairoplot:
assignee: nobody → alf-rodrigo
importance: Undecided → Medium
status: New → Confirmed
Changed in cairoplot:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.