有时默认的图例位置不符合我们的需要,那么我们可以使用下面的代码对legend位置进行调整. plt.legend(loc='String or Number', bbox_to_anchor=(num1, num2)) 其中,第一个参数loc,设置它可以遵循以下的表格 String Number upper right 1 upper left 2 lower left 3 lower right 4 right 5 center left 6 center right 7 lower cent
移除图例 require(ggplot2) b = qplot(Sepal.Length,Petal.Length,data=iris,geom="point",colour = Species) #有图例 b #去除图例 b+theme(legend.position="none")#右图 2.图例位置摆放 b = qplot(Species,Sepal.Width,data=iris,geom="boxplot",fill = Species
常用模块导入 import numpy as np import matplotlib import matplotlib.mlab as mlab import matplotlib.pyplot as plt import matplotlib.font_manager as fm from mpl_toolkits.mplot3d import Axes3D 解决显示异常问题 中文乱码 myfont = fm.FontProperties(fname="字体文件路径") 负号显示