There are quite a few questions here on SO on how to fix an axis in CorePlot but all of them reference the axisConstraints property of the CPTXYAxis which is nonexistent in CorePlot 2.0 and later.
So the question is how to fix the Y axis in core plot 2.0 and newer?
I'm not doing anything fancy here:
let graph = CPTXYGraph(frame: self.nativeView.graphView.bounds)
let plotSpace = graph.defaultPlotSpace!
plotSpace.setPlotRange(CPTPlotRange(location: -1, length: 20), forCoordinate: .X)
plotSpace.setPlotRange(CPTPlotRange(location: -10, length: 20), forCoordinate: .Y)
plotSpace.allowsUserInteraction = true
plotSpace.delegate = self
let axisSet = graph.axisSet
if let axis = axisSet?.axisForCoordinate(.Y, atIndex: 0) {
axis.majorIntervalLength = 5
axis.minorTicksPerInterval = 5
let formatter = NSNumberFormatter()
formatter.positiveFormat = "#"
formatter.negativeFormat = "#"
axis.labelFormatter = formatter
//Here I want to fix this thing..
}
//And then I create a scatter plot and add it and that's it