我现在正在处理一些数据,我想制作一个箱线图。我注意到,可以通过设置medlty
和medcol
来更改中间值的线型和颜色。
我想知道如何在箱图中更改25%和75%的分位数线类型和颜色?例如,我可以将行类型2和蓝色设置为25%的分位数,而将行类型3和绿色设置为75%的分位数吗?
set.seed(123)
Mydata = sample(x=100:300, size = 500, replace = T)
Mydata = c(Mydata, 1, 500)
boxplot(Mydata,medcol="red", medlty=3)
答案 0 :(得分:-1)
使用tidyverse的ggplot。检查是否有帮助!
// "Word" class
import UIKit
class Word {
let name: String
let meaning: String
let wordType: String
let numberOfTimesFound: String
init(name: String, meaning: String, wordtype: String, numberOfTimesFound: String) {
self.name = name
self.meaning = meaning
self.wordType = wordtype
self.numberOfTimesFound = numberOfTimesFound
}
}
let words = [
Word(name: "Afraid", meaning: "WORD DEFINITION GOES HERE", wordtype: "adjective", numberOfTimesFound: "1")
]
//MasterViewController.swift
import UIKit
class MasterViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
let firstWord = words.first
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return words.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let word = words[indexPath.row]
cell.textLabel?.text = word.name
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let word = words[indexPath.row]
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.detailViewController.refreshUI(word: word)
}
//AppDelegate.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var masterViewController = MasterViewController()
var detailViewController = DetailViewController()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let splitViewController = window?.rootViewController as? UISplitViewController
let leftNavController = splitViewController!.viewControllers.first as? UINavigationController
masterViewController = (leftNavController?.topViewController as? MasterViewController)!
detailViewController = (splitViewController!.viewControllers.last as? DetailViewController)!
// Override point for customization after application launch.
return true
}