Message Boards Message Boards

0
|
2606 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to skip some data points from ListPlot?

Posted 1 year ago
POSTED BY: KRISHAN SHARMA
4 Replies

Krishan,

one way is simply to use equally spaced points along an interpolation of your original data:

unum = Module[{data, data1, data2, if1, if2, data1i, data2i}, 
   data = Import["C:\\Users\\KRISHAN\\Dropbox\\Journal Drafts\\Draft 4\\Numerical study\\velocity uniform permeability.xlsx"];
   data1 = data[[1, 2 ;;, {1, 2}]];
   data2 = data[[1, 2 ;;, {1, 3}]];
   {if1, if2} = Interpolation /@ {data1, data2}; 
   {data1i, data2i} = Transpose@Table[{{x, if1[x]}, {x, if2[x]}}, {x, 0, 1, .025}]; 
   ListPlot[{data1i, data2i}, PlotStyle -> {{Black, Thick}, {Black, Thick}}]];
POSTED BY: Henrik Schachner
Posted 1 year ago

Thanks Henrik Schachner :) It worked.

data1 = data[[1, 2 ;;, {1, 2}]];

what does exactly this line doing when you are taking part ([[]]) of data (excel file)

POSTED BY: Updating Name

what does exactly this line doing ...

it skips the first data entry which reads: {"r", "u kn=0.025", "u kn=0.1"} and is probably a header (strange that there was no error message). A cleaner solution would have been to import the Excel data like so:

data = Import[ ... , "HeaderLines" -> 1]
POSTED BY: Henrik Schachner

Thanks.

POSTED BY: KRISHAN SHARMA
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract