How to use 'plt legend title' in Python

Every line of 'plt legend title' 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
this disclaimer
251def legend(self, ax, lines=(), labels=(), legend_loc="best"):
252 ax.legend(
253 lines,
254 labels,
255 title=None,
256 loc=legend_loc,
257 frameon=False,
258 ncol=1,
259 labelspacing=0.5,
260 columnspacing=1,
261 borderpad=1,
262 handlelength=2,
263 fontsize=12,
264 )
265 return ax

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

325def legend(*args, **kwargs):
326 kwargs.setdefault('framealpha', 0.2)
327 try:
328 plt.legend(*args, **kwargs)
329 except:
330 warnings.warn("framealpha not effective")
331 kwargs.pop('framealpha')
332 plt.legend(*args, **kwargs)

Related snippets