1
$\begingroup$

I have a data file from which I import data to lists,

list1 = Import["path", "Table"]

it returns a list in the following form,

list1 = {{9,2.5},{2,3.5},{3,4.5},....}

Now I have another list2 which is of same length as list1. When I try

list2-list1

I get

{{0,xx},{0,yy},{0,zz},...}

But, I would like to make a difference plot (list2-list1) vs whole numbers (9, 2, 3).

How do I do this?

$\endgroup$
2
  • $\begingroup$ It is unclear to me what you are asking. Please provide a working example with complete sample data and the desired output for that data. $\endgroup$
    – Bob Hanlon
    Commented Oct 23, 2016 at 14:40
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Commented Oct 23, 2016 at 14:42

1 Answer 1

1
$\begingroup$

Simulate list1 and list2:

list1 = Transpose @ {RandomInteger[{0, 9}, 10], RandomReal[1, 10]};
list2 = Transpose @ {First @ Transpose @ list1, RandomReal[1, 10]};

Create a list for plot:

list3 = Transpose @ {list1[[All, 1]], (list2 - list1)[[All, 2]]}

ListPlot[list3, Frame -> True, 
 PlotStyle -> {Black, PointSize[Medium]}, 
 FrameLabel -> {"integers", "difference"}]

enter image description here

$\endgroup$

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.