1D Line Plot with DataObject

Issue #24 new
Former user created an issue

I have a .txt-file with two columns and would like to plot the second column over the first column. Example: Wavelenght [nm], Intensity[a.u.] 430; 0.2 435; 0.3 440; 0.4 445; 0.8 450; 0.95

Using DataObjectIO with the filter loadTXT, works perfectly creating a DataObject. I get an object: dataObject('float32', [5 x 2], continuous: 1, owndata: 1)

Creating now a 1D-plot I use the 1D-Line-Plot. The problems occurs here were the columnInterpretation chooses in Auto-Mode to plot two lines over the number of elements. :( And if I choose another mode, I don't get the plot I like to get. :(

It would be nice to have a feature, so you can choose a certain column to be the x-axis while the other columns stay values for the y-axis. :)

Thanks in advance.

Comments (3)

  1. Robin Hahn

    Hey,
    I tried the following code which worked fine for me:

    a=dataObject([5,2])
    
    for i in range(0,5):
    
    a[i,0]=i
    
    a[:,1]=1
    
    plot1(a[:,1],a[:,0])
    

    It shows a horizontal line like it should.

    Did you use the plot1 command? If you want to plot y over x, you must use the plot1 command or set the "xData" property. For an example of using the plot1 command, see {itom installation path}\demo\plots\plotXY.py.

  2. Robin Hahn

    It seems that there is a problem switching between the different modes (Auto, first row, first column...) in xy mode. However, I think this is not your problem as Auto should work fine for your task.

  3. Log in to comment