Aviod joining two strokes of drawing while making a plot using kivy garden!

777 views
Skip to first unread message

Shruti Chandra

unread,
Jul 1, 2015, 1:20:23 PM7/1/15
to kivy-...@googlegroups.com

Hi, I am plotting a graph reading a file with x, y positions. These drawings are in form of letters(y, c etc).
In actual drawing there is a gap (visually) in the strokes of letters, but when i am making a graph using kivy garden. It is somehow joining the two strokes with a line.

In the attached pic, you can see there are two strokes of y, one is small (first one) and second is remaining full y. Both two strokes are attached by a straight line (approx pos: 600, -80).

How can I avoid this?

Thanks in advance! Quiet new in kivy!

Kived Devik

unread,
Jul 1, 2015, 1:27:09 PM7/1/15
to kivy-...@googlegroups.com
You should put each connected series in its own Plot (so, for this example, you should have two Plots).

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shruti Chandra

unread,
Jul 1, 2015, 2:33:13 PM7/1/15
to kivy-...@googlegroups.com
I am putting the block of the code which I am calling in App. Every time it is reading the strokes and plotting the graph, so for every stroke there should be new graph. Could you please tell me where i should change the code?



def draw(self, curr_data):
       
        point_list = []
        point_list_x = []
        point_list_y = [] 
        for stroke in curr_data:  
                 
            for i in range(len(stroke)):
                stroke[i][1] = - stroke[i][1]
                #xp = storke[i][1]
                a = tuple(stroke[i])
                point_list.append(a)               
              
           
               
            graph = Graph(xlabel='X', ylabel='Y', x_ticks_major = 50, y_ticks_major = 20, y_grid_label = True, x_grid_label = True, padding = 5,
            x_grid = False, y_grid=True, xmin = 500, xmax = 800, ymin=-180, ymax=-50, draw_border =  True)
            plot = MeshLinePlot(color=[1, 0, 0, 1])
            plot.points = (point_list)
            #plot.points = (stroke[:, 0], -stroke[:, 1])
            #print '----------------', plot.points
            print point_list_x
            print point_list_y
           
            graph.add_plot(plot)
            graph._plot_area
            graph.pos = 30,120
            graph.size = 400,400
            self.add_widget(graph)

Shruti Chandra

unread,
Jul 2, 2015, 8:04:12 AM7/2/15
to kivy-...@googlegroups.com
Hi, Problem solved.

Here is my updated code.

        num = 0
      
        point_list = [] 
      
        for stroke in curr_data:
           
            print '+++++++++++++++++++++++++++',stroke
           
            num += 1
           
          
            graph = Graph(xlabel='X', ylabel='Y', x_ticks_major = 50, y_ticks_major = 20, y_grid_label = True, x_grid_label = True, padding = 5,
            x_grid = False, y_grid=True, xmin = 500, xmax = 800, ymin=180, ymax=50, draw_border =  True)

           
           
            plot = MeshLinePlot(color=[1, 0, 0, 1])           
            plot.points = stroke

       
            graph.pos = 30,120
            graph.size = 400,400
            self.add_widget(graph)
            graph.add_plot(plot)     #   
            print num


 

On Wednesday, 1 July 2015 18:20:23 UTC+1, Shruti Chandra wrote:
Reply all
Reply to author
Forward
0 new messages