Skip to content

Instantly share code, notes, and snippets.

@santiago-salas-v
Last active October 8, 2019 10:27
Show Gist options
  • Save santiago-salas-v/d5a61a2aa53de96070f1c1c137ef1556 to your computer and use it in GitHub Desktop.
Save santiago-salas-v/d5a61a2aa53de96070f1c1c137ef1556 to your computer and use it in GitHub Desktop.
fast plot from data pairs python, matlab
fid = fopen('webplotdigitizer_output.csv');
output = textscan(fid,'%s %s', 'Delimiter', ';');
fclose(fid);
x = arrayfun(@(x) str2double(replace(x, ',', '.')), output{1});
y = arrayfun(@(x) str2double(replace(x, ',', '.')), output{2});
plot(x, y);
from numpy import array, diff, insert
from matplotlib import pyplot as plt
%matplotlib inline
xy = array([line.split(';') for line in """5,163473945750054; 59,3210849369608
6,229906792224906; 66,80865253338823
7,296339638699758; 75,11769786971149
8,36277248517461; 82,14739262750845
9,46798470788491; 89,3346495091871
10,412539514762635; 93,1247977419007
11,562071024599163; 98,75201645195978
12,628503871074013; 102,26686383085837
13,694936717548867; 106,31095834382074
14,761369564023717; 110,38737329245134
15,82780241049857; 113,70021794842467
16,89423525697342; 118,02307621902389
17,992984250311146; 120,88253698576511
19,027100949923124; 124,72956662014053
20,11590651345689; 128,72611279986063
21,243065306234502; 132,80390403077922
22,226399489347678; 136,97093162940757
23,29283233582253; 140,60698064206122
24,65011050406325; 145,89945198270152
25,7165433505381; 149,89910589662043
26,782976197012953; 154,50476797931492
27,849409043487807; 158,90842733908437
28,91584188996266; 162,4636752625679
29,982274736437507; 167,79654714779315
31,068097271030087; 172,70521331487544
32,039736086707165; 177,815882204883
33,181573275862064; 183,63356062512867
34,24800612233692; 189,12803468869424
35,31443896881177; 194,7841109305998
36,380871815286625; 200,11698281582505
37,447304661761464; 206,58106994943148
38,51373750823632; 212,277546735922
39,58017035471117; 219,10523877079385
40,646603201186025; 223,75130139807334
41,71303604766088; 229,44777818456407
42,77946889413573; 235,22505606022474
43,845901740610586; 240,1943230441846
44,912334587085425; 246,1332030981855
45,97876743356028; 251,66807770633602
47,04520028003513; 257,28375340365653
48,111633126509986; 262,41462256595656
49,17806597298484; 269,12111296707326
50,18217482193843; 273,6488597137823
51,31093166593455; 279,4636523808435
52,36766966835053; 284,78440410269326
53,44379735888424; 291,3818130334302
54,51023020535909; 297,03788927533583
55,57666305183395; 302,1687584376359
56,6430958983088; 308,91564938333755
57,709528744783654; 314,5717256252432
58,77596159125851; 320,0661996888086
59,86316910357377; 324,8825217539823
60,9088272842082; 332,1459625197355
61,936480754447615; 337,89091995972825
63,012608444981325; 343,5793166373018
64,10812582363276; 349,70673256603294
65,17455867010761; 356,1842865478343
66,24099151658247; 362,04236551266507
67,27106869783658; 367,9105446136421
68,37385720953216; 374,8897386907078
69,44029005600702; 382,36383943894015
70,50672290248187; 388,30271949294104
71,57315574895672; 395,9788229640986
72,63958859543158; 402,48331064229
73,70602144190643; 410,3614168363728
74,77245428838128; 417,9971197629454
75,83888713485612; 426,15802976912346
76,90531998133098; 434,6421441319818
77,97175282780583; 442,64145195981973
78,94123723369206; 450,7799172190061
79,86917230789744; 457,50596661392973
80,97715448605314; 467,164582522939
82,04358733252799; 477,26471866919894
83,11002017900284; 486,67804555751326
84,12797880518339; 496,54385854518
85,14593743136392; 505,58550042331194
86,21237027783877; 515,726037114157
87,27880312431363; 524,937361279546
88,34523597078848; 534,7950941582958
89,44398496412622; 543,8212491610035
90,47810166373819; 551,0361130814819
91,54453451021304; 558,6718160080544
92,61096735668788; 563,6006824474293
93,67740020316273; 568,8123526988994
94,69535882934328; 573,5594166876416
""".replace(',','.').split('\n') if len(line)>0],
dtype=float)
x, y = xy[:,0], xy[:,1]
dx = insert(diff(x), 0, 0)
plt.plot(dx, y)
5 163473945750054; 59 3210849369608
6 229906792224906; 66 80865253338823
7 296339638699758; 75 11769786971149
8 36277248517461; 82 14739262750845
9 46798470788491; 89 3346495091871
10 412539514762635; 93 1247977419007
11 562071024599163; 98 75201645195978
12 628503871074013; 102 26686383085837
13 694936717548867; 106 31095834382074
14 761369564023717; 110 38737329245134
15 82780241049857; 113 70021794842467
16 89423525697342; 118 02307621902389
17 992984250311146; 120 88253698576511
19 027100949923124; 124 72956662014053
20 11590651345689; 128 72611279986063
21 243065306234502; 132 80390403077922
22 226399489347678; 136 97093162940757
23 29283233582253; 140 60698064206122
24 65011050406325; 145 89945198270152
25 7165433505381; 149 89910589662043
26 782976197012953; 154 50476797931492
27 849409043487807; 158 90842733908437
28 91584188996266; 162 4636752625679
29 982274736437507; 167 79654714779315
31 068097271030087; 172 70521331487544
32 039736086707165; 177 815882204883
33 181573275862064; 183 63356062512867
34 24800612233692; 189 12803468869424
35 31443896881177; 194 7841109305998
36 380871815286625; 200 11698281582505
37 447304661761464; 206 58106994943148
38 51373750823632; 212 277546735922
39 58017035471117; 219 10523877079385
40 646603201186025; 223 75130139807334
41 71303604766088; 229 44777818456407
42 77946889413573; 235 22505606022474
43 845901740610586; 240 1943230441846
44 912334587085425; 246 1332030981855
45 97876743356028; 251 66807770633602
47 04520028003513; 257 28375340365653
48 111633126509986; 262 41462256595656
49 17806597298484; 269 12111296707326
50 18217482193843; 273 6488597137823
51 31093166593455; 279 4636523808435
52 36766966835053; 284 78440410269326
53 44379735888424; 291 3818130334302
54 51023020535909; 297 03788927533583
55 57666305183395; 302 1687584376359
56 6430958983088; 308 91564938333755
57 709528744783654; 314 5717256252432
58 77596159125851; 320 0661996888086
59 86316910357377; 324 8825217539823
60 9088272842082; 332 1459625197355
61 936480754447615; 337 89091995972825
63 012608444981325; 343 5793166373018
64 10812582363276; 349 70673256603294
65 17455867010761; 356 1842865478343
66 24099151658247; 362 04236551266507
67 27106869783658; 367 9105446136421
68 37385720953216; 374 8897386907078
69 44029005600702; 382 36383943894015
70 50672290248187; 388 30271949294104
71 57315574895672; 395 9788229640986
72 63958859543158; 402 48331064229
73 70602144190643; 410 3614168363728
74 77245428838128; 417 9971197629454
75 83888713485612; 426 15802976912346
76 90531998133098; 434 6421441319818
77 97175282780583; 442 64145195981973
78 94123723369206; 450 7799172190061
79 86917230789744; 457 50596661392973
80 97715448605314; 467 164582522939
82 04358733252799; 477 26471866919894
83 11002017900284; 486 67804555751326
84 12797880518339; 496 54385854518
85 14593743136392; 505 58550042331194
86 21237027783877; 515 726037114157
87 27880312431363; 524 937361279546
88 34523597078848; 534 7950941582958
89 44398496412622; 543 8212491610035
90 47810166373819; 551 0361130814819
91 54453451021304; 558 6718160080544
92 61096735668788; 563 6006824474293
93 67740020316273; 568 8123526988994
94 69535882934328; 573 5594166876416
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment