6 examples of 'plotly multiple lines' in Python

Every line of 'plotly multiple lines' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
228def vline(self, x, color=None, **kwargs):
229 self.vlines.append((x, color))
271def 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)
93def 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()
264def 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)
231def 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)
208def line(self, x=None, y=None, **kwargs):
209 return self._xy("line", x, y, **kwargs)

Related snippets