import UIKit
class SigninViewController: UIViewController {
var imagePicker = UIImagePickerController()
@IBOutlet var countPlaceInCar: UITextField!
@IBOutlet var nameOfCar: UITextField!
@IBOutlet var AddPhotoButton: UIButton!
@IBOutlet var registerButton: UIButton!
@IBOutlet var registrationSegmented: UISegmentedControl!
@IBOutlet var addPhotoImage: UIImageView!
@IBOutlet var nameTextField: UITextField!
@IBOutlet var phoneTextField: UITextField!
@IBOutlet var passwordTextField: UITextField!
@IBOutlet var emailTextField: UITextField!
@IBOutlet var segmentedControl: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
makeRounded()
}
//func that rounded image for user
func makeRounded() {
addPhotoImage.layer.borderWidth = 1
addPhotoImage.layer.borderColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
addPhotoImage.layer.cornerRadius = addPhotoImage.frame.height/2 //This will change with corners of image and height/2 will make this circle shape
addPhotoImage.layer.masksToBounds = true
}
@IBAction func addPhotoFromLibraryOrCamera(_ sender: UIButton) {
imagePicker.sourceType = .photoLibrary
imagePicker.allowsEditing = true
present(imagePicker, animated: true, completion: nil)
}
}
extension SigninViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
addPhotoImage.image = image
}
dismiss(animated: true, completion: nil)
}
}
import UIKit
class FourthViewController: UIViewController {
@IBOutlet var messageForUser: UIButton!
@IBOutlet var routeImage: UIImageView!
@IBOutlet var userPhotoImage: UIImageView!
override func viewDidLoad() {
}
the提供了正确的“条”,但文本在x轴上重叠了
另一个快速问题,如何将条形从最高到最低排序。
我选中了此Pandas plot hide some x-axis labels,也选中了x axis label in plot overlaps 这是我的第一个问题,请很好。
答案 0 :(得分:2)
尝试更改:
total.plot(kind='bar')
plt.xticks(rotation='horizontal')
到
total.sort_values(ascending=False).plot(kind='bar')
plt.xticks(rotation=90)
输出:
或者:
counts.sort_values(ascending=False).plot(kind='bar', color='darkblue')
plt.xticks(rotation=25)
输出:
如果您真的坚持使用水平标签,请考虑使用水平条:
counts.sort_values(ascending=False).plot(kind='barh', color='darkblue')
# plt.xticks(rotation=25)