Esempio n. 1
0
def plot_curve(x, color=None, label=None, ax=None):
    points = zip(1 - x[1], 1 - x[0])
    segments = zip(points[:-1], points[1:])
    if ax is None:
        ax = axes(frameon=True)
    LC = LineCollection(segments, label=label)
    if not (color is None):
        LC.color(color)
    ax.add_collection(LC)
    axis([0, 1, 0, 1])
Esempio n. 2
0
    def drawstates(self,ax,linewidth=0.5,color='k',antialiased=1):
        """
 Draw state boundaries in Americas.

 ax - current axis instance.
 linewidth - state boundary line width (default 0.5)
 color - state boundary line color (default black)
 antialiased - antialiasing switch for state boundaries (default True).
        """
        coastlines = LineCollection(self.statesegs,antialiaseds=(antialiased,))
        coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
Esempio n. 3
0
    def drawcoastlines(self,ax,linewidth=1.,color='k',antialiased=1):
        """
 Draw coastlines.

 ax - current axis instance.
 linewidth - coastline width (default 1.)
 color - coastline color (default black)
 antialiased - antialiasing switch for coastlines (default True).
        """
        coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
        coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
Esempio n. 4
0
 def drawBarPlot(self):
     """Rysuje główny wykres w postaci barowej."""
     if self.data==None or self.data.corrupted:
         return
     ax=self.mainPlot
     x=range(len(self.data.close))
     lines1=ax.vlines(x,self.data.low,self.data.high,label=self.data.name)
     lines2list=[]
     for i in x:
         lines2list.append(((i-0.3,self.data.open[i]),(i,self.data.open[i])))
         lines2list.append(((i,self.data.close[i]),(i+0.3,self.data.close[i])))   
     lines2=LineCollection(lines2list)
     lines2.color('k')
     ax.add_collection(lines2)
Esempio n. 5
0
    def drawstates(self,ax,linewidth=0.5,color='k',antialiased=1):
        """
 Draw state boundaries in Americas.

 ax - current axis instance.
 linewidth - state boundary line width (default 0.5)
 color - state boundary line color (default black)
 antialiased - antialiasing switch for state boundaries (default True).
        """
        coastlines = LineCollection(self.statesegs,antialiaseds=(antialiased,))
        try:
            coastlines.set_color(color)
        except: # this was a typo that existed in matplotlib-0.71 and earlier
            coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
Esempio n. 6
0
    def drawstates(self, ax, linewidth=0.5, color='k', antialiased=1):
        """
 Draw state boundaries in Americas.

 ax - current axis instance.
 linewidth - state boundary line width (default 0.5)
 color - state boundary line color (default black)
 antialiased - antialiasing switch for state boundaries (default True).
        """
        coastlines = LineCollection(self.statesegs,
                                    antialiaseds=(antialiased, ))
        try:
            coastlines.set_color(color)
        except:  # this was a typo that existed in matplotlib-0.71 and earlier
            coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
Esempio n. 7
0
    def drawcountries(self,linewidth=0.5,color='k',antialiased=1):
        """
 Draw country boundaries.

 linewidth - country boundary line width (default 0.5)
 color - country boundary line color (default black)
 antialiased - antialiasing switch for country boundaries (default True).
        """
        # get current axes instance.
        ax = pylab.gca()
        coastlines = LineCollection(self.cntrysegs,antialiaseds=(antialiased,))
        try:
            coastlines.set_color(color)
        except: # this was a typo that existed in matplotlib-0.71 and earlier
            coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
Esempio n. 8
0
    def drawcoastlines(self,linewidth=1.,color='k',antialiased=1):
        """
 Draw coastlines.

 linewidth - coastline width (default 1.)
 color - coastline color (default black)
 antialiased - antialiasing switch for coastlines (default True).
        """
        # get current axes instance.
        ax = pylab.gca()
        coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
        try:
            coastlines.set_color(color)
        except: # this was a typo that existed in matplotlib-0.71 and earlier
            coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
        # set axes limits to fit map region.
        self.set_axes_limits()
Esempio n. 9
0
    def drawcountries(self,linewidth=0.5,color='k',antialiased=1):
        """
 Draw country boundaries.

 linewidth - country boundary line width (default 0.5)
 color - country boundary line color (default black)
 antialiased - antialiasing switch for country boundaries (default True).
        """
        # get current axes instance.
        ax = pylab.gca()
        coastlines = LineCollection(self.cntrysegs,antialiaseds=(antialiased,))
        try:
            coastlines.set_color(color)
        except: # this was a typo that existed in matplotlib-0.71 and earlier
            coastlines.color(color)
        coastlines.set_linewidth(linewidth)
        ax.add_collection(coastlines)
        # set axes limits to fit map region.
        self.set_axes_limits()

ax = axes(subplot(212))
curves, edges = ctd.curvature_connect( pts, curvature, 0.5*dt*sqrt(2), err*0.85, 10)

for points in curves:
    segments = []
    for i in range(len(points)):
        p = points[i]
        #arrow(p[0],p[1],0.1*p[2],0.1*p[3], ec=clrs[ci])
        if i < len(points)-1:
            p2 = points[i+1]
            segments.append( [(p[0],p[1]), (p2[0], p2[1])])
    segments.append( [(points[-1][0], points[-1][1]), (points[0][0], points[0][1])])
    LC = LineCollection(segments)
    LC.color(clrs[ci])
    ax.add_collection(LC)

    ci = (ci + 1) % len(clrs)

LC = LineCollection(edges)
LC.color('black')
ax.add_collection(LC)

ax.set_xlim(-0.9,1.0)
ax.set_ylim(-0.6,0.6)
title("Reconstructed curves")
## ax.set_xlim(0.25,0.45)
## ax.set_ylim(-0.1,0.1)