我正在使用日志记录包在日志文件中写入一些错误值和矩阵。
logging.info("Error = %.4f"%err)
logging.info(error_mat) #error_mat is a NxN matrix
Run Code Online (Sandbox Code Playgroud)
然而,矩阵以不同的方式编写:
2014-09-08 14:10:20,107 - root - INFO - [[ 8.30857546 0.69993454 0.20645551
77.01797674 13.76705776]
[ 8.35205432 0.53417203 0.19969048 76.78598173 14.12810144]
[ 8.37066492 0.64428449 0.18623849 76.4181809 14.3806312 ]
[ 8.50493296 0.5110043 0.19731849 76.45838604 14.32835821]
[ 8.18900791 0.4955451 0.22524777 76.96966663 14.12053259]]
Run Code Online (Sandbox Code Playgroud)
或者
2014-09-08 14:12:22,211 - root - INFO - [[ 3.25142253e+01 1.11788106e+00 1.51065008e-02 6.16496299e+01
4.70315726e+00]
[ 3.31685887e+01 9.53522041e-01 1.49767860e-02 6.13449154e+01
4.51799710e+00]
[ 3.31101827e+01 1.09729703e+00 5.03347259e-03 6.11818594e+01
4.60562742e+00]
[ 3.32506957e+01 1.13837592e+00 1.51783456e-02 6.08651657e+01 …
Run Code Online (Sandbox Code Playgroud) 我一直在用seaborn搜索python中的3D图,但还没有看到。我想3D绘制最初使用seaborn pairplot绘制的数据集。谁能帮我解决以下两个问题:
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.,ncol=4)
我看到以下错误时:anaconda2 / lib / python2.7 / site-packages / matplotlib / axes / _axes.py:545: UserWarning:未找到带标签的对象。在各个图上使用label ='...'kwarg。warnings.warn(“未找到带标签的对象。”提前致谢 !我的参考资料:如何在Python中制作3D散点图? https://pythonspot.com/3d-scatterplot/ https://jakevdp.github.io/PythonDataScienceHandbook/04.12-three-Dimension-plotting.html
这是MWE:
import re, seaborn as sns, numpy as np, pandas as pd, random
from pylab import *
from matplotlib.pyplot import plot, show, draw, figure, cm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
sns.set_style("whitegrid", {'axes.grid' : False})
fig = plt.figure(figsize=(6,6))
ax = Axes3D(fig) # Method 1
# ax = fig.add_subplot(111, projection='3d') …
Run Code Online (Sandbox Code Playgroud)