python 图例怎样横排_python – Matplotlib图例垂直旋转

我遇到了类似的问题并通过编写函数legendAsLatex来解决它,该函数生成一个乳胶代码,用作y轴的标签.该功能收集提供给绘图功能的颜色,标记,线条样式和标签.它需要启用乳胶并装入所需的包装.下面是生成绘图的代码,其中包含使用垂直轴的额外曲线.

from matplotlib import pyplot as plt

import matplotlib.colors as cor

plt.rc(‘text’, usetex=True)

plt.rc(‘text.latex’, preamble=r’\usepackage{amsmath} \usepackage{wasysym}’+

r’\usepackage[dvipsnames]{xcolor} \usepackage{MnSymbol} \usepackage{txfonts}’)

def legendAsLatex(axes, rotation=90) :

”’Generate a latex code to be used instead of the legend.

Uses the label, color, marker and linestyle provided to the pyplot.plot.

The marker and the linestyle must be defined using the one or two character

abreviations shown in the help of pyplot.plot.

Rotation of the markers must be multiple of 90.

”’

latexLine = {‘-‘:’\textbf{\Large —}

Original: https://blog.csdn.net/weixin_35899510/article/details/113965481
Author: BLACK枪骑兵
Title: python 图例怎样横排_python – Matplotlib图例垂直旋转

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/768238/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球