Python matplotlib.patches.Arc() Examples
The following are 26
code examples of matplotlib.patches.Arc().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.patches
, or try the search function
.
Example #1
Source File: test_patches.py From twitter-stock-recommendation with MIT License | 9 votes |
def test_patch_str(): """ Check that patches have nice and working `str` representation. Note that the logic is that `__str__` is defined such that: str(eval(str(p))) == str(p) """ p = mpatches.Circle(xy=(1, 2), radius=3) assert str(p) == 'Circle(xy=(1, 2), radius=3)' p = mpatches.Ellipse(xy=(1, 2), width=3, height=4, angle=5) assert str(p) == 'Ellipse(xy=(1, 2), width=3, height=4, angle=5)' p = mpatches.Rectangle(xy=(1, 2), width=3, height=4, angle=5) assert str(p) == 'Rectangle(xy=(1, 2), width=3, height=4, angle=5)' p = mpatches.Wedge(center=(1, 2), r=3, theta1=4, theta2=5, width=6) assert str(p) == 'Wedge(center=(1, 2), r=3, theta1=4, theta2=5, width=6)' p = mpatches.Arc(xy=(1, 2), width=3, height=4, angle=5, theta1=6, theta2=7) expected = 'Arc(xy=(1, 2), width=3, height=4, angle=5, theta1=6, theta2=7)' assert str(p) == expected
Example #2
Source File: ssto_fbd.py From dymos with Apache License 2.0 | 8 votes |
def get_angle_plot(line1, line2, radius=1, color=None, origin=(0, 0), len_x_axis=1, len_y_axis=1): l1xy = line1.get_xydata() # Angle between line1 and x-axis l1_xs = l1xy[:, 0] l1_ys = l1xy[:, 1] angle1 = np.degrees(np.arctan2(np.diff(l1_ys), np.diff(l1_xs))) l2xy = line2.get_xydata() # Angle between line2 and x-axis l2_xs = l2xy[:, 0] l2_ys = l2xy[:, 1] angle2 = np.degrees(np.arctan2(np.diff(l2_ys), np.diff(l2_xs))) theta1 = min(angle1, angle2) theta2 = max(angle1, angle2) if color is None: color = line1.get_color() # Uses the color of line 1 if color parameter is not passed. return Arc(origin, len_x_axis * radius, len_y_axis * radius, 0, theta1, theta2, color=color)
Example #3
Source File: plt_draw.py From tyssue with GNU General Public License v3.0 | 7 votes |
def curved_view(sheet, radius_cutoff=1e3): center_data = get_arc_data(sheet) fig, ax = sheet_view(sheet, **{"edge": {"visible": False}}) curves = [] for idx, edge in center_data.iterrows(): if edge["radius"] > radius_cutoff: st = sheet.edge_df.loc[idx, ["srce", "trgt"]] xy = sheet.vert_df.loc[st, sheet.coords] patch = PathPatch(Path(xy)) else: patch = Arc( edge[["x", "y"]], 2 * edge["radius"], 2 * edge["radius"], theta1=edge["theta1"] * 180 / np.pi, theta2=edge["theta2"] * 180 / np.pi, ) curves.append(patch) ax.add_collection(PatchCollection(curves, False, **{"facecolors": "none"})) ax.autoscale() return fig, ax
Example #4
Source File: LinksTrack.py From pyGenomeTracks with GNU General Public License v3.0 | 6 votes |
def plot_arcs(self, ax, interval): width = (interval.end - interval.begin) if self.properties['compact_arcs_level'] == '1': half_height = np.sqrt(width) elif self.properties['compact_arcs_level'] == '2': half_height = 1000 else: half_height = width center = interval.begin + width / 2 if half_height > self.max_height: self.max_height = half_height # I think this was an error... # ax.plot([center], [diameter]) if self.colormap: # translate score field # into a color rgb = self.colormap.to_rgba(interval.data[4]) else: rgb = self.properties['color'] ax.add_patch(Arc((center, 0), width, 2 * half_height, 0, 0, 180, color=rgb, linewidth=self.line_width, ls=self.properties['line_style']))
Example #5
Source File: geometry.py From pycalculix with Apache License 2.0 | 6 votes |
def plot(self, ax, label=True): """Draws and labels the arc onto the passed Matplotlib axis. Args: ax: Matplotlib axis label (bool): if True, label the arc """ ctr = self.actr vect1 = None sign = 1 if self.concavity == 'concave': vect1 = self.pt(0)-ctr else: sign = -1 vect1 = self.pt(1)-ctr rad = self.radius ang1 = (vect1.ang_deg()) ang2 = ang1 + sign*self.get_ang() # matplotlib assumes ccw arc drawing, calculix assumes cw drawing a = AArc(xy=[ctr.y, ctr.x], width=2*rad, height=2*rad, angle=0, theta1=ang1, theta2=ang2) ax.add_artist(a) if label: self.label(ax)
Example #6
Source File: brachistochrone_fbd.py From dymos with Apache License 2.0 | 6 votes |
def get_angle_plot(line1, line2, radius=1, color=None, origin=(0, 0), len_x_axis=1, len_y_axis=1): # pragma: no cover l1xy = line1.get_xydata() # Angle between line1 and x-axis l1_xs = l1xy[:, 0] l1_ys = l1xy[:, 1] angle1 = np.degrees(np.arctan2(np.diff(l1_ys), np.diff(l1_xs))) l2xy = line2.get_xydata() # Angle between line2 and x-axis l2_xs = l2xy[:, 0] l2_ys = l2xy[:, 1] angle2 = np.degrees(np.arctan2(np.diff(l2_ys), np.diff(l2_xs))) theta1 = min(angle1, angle2) theta2 = max(angle1, angle2) if color is None: color = line1.get_color() # Uses the color of line 1 if color parameter is not passed. return Arc(origin, len_x_axis * radius, len_y_axis * radius, 0, theta1, theta2, color=color)
Example #7
Source File: min_time_climb_fbd.py From dymos with Apache License 2.0 | 6 votes |
def get_angle_plot(line1, line2, radius=1, color=None, origin=(0, 0), len_x_axis=1, len_y_axis=1): # pragma: no cover l1xy = line1.get_xydata() # Angle between line1 and x-axis l1_xs = l1xy[:, 0] l1_ys = l1xy[:, 1] angle1 = np.degrees(np.arctan2(np.diff(l1_ys), np.diff(l1_xs))) l2xy = line2.get_xydata() # Angle between line2 and x-axis l2_xs = l2xy[:, 0] l2_ys = l2xy[:, 1] angle2 = np.degrees(np.arctan2(np.diff(l2_ys), np.diff(l2_xs))) theta1 = min(angle1, angle2) theta2 = max(angle1, angle2) if color is None: color = line1.get_color() # Uses the color of line 1 if color parameter is not passed. return Arc(origin, len_x_axis * radius, len_y_axis * radius, 0, theta1, theta2, color=color)
Example #8
Source File: mf.py From pyscf with Apache License 2.0 | 6 votes |
def plot_contour(self, w=0.0): """ Plot contour with poles of Green's function in the self-energy SelfEnergy(w) = G(w+w')W(w') with respect to w' = Re(w')+Im(w') Poles of G(w+w') are located: w+w'-(E_n-Fermi)+i*eps sign(E_n-Fermi)==0 ==> w'= (E_n-Fermi) - w -i eps sign(E_n-Fermi) """ try : import matplotlib.pyplot as plt from matplotlib.patches import Arc, Arrow except: print('no matplotlib?') return fig,ax = plt.subplots() fe = self.fermi_energy ee = self.mo_energy iee = 0.5-np.array(ee>fe) eew = ee-fe-w ax.plot(eew, iee, 'r.', ms=10.0) pp = list() pp.append(Arc((0,0),4,4,angle=0, linewidth=2, theta1=0, theta2=90, zorder=2, color='b')) pp.append(Arc((0,0),4,4,angle=0, linewidth=2, theta1=180, theta2=270, zorder=2, color='b')) pp.append(Arrow(0,2,0,-4,width=0.2, color='b', hatch='o')) pp.append(Arrow(-2,0,4,0,width=0.2, color='b', hatch='o')) for p in pp: ax.add_patch(p) ax.set_aspect('equal') ax.grid(True, which='both') ax.axhline(y=0, color='k') ax.axvline(x=0, color='k') plt.ylim(-3.0,3.0) plt.show()
Example #9
Source File: brachistochrone_fbd.py From dymos with Apache License 2.0 | 6 votes |
def get_angle_plot(line1, line2, radius=1, color=None, origin=(0, 0), len_x_axis=1, len_y_axis=1): # pragma: no cover l1xy = line1.get_xydata() # Angle between line1 and x-axis l1_xs = l1xy[:, 0] l1_ys = l1xy[:, 1] angle1 = np.degrees(np.arctan2(np.diff(l1_ys), np.diff(l1_xs))) l2xy = line2.get_xydata() # Angle between line2 and x-axis l2_xs = l2xy[:, 0] l2_ys = l2xy[:, 1] angle2 = np.degrees(np.arctan2(np.diff(l2_ys), np.diff(l2_xs))) theta1 = min(angle1, angle2) theta2 = max(angle1, angle2) if color is None: color = line1.get_color() # Uses the color of line 1 if color parameter is not passed. return Arc(origin, len_x_axis * radius, len_y_axis * radius, 0, theta1, theta2, color=color)
Example #10
Source File: matplotlib_backend.py From ezdxf with MIT License | 6 votes |
def draw_arc(self, center: Vector, width: float, height: float, angle: Radians, draw_angles: Optional[Tuple[Radians, Radians]], properties: Properties): if min(width, height) < 1e-5: return # matplotlib crashes if the arc has almost 0 size if draw_angles is None: start_degrees, end_degrees = 0, 360 else: # draw angles are relative to `angle`. The arc is drawn anticlockwise from start to end. # draw_angles are *NOT* in the global coordinate system, but instead are angles inside the # local coordinate system defined by the major and minor axes of the ellipse # (where the ellipse looks like a circle) ratio = height / width start, end = param_to_angle(ratio, draw_angles[0]), param_to_angle(ratio, draw_angles[1]) start_degrees, end_degrees = degrees(start), degrees(end) arc = Arc((center.x, center.y), width, height, color=properties.color, linewidth=self.line_width, angle=degrees(angle), theta1=start_degrees, theta2=end_degrees, zorder=self._get_z()) self.ax.add_patch(arc)
Example #11
Source File: matplotlib.py From qiskit-terra with Apache License 2.0 | 6 votes |
def _measure(self, qxy, cxy, cid, fc=None, ec=None, gt=None, sc=None): qx, qy = qxy cx, cy = cxy # draw gate box self._gate(qxy, fc=fc, ec=ec, gt=gt, sc=sc) # add measure symbol arc = patches.Arc(xy=(qx, qy - 0.15 * HIG), width=WID * 0.7, height=HIG * 0.7, theta1=0, theta2=180, fill=False, ec=self._style.not_gate_lc, linewidth=2, zorder=PORDER_GATE) self.ax.add_patch(arc) self.ax.plot([qx, qx + 0.35 * WID], [qy - 0.15 * HIG, qy + 0.20 * HIG], color=self._style.not_gate_lc, linewidth=2, zorder=PORDER_GATE) # arrow self._line(qxy, [cx, cy + 0.35 * WID], lc=self._style.cc, ls=self._style.cline) arrowhead = patches.Polygon(((cx - 0.20 * WID, cy + 0.35 * WID), (cx + 0.20 * WID, cy + 0.35 * WID), (cx, cy)), fc=self._style.cc, ec=None) self.ax.add_artist(arrowhead) # target if self.cregbundle: self.ax.text(cx + .25, cy + .1, str(cid), ha='left', va='bottom', fontsize=0.8 * self._style.fs, color=self._style.tc, clip_on=True, zorder=PORDER_TEXT)
Example #12
Source File: test_axes.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_arc_ellipse(): from matplotlib import patches xcenter, ycenter = 0.38, 0.52 width, height = 1e-1, 3e-1 angle = -30 theta = np.deg2rad(np.arange(360)) x = width / 2. * np.cos(theta) y = height / 2. * np.sin(theta) rtheta = np.deg2rad(angle) R = np.array([ [np.cos(rtheta), -np.sin(rtheta)], [np.sin(rtheta), np.cos(rtheta)]]) x, y = np.dot(R, np.array([x, y])) x += xcenter y += ycenter fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2)
Example #13
Source File: test_axes.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_arc_angles(): from matplotlib import patches # Ellipse parameters w = 2 h = 1 centre = (0.2, 0.5) scale = 2 fig, axs = plt.subplots(3, 3) for i, ax in enumerate(axs.flat): theta2 = i * 360 / 9 theta1 = theta2 - 45 ax.add_patch(patches.Ellipse(centre, w, h, alpha=0.3)) ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) # Straight lines intersecting start and end of arc ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0], centre[0], scale * np.cos(np.deg2rad(theta2)) + centre[0]], [scale * np.sin(np.deg2rad(theta1)) + centre[1], centre[1], scale * np.sin(np.deg2rad(theta2)) + centre[1]]) ax.set_xlim(-scale, scale) ax.set_ylim(-scale, scale) # This looks the same, but it triggers a different code path when it # gets large enough. w *= 10 h *= 10 centre = (centre[0] * 10, centre[1] * 10) scale *= 10
Example #14
Source File: test_axes.py From neural-network-animation with MIT License | 6 votes |
def test_arc_ellipse(): from matplotlib import patches xcenter, ycenter = 0.38, 0.52 width, height = 1e-1, 3e-1 angle = -30 theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0 x = width/2. * np.cos(theta) y = height/2. * np.sin(theta) rtheta = angle*np.pi/180. R = np.array([ [np.cos(rtheta), -np.sin(rtheta)], [np.sin(rtheta), np.cos(rtheta)], ]) x, y = np.dot(R, np.array([x, y])) x += xcenter y += ycenter fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2)
Example #15
Source File: test_axes.py From ImageFusion with MIT License | 5 votes |
def test_arc_ellipse(): from matplotlib import patches xcenter, ycenter = 0.38, 0.52 width, height = 1e-1, 3e-1 angle = -30 theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0 x = width/2. * np.cos(theta) y = height/2. * np.sin(theta) rtheta = angle*np.pi/180. R = np.array([ [np.cos(rtheta), -np.sin(rtheta)], [np.sin(rtheta), np.cos(rtheta)], ]) x, y = np.dot(R, np.array([x, y])) x += xcenter y += ycenter fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2)
Example #16
Source File: test_axes.py From coffeegrindsize with MIT License | 5 votes |
def test_arc_angles(): from matplotlib import patches # Ellipse parameters w = 2 h = 1 centre = (0.2, 0.5) scale = 2 fig, axs = plt.subplots(3, 3) for i, ax in enumerate(axs.flat): theta2 = i * 360 / 9 theta1 = theta2 - 45 ax.add_patch(patches.Ellipse(centre, w, h, alpha=0.3)) ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) # Straight lines intersecting start and end of arc ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0], centre[0], scale * np.cos(np.deg2rad(theta2)) + centre[0]], [scale * np.sin(np.deg2rad(theta1)) + centre[1], centre[1], scale * np.sin(np.deg2rad(theta2)) + centre[1]]) ax.set_xlim(-scale, scale) ax.set_ylim(-scale, scale) # This looks the same, but it triggers a different code path when it # gets large enough. w *= 10 h *= 10 centre = (centre[0] * 10, centre[1] * 10) scale *= 10
Example #17
Source File: test_axes.py From coffeegrindsize with MIT License | 5 votes |
def test_arc_ellipse(): from matplotlib import patches xcenter, ycenter = 0.38, 0.52 width, height = 1e-1, 3e-1 angle = -30 theta = np.deg2rad(np.arange(360)) x = width / 2. * np.cos(theta) y = height / 2. * np.sin(theta) rtheta = np.deg2rad(angle) R = np.array([ [np.cos(rtheta), -np.sin(rtheta)], [np.sin(rtheta), np.cos(rtheta)]]) x, y = np.dot(R, np.array([x, y])) x += xcenter y += ycenter fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2)
Example #18
Source File: test_axes.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_arc_angles(): from matplotlib import patches # Ellipse parameters w = 2 h = 1 centre = (0.2, 0.5) scale = 2 fig, axs = plt.subplots(3, 3) for i, ax in enumerate(axs.flat): theta2 = i * 360 / 9 theta1 = theta2 - 45 ax.add_patch(patches.Ellipse(centre, w, h, alpha=0.3)) ax.add_patch(patches.Arc(centre, w, h, theta1=theta1, theta2=theta2)) # Straight lines intersecting start and end of arc ax.plot([scale * np.cos(np.deg2rad(theta1)) + centre[0], centre[0], scale * np.cos(np.deg2rad(theta2)) + centre[0]], [scale * np.sin(np.deg2rad(theta1)) + centre[1], centre[1], scale * np.sin(np.deg2rad(theta2)) + centre[1]]) ax.set_xlim(-scale, scale) ax.set_ylim(-scale, scale) # This looks the same, but it triggers a different code path when it # gets large enough. w *= 10 h *= 10 centre = (centre[0] * 10, centre[1] * 10) scale *= 10
Example #19
Source File: test_axes.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_arc_ellipse(): from matplotlib import patches xcenter, ycenter = 0.38, 0.52 width, height = 1e-1, 3e-1 angle = -30 theta = np.deg2rad(np.arange(360)) x = width / 2. * np.cos(theta) y = height / 2. * np.sin(theta) rtheta = np.deg2rad(angle) R = np.array([ [np.cos(rtheta), -np.sin(rtheta)], [np.sin(rtheta), np.cos(rtheta)]]) x, y = np.dot(R, np.array([x, y])) x += xcenter y += ycenter fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) ax.add_patch(e2)
Example #20
Source File: arcs.py From CoolBox with GNU General Public License v3.0 | 4 votes |
def plot(self, ax, chrom_region, region_start, region_end): """ Makes and arc connecting two points on a linear scale representing interactions between Hi-C bins. """ self.ax = ax from matplotlib.patches import Arc height = 1 max_diameter = 0 count = 0 if chrom_region not in list(self.interval_tree): chrom_region = change_chrom_names(chrom_region) arcs_in_region = sorted(self.interval_tree[chrom_region][region_start:region_end]) for idx, interval in enumerate(arcs_in_region): # skip arcs whose start and end are outside the plotted region if interval.begin < region_start and interval.end > region_end: continue if 'line_width' in self.properties: line_width = float(self.properties['line_width']) else: line_width = 0.5 * np.sqrt(interval.data) diameter = (interval.end - interval.begin) center = (interval.begin + interval.end) / 2 if diameter > max_diameter: max_diameter = diameter count += 1 ax.plot([center], [diameter]) ax.add_patch(Arc((center, 0), diameter, height*2, 0, 0, 180, color=self.properties['color'], lw=line_width)) # increase max_diameter slightly to avoid cropping of the arcs. # max_diameter += max_diameter * 0.05 height += height * 0.05 log.debug("{} were arcs plotted".format(count)) if 'orientation' in self.properties and self.properties['orientation'] == 'inverted': ax.set_ylim(height, 0.001) else: ax.set_ylim(-0.001, height) ax.set_xlim(region_start, region_end) log.debug('title is {}'.format(self.properties['title'])) self.plot_label()
Example #21
Source File: spines.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super().__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()
Example #22
Source File: spines.py From coffeegrindsize with MIT License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super().__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()
Example #23
Source File: spines.py From CogAlg with MIT License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super().__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()
Example #24
Source File: spines.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super().__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()
Example #25
Source File: spines.py From twitter-stock-recommendation with MIT License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super(Spine, self).__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()
Example #26
Source File: spines.py From Mastering-Elasticsearch-7.0 with MIT License | 4 votes |
def __init__(self, axes, spine_type, path, **kwargs): """ - *axes* : the Axes instance containing the spine - *spine_type* : a string specifying the spine type - *path* : the path instance used to draw the spine Valid kwargs are: %(Patch)s """ super().__init__(**kwargs) self.axes = axes self.set_figure(self.axes.figure) self.spine_type = spine_type self.set_facecolor('none') self.set_edgecolor(rcParams['axes.edgecolor']) self.set_linewidth(rcParams['axes.linewidth']) self.set_capstyle('projecting') self.axis = None self.set_zorder(2.5) self.set_transform(self.axes.transData) # default transform self._bounds = None # default bounds self._smart_bounds = False # Defer initial position determination. (Not much support for # non-rectangular axes is currently implemented, and this lets # them pass through the spines machinery without errors.) self._position = None if not isinstance(path, matplotlib.path.Path): raise ValueError( "'path' must be an instance of 'matplotlib.path.Path'") self._path = path # To support drawing both linear and circular spines, this # class implements Patch behavior three ways. If # self._patch_type == 'line', behave like a mpatches.PathPatch # instance. If self._patch_type == 'circle', behave like a # mpatches.Ellipse instance. If self._patch_type == 'arc', behave like # a mpatches.Arc instance. self._patch_type = 'line' # Behavior copied from mpatches.Ellipse: # Note: This cannot be calculated until this is added to an Axes self._patch_transform = mtransforms.IdentityTransform()