1
votes

I have implemented a scatter graph using core plot. I take my data array and sort it from highest to lowest.

The result is the following graph:

enter image description here

The graph looks great (core plot is great). However as you can see there are rises within the graph.

To investigate this further I wrote some code that produces an array that has values that are the same and go from highest to lowest.

[100, 90, 80, 80, 70, 60, 50, 50, 40];

When I used this array to test to see what happens, I get a very similar looking graph to above. It seems that when 2 numbers are either the same or very close the graph has a small spike and then starts dropping again even though the numbers are identical or one is slightly lower than the other.

I was just wondering if someone could help clarify whether this is correct behaviour within core plot?

1

1 Answers

2
votes

Try different style on your scatter plot

  • CPTScatterPlotInterpolationLinear: This is the default.
  • CPTScatterPlotInterpolationStepped
  • CPTScatterPlotInterpolationHistogram
  • CPTScatterPlotInterpolationCurved

example:

CPTScatterPlot *yourPlot = [[CPTScatterPlot alloc] init];
yourPlot.dataSource = self;
yourPlot.interpolation=CPTScatterPlotInterpolationCurved;