我正在使用saveImage保存图像.
func saveImage (image: UIImage, path: String ) -> Bool{
let pngImageData = UIImagePNGRepresentation(image)
//let jpgImageData = UIImageJPEGRepresentation(image, 1.0) // if you want to save as JPEG
print("!!!saving image at: \(path)")
let result = pngImageData!.writeToFile(path, atomically: true)
return result
}
Run Code Online (Sandbox Code Playgroud)
保存文件无法正常工作(打印"[ - ] ERROR SAVING FILE") -
// save your image here into Document Directory
let res = saveImage(tempImage, path: fileInDocumentsDirectory("abc.png"))
if(res == true){
print ("[+] FILE SAVED")
}else{
print ("[-] ERROR SAVING FILE")
}
Run Code Online (Sandbox Code Playgroud)
为什么saveImage函数没有保存图像?访问权限?
调试信息说:
!!!saving …Run Code Online (Sandbox Code Playgroud) 我用
sns.distplot
Run Code Online (Sandbox Code Playgroud)
绘制单变量的观测分布.不过,我不仅需要图表,还需要数据点.如何从matplotlib轴获取数据点(由distplot返回)?
我想绘制一个相关图.
features = features[,-2]
features<- scale(features[2:ncol(features)],center=TRUE,scale=TRUE);
correlationmatrix <- cor(features)
corrplot(correlationmatrix, order = "hclust")
Run Code Online (Sandbox Code Playgroud)
直到第3行,一切正常.跑步时corrplot(),我得到:
if(min(corr)<-1 - .Machine $ double.eps || max(corr)> 1 + .Machine $ double.eps){:缺少值需要TRUE/FALSE时出错