Multiple Scatterplots Using Core Plot and Swift

Multiple scatterplots using Core Plot and Swift

For a starter, create two CPTScatterPlots (e.g. boundLinePlot1 & boundLinePlot2)and configure them with different colors and different identifier then add them

boundLinePlot1.identifier = "Blue Plot"
boundLinePlot2.identifier = "Green Plot"

newGraph.addPlot(boundLinePlot1)
newGraph.addPlot(boundLinePlot2)

Now in the Plot Data Source Methods (numberOfRecordsForPlot & numberForPlot) calculate return value based on plot.identifier

if plot.identifier == "Blue Plot" {
return dataForPlot1[Int(recordIndex)][plotField!]
} else {
return dataForPlot2[Int(recordIndex)][plotField!]
}

How to add offset between two scatter plot graphs using coreplot

If barWidthsAreInViewCoordinates is NO (the default), you can just add or subtract the barOffset from the x or y coordinate in the datasource.

Core-Plot: Removing line that connects points in Scatterplot?

You can hide lines in Core Plot by setting the corresponding line style to nil.

scatterPlot.dataLineStyle = nil;


Related Topics



Leave a reply



Submit