我有一个海生的故事情节。我想展示科学记数法。目前,图像在x和y刻度上占据了很大的空间。我想通过将坐标轴转换成科学符号来最小化它
我的代码:
sns.relplot(x='Vmpp',y='cVmpp',data=cdf)
我的解决方案和当前输出:
#I tried a solution reported for the seaborn heatmap. It did produce a plot (I think heat plot?) but did not work.
sns.relplot(x='Vmpp',y='cVmpp',data=cdf,fmt='.2g')
目前产出:
AttributeError: 'PathCollection' object has no property 'fmt'
^{} 是一个figure-level函数。如果您只需要简单的散点图,您可能需要使用^{}
在任何情况下,都可以使用通常的matplotlib方法微调绘图。特别是,可以使用^{} 强制对任何记号标签编号进行科学标记
我还建议设置
alpha
值,因为您有许多重叠点。下面是一个完整的示例:编辑: 正如@mwaskom指出的,您也可以通过
sns.relplot()
以这种方式更改记号标签,在本例中,只需在格式化程序之前调用plotting函数。您不需要指定轴,因为ticklabel_format()
也通过matplotlib.pyplot
接口工作:相关问题 更多 >
编程相关推荐