1

I am trying to use Scatter Graph in one of my project using the CorePlot library. I was able to achieve a good result from it as well but something went wrong, and I am sure that I have nothing to do with because I have not changed the code after that. This is how the plot is looking now: enter image description here

and the expandRangeByFactor values that I am setting are:

CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
[xRange expandRangeByFactor:CPTDecimalFromCGFloat(350.3f)];
plotSpace.xRange = xRange;
CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy];
[yRange expandRangeByFactor:CPTDecimalFromCGFloat(8.3f)];
plotSpace.yRange = yRange;

I have no idea what is happening wrong here because by looking at the values, it should not be like this. Need urgent help on this.

5
  • What were the ranges before? What were you expecting? Nov 15, 2012 at 0:04
  • I had set range for x as 0.3 and for that of y, 4.7. Nov 15, 2012 at 7:24
  • What were the final ranges? What were you expecting? As far as I know, the -expandRangeByFactor: method works as designed. Nov 16, 2012 at 0:15
  • actually, it works fine starts messing up with bigger number of plots. Nov 16, 2012 at 5:14
  • There is one problem that I have detected and I am not sure how to tackle it. The expandRangeByFactor shows different type of graph for the different number of plots. If the number of plots are bigger, the graph is congested into smaller units but if the number is small, it gets very difficult to view because the difference is very huge in it. Nov 16, 2012 at 6:32

1 Answer 1

1

The -expandRangeByFactor: method multiplies the length of the range by the given factor. It adjusts the range location to keep the center of the range in the same place. You are using rather large factors. For example, if your starting x-range has a length of one day, the expanded range will be almost one year long.

3
  • I know what you are saying but as you can see I am putting my interval along x-axis to be an hour and as per my initial values set to be 0.3. How should I handle it? Nov 19, 2012 at 6:53
  • How do I decrease the distance between the minorTicks? Nov 20, 2012 at 9:11
  • Either increase the minorTicksPerInterval to make more minor ticks or increase the length of the plot range to compress more data values into the plot area. Nov 21, 2012 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.