Example #1
0
    def reset(self):
        """Initialize or Reset"""
        # delete references to previous annotations
        for obj in self.annotations.values():
            obj.remove()

        spine_pos = self.data_xoffset * self.spine_xoffset

        for chan in range(self.b.n_chans):
            # add spines for channel unit bars
            sp = Spine(self.b.axes, 'left', self.b.axes.spines['left']._path)
            sp.set_position(('axes', spine_pos))
            self.b.axes.spines['ch%s' % chan] = sp

            # add channel names
            self.annotations['ch%s' % chan] = self.b.axes.text(
                    0, 0,  # dummy location
                    'Ch%s' % chan,
                    ha='center',
                    va='center',
                    rotation='vertical')

        # hide unneeded spines and move ticks
        self.b.axes.spines['left'].set_color('none')
        self.b.axes.spines['right'].set_color('none')
        self.b.axes.spines['left'].set_position(('axes', spine_pos))
Example #2
0
 def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
     return {
         'left': Spine.linear_spine(self, 'left'),
         'right': Spine.linear_spine(self, 'right'),
         'bottom': MySpine.linear_spine(self, 'bottom'),
         'top': Spine.linear_spine(self, 'top'),
     }
Example #3
0
 def _gen_axes_spines(self):
     spine = Spine(axes=self,
                   spine_type='circle',
                   path=Path.unit_regular_polygon(4))
     spine.set_transform(Affine2D().scale(.5).translate(.5, .5) +
                         self.transAxes)
     return {'polar': spine}
Example #4
0
            def _gen_axes_spines(self):

                if frame == 'circle':
                    return PolarAxes._gen_axes_spines(self)

                # The following is a hack to get the spines (i.e. the axes frame)

                # to draw correctly for a polygon frame.

                # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`.

                spine_type = 'circle'

                verts = unit_poly_verts(theta + np.pi / 2)

                # close off polygon by repeating first vertex

                verts.append(verts[0])

                path = Path(verts)

                spine = Spine(self, spine_type, path)

                spine.set_transform(self.transAxes)

                return {'polar': spine}
Example #5
0
        def _gen_axes_spines(self):
            verts = _unit_poly_verts(angles)
            verts.append(verts[0])

            spine = Spine(self, 'circle', Path(verts))
            spine.set_transform(self.transAxes)
            return {'polar': spine}
 def _gen_axes_spines(self):
     spine_type = 'circle'
     verts = unit_poly_verts(theta)
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
 def _gen_axes_spines(self):
     if frame == "circle": return PolarAxes._gen_axes_spines(self)
     spine_type, verts = "circle", unit_poly_verts(theta)
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
Example #8
0
 def _gen_axes_spines(self):
     spine_type = 'circle'
     verts = unit_poly_verts(theta)
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
Example #9
0
 def _gen_axes_spines(self):
     if self.radar_patch_type == 'circle':
         return PolarAxes._gen_axes_spines(self)
     spine_type = 'circle'
     verts = unit_poly_verts(self.radar_theta)
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, self.radar_spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
Example #10
0
            def _gen_axes_spines(self):

                spine = Spine(axes=self,
                              spine_type='circle',
                              path=Path.unit_regular_polygon(numVars))
                # unit_regular_polygon gives a polygon of radius 1
                # centered at(0, 0) but we want a polygon of radius 0.5
                # centered at (0.5, 0.5) in axes coordinates.
                spine.set_transform(Affine2D().scale(.5).translate(.5, .5) +
                                    self.transAxes)
                return {'polar': spine}
Example #11
0
            def _gen_axes_spines(self):
                if frame == 'circle':
                    return PolarAxes._gen_axes_spines(self)

                spine_type = 'circle'
                verts = unit_poly_verts(theta)
                # close off polygon by repeating first vertex
                verts.append(verts[0])
                path = Path(verts)

                spine = Spine(self, spine_type, path)
                spine.set_transform(self.transAxes)
                return {'polar': spine}
Example #12
0
 def _gen_axes_spines(self):
     if self.radar_patch_type == 'circle':
         return PolarAxes._gen_axes_spines(self)
     # The following is a hack to get the spines (i.e. the axes frame)
     # to draw correctly for a polygon frame.
     spine_type = 'circle'
     verts = unit_poly_verts(self.radar_theta)
     # close off polygon by repeating first vertex
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, self.radar_spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
Example #13
0
 def _gen_axes_spines(self):
     if self.radar_patch_type == 'circle':
         return PolarAxes._gen_axes_spines(self)
     # The following is a hack to get the spines (i.e. the axes frame)
     # to draw correctly for a polygon frame.
     spine_type = 'circle'
     verts = unit_poly_verts(self.radar_theta)
     # close off polygon by repeating first vertex
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, self.radar_spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
 def _gen_axes_spines(self):
     if frame == 'circle':
         return PolarAxes._gen_axes_spines(self)
     # The following is a hack to get the spines (i.e. the axes frame)
     # to draw correctly for a polygon frame.
     # spine_type must be 'left', 'right', 'top', 'bottom', or `circle`.
     spine_type = 'circle'
     verts = unit_poly_verts(theta)
     # close off polygon by repeating first vertex
     verts.append(verts[0])
     path = Path(verts)
     spine = Spine(self, spine_type, path)
     spine.set_transform(self.transAxes)
     return {'polar': spine}
