1

I'd like to make semi-log graph to show my amplitude spectrum data by using Core Plot in my iOS App. But I couldn't find how to make it.

Does anyone know?

1 Answer 1

3

Set the scale type on the plot space:

CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xScaleType = CPTScaleTypeLinear; // this is the default
plotSpace.yScaleType = CPTScaleTypeLog;

You can see samples in the example apps provided with Core Plot. The axis demo in the Mac CPTTestApp uses a log axis and the Plot Gallery app has examples as well.

4
  • Thanks for your answer. I drew y=exp(x) and set plotSpace.yScaleType = CPTScaleTypeLog for test, and got really weird result. result image Could you tell me what's going on?
    – akira108
    Aug 8, 2011 at 6:06
  • There's not enough in that image to tell what's happening. Can you post your plot space setup and datasource code? Aug 8, 2011 at 11:28
  • Here's my code. I wrote it in my ViewController. Thanks.
    – akira108
    Aug 8, 2011 at 14:51
  • Plot ranges with a log scale can't include zero or negative numbers. Try using a y location of 0.1 instead of -1. Aug 9, 2011 at 1:44

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.