From: Martin R. <law...@gm...> - 2005-10-07 15:46:04
|
Hello everyone, Hello John, first of all: thanks for you mail, it was full of information! I exchanged the lines in _backend_agg.cpp and tried to implement your thoughts. While writing data.py wasn't a problem the trouble started when I tried to run a little sample program with GTKAgg - I got a segmentation fault. Unfortunately I'm not able to see where this one comes from. But when using GTKAgg you're not able to draw markers at all; not even ticks ... plotting a line is still possible when using from pylab import * axis('off') plot(arange(10)) so the error seems really due to the draw_markers() and not something else. Below are the changed files. Can you reproduce the segmentation fault? Best, Martin P.S.: Once this particular example works, I will convert the other markers (Arnd and I have worked out a scheme for the size which seems consistent and simple to implement). #### data.py """ Creates a dictionary containing information on how to draw markers. The values used within the paths are chosen so that the longest dimension of a sourrounding rectangle is 1, e.g: triangle up ... has a height and a width of one square ........ has a height and a width of one ... """ from matplotlib import agg markerd = {} # triangle up path = agg.path_storage() path.move_to( 0, 0.5) path.line_to(-0.5, -0.5) path.line_to( 0.5, -0.5) path.end_poly() markerd['^'] = path # square path = agg.path_storage() path.move_to(-0.5, -0.5) path.line_to(-0.5, 0.5) path.line_to( 0.5, 0.5) path.line_to( 0.5, -0.5) path.end_poly() markerd['s'] = path # tri_up (BTW this one change a bit) offset = 2.0/3.0 offset1 = offset*0.8 offset2 = offset*0.5 path = agg.path_storage() path.move_to(0, 0) path.line_to(0, offset) path.move_to(offset1, -offset2) path.line_to(0, 0) path.line_to(-offset1, -offset2) path.end_poly() markerd['2'] = path #### #### changed routine for lines.py def _draw_square(self, renderer, gc, xt, yt): side = renderer.points_to_pixels(self._markersize) rgbFace = self._get_rgb_face() path = d.markerd['s'] if self._newstyle: scale = agg.trans_affine_scaling(side, side) transpath = agg.conv_transform_path(path, scale) renderer.draw_markers(gc, path, rgbFace, xt, yt,self._transform) else: offset = side*.5 vertices = d.path_2_vertices(path) for (x,y) in zip(xt, yt): for verts in vertices: renderer.draw_polygon(gc, rgbFace, verts) #### ### Example call: plot(arange(10),'bs') ### -- Highspeed-Freiheit. Bei GMX supergünstig, z.B. GMX DSL_Cityflat, DSL-Flatrate für nur 4,99 Euro/Monat* http://www.gmx.net/de/go/dsl |