Vikram Parimi Vikram Parimi - 2 days ago 5
iOS Question

Unable to remove negative axis in Scatter Plot using Core-plot2.0

I have set the plotspace with X and Y Ranges but still I get to see the negative axes. Thoughts anyone?

// Setup scatter plot space
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.allowsUserInteraction = YES;
plotSpace.delegate = self;

plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:[NSNumber numberWithFloat:0.0] length:[NSNumber numberWithInt:2]];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:[NSNumber numberWithFloat:0.0] length:[NSNumber numberWithInt:2]];


Please check the image to see how it looks
enter image description here

[![enter image description here][2]][2]

Answer

I was able to achieve the solution just by setting the visible ranges for both the axis.

x.visibleRange   = [CPTPlotRange plotRangeWithLocation:xMin length:[NSNumber numberWithDouble:([xMax doubleValue] - [xMin doubleValue])]];
y.visibleRange   = [CPTPlotRange plotRangeWithLocation:yMin length:[NSNumber numberWithDouble:([yMax doubleValue] - [yMin doubleValue])]];
Comments