1

I'm trying to scale the xaxis of an LinePlot. Every value of x has to be divided by 50, because the data is from a measurment of 50hz.

The xRange is about [0,ca.7000], and shall be [0,1/50,2/50,...,7000/50] as scaled x-axis. Sadly, I cannot post an image, need more reputations...

The C# code is:

private void ilPanel1_Load(object sender, EventArgs e)
    {
        Windpark windpark = new Windpark(quelldatei,hz,anzFreq);            
        float[] a = windpark.readData();
        float[] b = windpark.mittelwertAbzug(a);
        ILArray<float> B = ILMath.array(b);
        ILArray<float> Fit = ILMath.convert<double, float>(windpark.findeFit(B)); 

        var scene = new ILScene {
        new ILPlotCube {                 
            new ILLinePlot(Fit.T, lineColor: Color.Blue,lineWidth:2),
            new ILLinePlot(B.T, lineColor: Color.Yellow)
                        }
            };
        ilPanel1.Scene = scene;            
    }

I tried to use the CrateTicksAuto() Method, but don't know how to use it

public static List<float> CreateTicksAuto(
float min,
float max,
int numberTicks

)

I'd be very thankful for any help!

Best regards

Christian


Solved the problem... I made the ticks as described in here. It makes ten ticks in steps of (array.length/10). My solution looks like this:

private void ilPanel1_Load(object sender, EventArgs e)
    {
        Windpark windpark = new Windpark(quelldatei,hz,anzFreq);            
        float[] a = windpark.readData();
        float[] b = windpark.mittelwertAbzug(a);
        ILArray<float> B = ILMath.array(b);
        ILArray<float> Fit = ILMath.convert<double, float>(windpark.findeFit(B));     
                var scene = new ILScene() ;
                var plotCube =scene.Add(new ILPlotCube {                    
                    new ILLinePlot(B.T, lineColor: Color.Yellow),
                    new ILLinePlot(Fit.T, lineColor: Color.Black,lineWidth:3)
                });
                for (int i = 0; i < Fit.Length; i =i+(int)ILMath.round((double)Fit.Length/  10.0))
                {
                    var tick = plotCube.Axes.XAxis.Ticks.Add(i, (i/hz).ToString());
                }
                    ilPanel1.Scene = scene;


    }
}
  • Do you need the plot to keep being interactive? Means, do you want to zoom in/out? And want the axis ticks to be recomputed in this case? – user492238 May 16 '14 at 15:29
  • Do you want to have a FIXED amount of axis ticks which are tied to specific positions and do not change (at most 'move' when panning the plot)? And how many? Or do you want to restrict the ticks to specific positions / fractions (let's say, at every even divisor of 50)? – user492238 May 16 '14 at 15:32
  • Can you upload an image to somewhere else and post a link? – user492238 May 16 '14 at 15:33
  • oh no, at first the plot has not to be interactive. There can be a fixed amount of ticks, zooming is yet disabeled. E.g., every 50th entry shallb be one tick, this is every second. – Christian H. May 17 '14 at 21:02
  • thank you for your reply! The plot should not to be interactive. There can be a fixed amount of ticks, zooming is yet disabeled. E.g., every 50th entry shall be one tick, this is every second. in matlab I use the command 'plot(xdata,ydata)'. something like that _I wan't to do. here is a link to a grafic, there are measured data and a fittet curve [link](https://dl.dropboxusercontent.com/u/55717433/erste.png) – Christian H. May 17 '14 at 21:27
  • Glad you solved it. I'd also suggest to use manual tick mode on this. – user492238 May 19 '14 at 10:56

0 Answers0