Every line of 'matplotlib plot horizontal line' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
231 def hline(self, y, color=None, **kwargs): 232 ax = self._newAx() 233 color = color or get_color(None, None, None) 234 ax.axhline(y, color=color, **kwargs)
46 def plot_lines(axis, object, color='#00b700'): 47 for line in object: 48 x, y = line.xy 49 ax.plot(x, y, color=color, alpha=0.4, linewidth=1, solid_capstyle='round', zorder=2)
264 def vline(self, x, color=None, **kwargs): 265 ax = self._newAx() 266 _color = color or get_color(None, None, None) 267 ax.axvline(x, color=_color, **kwargs)
271 def lines(x, y, ax=None, **kwargs): 272 """Add lines to the most recent plot. 273 274 """ 275 if ax is None: 276 global _last_axis_ 277 ax = _last_axis_ 278 ax.plot(x, y, **kwargs)
93 def line(data, 94 file_path, 95 style=[], 96 title='', 97 xlabel='', 98 ylabel='', 99 logx=False, 100 logy=False, 101 vlines=[]): 102 """Plots a line plot using matplotlib. 103 104 Parameters 105 ---------- 106 data : pd.DataFrame 107 two column df with x and y values 108 file_path : str 109 path to save figure 110 title : str 111 graph title 112 xlabel : str 113 x-axis label 114 ylabel : str 115 y-axis label 116 vlines : list of int 117 draw vertical lines at positions 118 """ 119 # plot data 120 data.plot(kind='line', style=style) 121 plt.title(title) 122 plt.xlabel(xlabel) 123 plt.ylabel(ylabel) 124 125 # log scale if neccessary 126 if logx: 127 plt.xscale('log') 128 if logy: 129 plt.yscale('log') 130 131 # plot vertical lines 132 ymin, ymax = plt.ylim() # get plotting range of y-axis 133 for l in vlines: 134 plt.vlines(l, ymin=ymin, 135 ymax=ymax, 136 color='red') 137 138 plt.tight_layout() # adjust plot margins 139 plt.savefig(file_path) # save figure 140 plt.clf() # clear figure 141 plt.close()
14 def plot_item(hor, style): 15 x, y = sec.slice_horizon(hor) 16 # Skip first and last points... 17 l, = sec.ax.plot(x, y, **style) 18 return l
17 def line(x, y, angle, plt): 18 line = mpl.patches.Ellipse(xy=(x,y), width=0.8, height=0.3, 19 angle=angle, facecolor="none", 20 edgecolor="#000000", linewidth=3) 21 plt.gca().add_artist(line) 22 return plt