Example #15
0
 def _gen_axes_spines(self):
     if frame == 'Circle':
         return super()._gen_axes_spines()
     elif frame == 'polygon':
         # spine_type must be 'left'/'right'/'top'/'bottom'/'circle'.
         from matplotlib.path import Path
         from matplotlib.spines import Spine
         from matplotlib.transforms import Affine2D
         spine = Spine(axes=self,
                       spine_type='circle',
                       path=Path.unit_regular_polygon(nvars))
         # unit_regular_polygon gives a polygon of radius 1 centered at (0, 0) but we want a polygon of radius 0.5 centered at (0.5, 0.5) in axes coordinates.
         spine.set_transform(Affine2D().scale(.5).translate(.5, .5) +
                             self.transAxes)
         return {'polar': spine}
Example #16
0
 def _gen_axes_spines(self):
     if frame == 'circle':
         return super()._gen_axes_spines()
     elif frame == 'polygon':
         # spine_type must be 'left'/'right'/'top'/'bottom'/'circle'.
         spine = Spine(axes=self,
                       spine_type='circle',
                       path=Path.unit_regular_polygon(num_vars))
         # unit_regular_polygon gives a polygon of radius 1 centered at
         # (0, 0) but we want a polygon of radius 0.5 centered at (0.5,
         # 0.5) in axes coordinates.
         spine.set_transform(Affine2D().scale(.5).translate(.5, .5)
                             + self.transAxes)
         return {'polar': spine}
     else:
         raise ValueError("unknown value for 'frame': %s" % frame)
 def _gen_axes_spines(self):
     if frame == 'circle':
         return super()._gen_axes_spines()
     elif frame == 'polygon':
         # spine_type must be 'left'/'right'/'top'/'bottom'/'circle'.
         spine = Spine(axes=self,
                       spine_type='circle',
                       path=Path.unit_regular_polygon(num_vars))
         # unit_regular_polygon gives a polygon of radius 1 centered at
         # (0, 0) but we want a polygon of radius 0.5 centered at (0.5,
         # 0.5) in axes coordinates.
         spine.set_transform(Affine2D().scale(.5).translate(.5, .5) +
                             self.transAxes)
         return {'polar': spine}
     else:
         raise ValueError("unknown value for 'frame': %s" % frame)
        def _gen_axes_spines(self):
            if frame == 'circle':
                return PolarAxes._gen_axes_spines(self)
            # The following is a hack to get the spines (i.e. the axes frame)
            # to draw correctly for a polygon frame.

            # spine_type haruslah 'left', 'right', 'top', 'bottom', or `circle`.
            spine_type = 'circle'
            verts = unit_poly_verts(theta)
            # menghentikan sementara polygon dengan mengulangi vertex awal
            verts.append(verts[0])
            path = Path(verts)

            spine = Spine(self, spine_type, path)
            spine.set_transform(self.transAxes)
            return {'polar': spine}
Example #19
0
 def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
     return {SmithAxes.name: Spine.circular_spine(self, (0.5, 0.5), self._get_key("axes.radius"))}
        def draw(self, renderer):
            """ Draw. If frame is polygon, make gridlines polygon-shaped """
            if frame == 'polygon':
                gridlines = self.yaxis.get_gridlines()
                for gl in gridlines:
                    gl.get_path()._interpolation_steps = num_vars
            super().draw(renderer)


        def _gen_axes_spines(self):
            if frame == 'circle':
                return super()._gen_axes_spines()
            elif frame == 'polygon':
                # spine_type must be 'left'/'right'/'top'/'bottom'/'circle'.
                spine = Spine(axes=self,
                              spine_type='circle',
                              path=Path.unit_regular_polygon(num_vars))
                # unit_regular_polygon gives a polygon of radius 1 centered at
                # (0, 0) but we want a polygon of radius 0.5 centered at (0.5,
                # 0.5) in axes coordinates.
                spine.set_transform(Affine2D().scale(.5).translate(.5, .5)
                                    + self.transAxes)


                return {'polar': spine}
            else:
                raise ValueError("unknown value for 'frame': %s" % frame)

    register_projection(RadarAxes)
    return theta
Example #21
0
Lt = []
L1 = []
L2 = []

fig, ax = subplots(2, sharex=True, figsize=(16, 4))
fig.canvas.set_window_title('%s (%s)' % (__file__, file_name))
if w:
    fig.patch.set_alpha(0)

ax[0].set_title(u'Hinge rate (deg/s)', fontsize=15, pad=5)
#ax[0].set_ylabel( u'$V$', fontsize=15, labelpad=-2 )
l1, = ax[0].plot(Lt, L1, linewidth=3, zorder=0, c=plot_color)
#ax[0].grid( True )
ax[0].spines['abscissa'] = Spine(ax[0],
                                 'bottom',
                                 ax[0].spines['bottom'].get_path(),
                                 ls='dashed',
                                 alpha=1)
ax[0].set_ylim((ymin1, ymax1))

ax[1].set_title(u'Boggie torque (N.m)', fontsize=15, pad=5)
#ax[1].set_ylabel( u'$T$', fontsize=15, labelpad=-2 )
l2, = ax[1].plot(Lt, L2, linewidth=3, zorder=0, c=plot_color)
#ax[1].grid( True )
ax[1].spines['abscissa'] = Spine(ax[1],
                                 'bottom',
                                 ax[1].spines['bottom'].get_path(),
                                 ls='dashed',
                                 alpha=1)
ax[1].set_ylim((ymin2, ymax2))
Example #22
0
 def _gen_axes_spines(self):
     return {"stereographic": Spine.circular_spine(self, (0.5, 0.5), 0.5)}