Plotting a bar plot with seaborn - python
The data frame I am using: https://www.kaggle.com/mustiztemiz/diabetes
I have the following column:
Outcome - which has values 0 or 1.
I want to plot a barplot which has Outcome on the x-axis and the it's count on y-axis.
My code is as follows:
sns.barplot(x='Outcome', y=diabetes['Outcome'].value_counts(), data=diabetes)
It is returning the following plot
The output I got is wrong as 1 should be 268 in count and 0 should be 500 in count.
I don't know where I did the mistake.
diabetes.csv
Pregnancies,Glucose,BloodPressure,SkinThickness,Insulin,BMI,DiabetesPedigreeFunction,Age,Outcome
6,148,72,35,0,33.6,0.627,50,1
1,85,66,29,0,26.6,0.351,31,0
8,183,64,0,0,23.3,0.672,32,1
1,89,66,23,94,28.1,0.167,21,0
0,137,40,35,168,43.1,2.288,33,1
5,116,74,0,0,25.6,0.201,30,0
3,78,50,32,88,31.0,0.248,26,1
10,115,0,0,0,35.3,0.134,29,0
2,197,70,45,543,30.5,0.158,53,1
8,125,96,0,0,0.0,0.232,54,1
4,110,92,0,0,37.6,0.191,30,0
10,168,74,0,0,38.0,0.537,34,1
10,139,80,0,0,27.1,1.441,57,0
1,189,60,23,846,30.1,0.398,59,1
5,166,72,19,175,25.8,0.587,51,1
7,100,0,0,0,30.0,0.484,32,1
0,118,84,47,230,45.8,0.551,31,1
7,107,74,0,0,29.6,0.254,31,1
1,103,30,38,83,43.3,0.183,33,0
1,115,70,30,96,34.6,0.529,32,1
3,126,88,41,235,39.3,0.704,27,0
8,99,84,0,0,35.4,0.388,50,0
7,196,90,0,0,39.8,0.451,41,1
9,119,80,35,0,29.0,0.263,29,1
11,143,94,33,146,36.6,0.254,51,1
10,125,70,26,115,31.1,0.205,41,1
7,147,76,0,0,39.4,0.257,43,1
1,97,66,15,140,23.2,0.487,22,0
13,145,82,19,110,22.2,0.245,57,0
5,117,92,0,0,34.1,0.337,38,0
5,109,75,26,0,36.0,0.546,60,0
3,158,76,36,245,31.6,0.851,28,1
3,88,58,11,54,24.8,0.267,22,0
6,92,92,0,0,19.9,0.188,28,0
10,122,78,31,0,27.6,0.512,45,0
4,103,60,33,192,24.0,0.966,33,0
11,138,76,0,0,33.2,0.42,35,0
9,102,76,37,0,32.9,0.665,46,1
2,90,68,42,0,38.2,0.503,27,1
4,111,72,47,207,37.1,1.39,56,1
3,180,64,25,70,34.0,0.271,26,0
7,133,84,0,0,40.2,0.696,37,0
7,106,92,18,0,22.7,0.235,48,0
9,171,110,24,240,45.4,0.721,54,1
7,159,64,0,0,27.4,0.294,40,0
0,180,66,39,0,42.0,1.893,25,1
1,146,56,0,0,29.7,0.564,29,0
2,71,70,27,0,28.0,0.586,22,0
7,103,66,32,0,39.1,0.344,31,1
7,105,0,0,0,0.0,0.305,24,0
1,103,80,11,82,19.4,0.491,22,0
1,101,50,15,36,24.2,0.526,26,0
5,88,66,21,23,24.4,0.342,30,0
8,176,90,34,300,33.7,0.467,58,1
7,150,66,42,342,34.7,0.718,42,0
1,73,50,10,0,23.0,0.248,21,0
7,187,68,39,304,37.7,0.254,41,1
0,100,88,60,110,46.8,0.962,31,0
0,146,82,0,0,40.5,1.781,44,0
0,105,64,41,142,41.5,0.173,22,0
2,84,0,0,0,0.0,0.304,21,0
8,133,72,0,0,32.9,0.27,39,1
5,44,62,0,0,25.0,0.587,36,0
2,141,58,34,128,25.4,0.699,24,0
7,114,66,0,0,32.8,0.258,42,1
5,99,74,27,0,29.0,0.203,32,0
0,109,88,30,0,32.5,0.855,38,1
2,109,92,0,0,42.7,0.845,54,0
1,95,66,13,38,19.6,0.334,25,0
4,146,85,27,100,28.9,0.189,27,0
2,100,66,20,90,32.9,0.867,28,1
5,139,64,35,140,28.6,0.411,26,0
13,126,90,0,0,43.4,0.583,42,1
4,129,86,20,270,35.1,0.231,23,0
1,79,75,30,0,32.0,0.396,22,0
1,0,48,20,0,24.7,0.14,22,0
7,62,78,0,0,32.6,0.391,41,0
5,95,72,33,0,37.7,0.37,27,0
0,131,0,0,0,43.2,0.27,26,1
2,112,66,22,0,25.0,0.307,24,0
3,113,44,13,0,22.4,0.14,22,0
2,74,0,0,0,0.0,0.102,22,0
7,83,78,26,71,29.3,0.767,36,0
0,101,65,28,0,24.6,0.237,22,0
5,137,108,0,0,48.8,0.227,37,1
2,110,74,29,125,32.4,0.698,27,0
13,106,72,54,0,36.6,0.178,45,0
2,100,68,25,71,38.5,0.324,26,0
15,136,70,32,110,37.1,0.153,43,1
1,107,68,19,0,26.5,0.165,24,0
1,80,55,0,0,19.1,0.258,21,0
4,123,80,15,176,32.0,0.443,34,0
7,81,78,40,48,46.7,0.261,42,0
4,134,72,0,0,23.8,0.277,60,1
2,142,82,18,64,24.7,0.761,21,0
6,144,72,27,228,33.9,0.255,40,0
2,92,62,28,0,31.6,0.13,24,0
1,71,48,18,76,20.4,0.323,22,0
6,93,50,30,64,28.7,0.356,23,0
1,122,90,51,220,49.7,0.325,31,1
1,163,72,0,0,39.0,1.222,33,1
1,151,60,0,0,26.1,0.179,22,0
0,125,96,0,0,22.5,0.262,21,0
1,81,72,18,40,26.6,0.283,24,0
2,85,65,0,0,39.6,0.93,27,0
1,126,56,29,152,28.7,0.801,21,0
1,96,122,0,0,22.4,0.207,27,0
4,144,58,28,140,29.5,0.287,37,0
3,83,58,31,18,34.3,0.336,25,0
0,95,85,25,36,37.4,0.247,24,1
3,171,72,33,135,33.3,0.199,24,1
8,155,62,26,495,34.0,0.543,46,1
1,89,76,34,37,31.2,0.192,23,0
4,76,62,0,0,34.0,0.391,25,0
7,160,54,32,175,30.5,0.588,39,1
4,146,92,0,0,31.2,0.539,61,1
5,124,74,0,0,34.0,0.22,38,1
5,78,48,0,0,33.7,0.654,25,0
4,97,60,23,0,28.2,0.443,22,0
4,99,76,15,51,23.2,0.223,21,0
0,162,76,56,100,53.2,0.759,25,1
6,111,64,39,0,34.2,0.26,24,0
2,107,74,30,100,33.6,0.404,23,0
5,132,80,0,0,26.8,0.186,69,0
0,113,76,0,0,33.3,0.278,23,1
1,88,30,42,99,55.0,0.496,26,1
3,120,70,30,135,42.9,0.452,30,0
1,118,58,36,94,33.3,0.261,23,0
1,117,88,24,145,34.5,0.403,40,1
0,105,84,0,0,27.9,0.741,62,1
4,173,70,14,168,29.7,0.361,33,1
9,122,56,0,0,33.3,1.114,33,1
3,170,64,37,225,34.5,0.356,30,1
8,84,74,31,0,38.3,0.457,39,0
2,96,68,13,49,21.1,0.647,26,0
2,125,60,20,140,33.8,0.088,31,0
0,100,70,26,50,30.8,0.597,21,0
0,93,60,25,92,28.7,0.532,22,0
0,129,80,0,0,31.2,0.703,29,0
5,105,72,29,325,36.9,0.159,28,0
3,128,78,0,0,21.1,0.268,55,0
5,106,82,30,0,39.5,0.286,38,0
2,108,52,26,63,32.5,0.318,22,0
10,108,66,0,0,32.4,0.272,42,1
4,154,62,31,284,32.8,0.237,23,0
0,102,75,23,0,0.0,0.572,21,0
9,57,80,37,0,32.8,0.096,41,0
2,106,64,35,119,30.5,1.4,34,0
5,147,78,0,0,33.7,0.218,65,0
2,90,70,17,0,27.3,0.085,22,0
1,136,74,50,204,37.4,0.399,24,0
4,114,65,0,0,21.9,0.432,37,0
9,156,86,28,155,34.3,1.189,42,1
1,153,82,42,485,40.6,0.687,23,0
8,188,78,0,0,47.9,0.137,43,1
7,152,88,44,0,50.0,0.337,36,1
2,99,52,15,94,24.6,0.637,21,0
1,109,56,21,135,25.2,0.833,23,0
2,88,74,19,53,29.0,0.229,22,0
17,163,72,41,114,40.9,0.817,47,1
4,151,90,38,0,29.7,0.294,36,0
7,102,74,40,105,37.2,0.204,45,0
0,114,80,34,285,44.2,0.167,27,0
2,100,64,23,0,29.7,0.368,21,0
0,131,88,0,0,31.6,0.743,32,1
6,104,74,18,156,29.9,0.722,41,1
3,148,66,25,0,32.5,0.256,22,0
4,120,68,0,0,29.6,0.709,34,0
4,110,66,0,0,31.9,0.471,29,0
3,111,90,12,78,28.4,0.495,29,0
6,102,82,0,0,30.8,0.18,36,1
6,134,70,23,130,35.4,0.542,29,1
2,87,0,23,0,28.9,0.773,25,0
1,79,60,42,48,43.5,0.678,23,0
2,75,64,24,55,29.7,0.37,33,0
8,179,72,42,130,32.7,0.719,36,1
6,85,78,0,0,31.2,0.382,42,0
0,129,110,46,130,67.1,0.319,26,1
5,143,78,0,0,45.0,0.19,47,0
5,130,82,0,0,39.1,0.956,37,1
6,87,80,0,0,23.2,0.084,32,0
0,119,64,18,92,34.9,0.725,23,0
1,0,74,20,23,27.7,0.299,21,0
5,73,60,0,0,26.8,0.268,27,0
4,141,74,0,0,27.6,0.244,40,0
7,194,68,28,0,35.9,0.745,41,1
8,181,68,36,495,30.1,0.615,60,1
1,128,98,41,58,32.0,1.321,33,1
8,109,76,39,114,27.9,0.64,31,1
5,139,80,35,160,31.6,0.361,25,1
3,111,62,0,0,22.6,0.142,21,0
9,123,70,44,94,33.1,0.374,40,0
7,159,66,0,0,30.4,0.383,36,1
11,135,0,0,0,52.3,0.578,40,1
8,85,55,20,0,24.4,0.136,42,0
5,158,84,41,210,39.4,0.395,29,1
1,105,58,0,0,24.3,0.187,21,0
3,107,62,13,48,22.9,0.678,23,1
4,109,64,44,99,34.8,0.905,26,1
4,148,60,27,318,30.9,0.15,29,1
0,113,80,16,0,31.0,0.874,21,0
1,138,82,0,0,40.1,0.236,28,0
0,108,68,20,0,27.3,0.787,32,0
2,99,70,16,44,20.4,0.235,27,0
6,103,72,32,190,37.7,0.324,55,0
5,111,72,28,0,23.9,0.407,27,0
8,196,76,29,280,37.5,0.605,57,1
5,162,104,0,0,37.7,0.151,52,1
1,96,64,27,87,33.2,0.289,21,0
7,184,84,33,0,35.5,0.355,41,1
2,81,60,22,0,27.7,0.29,25,0
0,147,85,54,0,42.8,0.375,24,0
7,179,95,31,0,34.2,0.164,60,0
0,140,65,26,130,42.6,0.431,24,1
9,112,82,32,175,34.2,0.26,36,1
12,151,70,40,271,41.8,0.742,38,1
5,109,62,41,129,35.8,0.514,25,1
6,125,68,30,120,30.0,0.464,32,0
5,85,74,22,0,29.0,1.224,32,1
5,112,66,0,0,37.8,0.261,41,1
0,177,60,29,478,34.6,1.072,21,1
2,158,90,0,0,31.6,0.805,66,1
7,119,0,0,0,25.2,0.209,37,0
7,142,60,33,190,28.8,0.687,61,0
1,100,66,15,56,23.6,0.666,26,0
1,87,78,27,32,34.6,0.101,22,0
0,101,76,0,0,35.7,0.198,26,0
3,162,52,38,0,37.2,0.652,24,1
4,197,70,39,744,36.7,2.329,31,0
0,117,80,31,53,45.2,0.089,24,0
4,142,86,0,0,44.0,0.645,22,1
6,134,80,37,370,46.2,0.238,46,1
1,79,80,25,37,25.4,0.583,22,0
4,122,68,0,0,35.0,0.394,29,0
3,74,68,28,45,29.7,0.293,23,0
4,171,72,0,0,43.6,0.479,26,1
7,181,84,21,192,35.9,0.586,51,1
0,179,90,27,0,44.1,0.686,23,1
9,164,84,21,0,30.8,0.831,32,1
0,104,76,0,0,18.4,0.582,27,0
1,91,64,24,0,29.2,0.192,21,0
4,91,70,32,88,33.1,0.446,22,0
3,139,54,0,0,25.6,0.402,22,1
6,119,50,22,176,27.1,1.318,33,1
2,146,76,35,194,38.2,0.329,29,0
9,184,85,15,0,30.0,1.213,49,1
10,122,68,0,0,31.2,0.258,41,0
0,165,90,33,680,52.3,0.427,23,0
9,124,70,33,402,35.4,0.282,34,0
1,111,86,19,0,30.1,0.143,23,0
9,106,52,0,0,31.2,0.38,42,0
2,129,84,0,0,28.0,0.284,27,0
2,90,80,14,55,24.4,0.249,24,0
0,86,68,32,0,35.8,0.238,25,0
12,92,62,7,258,27.6,0.926,44,1
1,113,64,35,0,33.6,0.543,21,1
3,111,56,39,0,30.1,0.557,30,0
2,114,68,22,0,28.7,0.092,25,0
1,193,50,16,375,25.9,0.655,24,0
11,155,76,28,150,33.3,1.353,51,1
3,191,68,15,130,30.9,0.299,34,0
3,141,0,0,0,30.0,0.761,27,1
4,95,70,32,0,32.1,0.612,24,0
3,142,80,15,0,32.4,0.2,63,0
4,123,62,0,0,32.0,0.226,35,1
5,96,74,18,67,33.6,0.997,43,0
0,138,0,0,0,36.3,0.933,25,1
2,128,64,42,0,40.0,1.101,24,0
0,102,52,0,0,25.1,0.078,21,0
2,146,0,0,0,27.5,0.24,28,1
10,101,86,37,0,45.6,1.136,38,1
2,108,62,32,56,25.2,0.128,21,0
3,122,78,0,0,23.0,0.254,40,0
1,71,78,50,45,33.2,0.422,21,0
13,106,70,0,0,34.2,0.251,52,0
2,100,70,52,57,40.5,0.677,25,0
7,106,60,24,0,26.5,0.296,29,1
0,104,64,23,116,27.8,0.454,23,0
5,114,74,0,0,24.9,0.744,57,0
2,108,62,10,278,25.3,0.881,22,0
0,146,70,0,0,37.9,0.334,28,1
10,129,76,28,122,35.9,0.28,39,0
7,133,88,15,155,32.4,0.262,37,0
7,161,86,0,0,30.4,0.165,47,1
2,108,80,0,0,27.0,0.259,52,1
7,136,74,26,135,26.0,0.647,51,0
5,155,84,44,545,38.7,0.619,34,0
1,119,86,39,220,45.6,0.808,29,1
4,96,56,17,49,20.8,0.34,26,0
5,108,72,43,75,36.1,0.263,33,0
0,78,88,29,40,36.9,0.434,21,0
0,107,62,30,74,36.6,0.757,25,1
2,128,78,37,182,43.3,1.224,31,1
1,128,48,45,194,40.5,0.613,24,1
0,161,50,0,0,21.9,0.254,65,0
6,151,62,31,120,35.5,0.692,28,0
2,146,70,38,360,28.0,0.337,29,1
0,126,84,29,215,30.7,0.52,24,0
14,100,78,25,184,36.6,0.412,46,1
8,112,72,0,0,23.6,0.84,58,0
0,167,0,0,0,32.3,0.839,30,1
2,144,58,33,135,31.6,0.422,25,1
5,77,82,41,42,35.8,0.156,35,0
5,115,98,0,0,52.9,0.209,28,1
3,150,76,0,0,21.0,0.207,37,0
2,120,76,37,105,39.7,0.215,29,0
10,161,68,23,132,25.5,0.326,47,1
0,137,68,14,148,24.8,0.143,21,0
0,128,68,19,180,30.5,1.391,25,1
2,124,68,28,205,32.9,0.875,30,1
6,80,66,30,0,26.2,0.313,41,0
0,106,70,37,148,39.4,0.605,22,0
2,155,74,17,96,26.6,0.433,27,1
3,113,50,10,85,29.5,0.626,25,0
7,109,80,31,0,35.9,1.127,43,1
2,112,68,22,94,34.1,0.315,26,0
3,99,80,11,64,19.3,0.284,30,0
3,182,74,0,0,30.5,0.345,29,1
3,115,66,39,140,38.1,0.15,28,0
6,194,78,0,0,23.5,0.129,59,1
4,129,60,12,231,27.5,0.527,31,0
3,112,74,30,0,31.6,0.197,25,1
0,124,70,20,0,27.4,0.254,36,1
13,152,90,33,29,26.8,0.731,43,1
2,112,75,32,0,35.7,0.148,21,0
1,157,72,21,168,25.6,0.123,24,0
1,122,64,32,156,35.1,0.692,30,1
10,179,70,0,0,35.1,0.2,37,0
2,102,86,36,120,45.5,0.127,23,1
6,105,70,32,68,30.8,0.122,37,0
8,118,72,19,0,23.1,1.476,46,0
2,87,58,16,52,32.7,0.166,25,0
1,180,0,0,0,43.3,0.282,41,1
12,106,80,0,0,23.6,0.137,44,0
1,95,60,18,58,23.9,0.26,22,0
0,165,76,43,255,47.9,0.259,26,0
0,117,0,0,0,33.8,0.932,44,0
5,115,76,0,0,31.2,0.343,44,1
9,152,78,34,171,34.2,0.893,33,1
7,178,84,0,0,39.9,0.331,41,1
1,130,70,13,105,25.9,0.472,22,0
1,95,74,21,73,25.9,0.673,36,0
1,0,68,35,0,32.0,0.389,22,0
5,122,86,0,0,34.7,0.29,33,0
8,95,72,0,0,36.8,0.485,57,0
8,126,88,36,108,38.5,0.349,49,0
1,139,46,19,83,28.7,0.654,22,0
3,116,0,0,0,23.5,0.187,23,0
3,99,62,19,74,21.8,0.279,26,0
5,0,80,32,0,41.0,0.346,37,1
4,92,80,0,0,42.2,0.237,29,0
4,137,84,0,0,31.2,0.252,30,0
3,61,82,28,0,34.4,0.243,46,0
1,90,62,12,43,27.2,0.58,24,0
3,90,78,0,0,42.7,0.559,21,0
9,165,88,0,0,30.4,0.302,49,1
1,125,50,40,167,33.3,0.962,28,1
13,129,0,30,0,39.9,0.569,44,1
12,88,74,40,54,35.3,0.378,48,0
1,196,76,36,249,36.5,0.875,29,1
5,189,64,33,325,31.2,0.583,29,1
5,158,70,0,0,29.8,0.207,63,0
5,103,108,37,0,39.2,0.305,65,0
4,146,78,0,0,38.5,0.52,67,1
4,147,74,25,293,34.9,0.385,30,0
5,99,54,28,83,34.0,0.499,30,0
6,124,72,0,0,27.6,0.368,29,1
0,101,64,17,0,21.0,0.252,21,0
3,81,86,16,66,27.5,0.306,22,0
1,133,102,28,140,32.8,0.234,45,1
3,173,82,48,465,38.4,2.137,25,1
0,118,64,23,89,0.0,1.731,21,0
0,84,64,22,66,35.8,0.545,21,0
2,105,58,40,94,34.9,0.225,25,0
2,122,52,43,158,36.2,0.816,28,0
12,140,82,43,325,39.2,0.528,58,1
0,98,82,15,84,25.2,0.299,22,0
1,87,60,37,75,37.2,0.509,22,0
4,156,75,0,0,48.3,0.238,32,1
0,93,100,39,72,43.4,1.021,35,0
1,107,72,30,82,30.8,0.821,24,0
0,105,68,22,0,20.0,0.236,22,0
1,109,60,8,182,25.4,0.947,21,0
1,90,62,18,59,25.1,1.268,25,0
1,125,70,24,110,24.3,0.221,25,0
1,119,54,13,50,22.3,0.205,24,0
5,116,74,29,0,32.3,0.66,35,1
8,105,100,36,0,43.3,0.239,45,1
5,144,82,26,285,32.0,0.452,58,1
3,100,68,23,81,31.6,0.949,28,0
1,100,66,29,196,32.0,0.444,42,0
5,166,76,0,0,45.7,0.34,27,1
1,131,64,14,415,23.7,0.389,21,0
4,116,72,12,87,22.1,0.463,37,0
4,158,78,0,0,32.9,0.803,31,1
2,127,58,24,275,27.7,1.6,25,0
3,96,56,34,115,24.7,0.944,39,0
0,131,66,40,0,34.3,0.196,22,1
3,82,70,0,0,21.1,0.389,25,0
3,193,70,31,0,34.9,0.241,25,1
4,95,64,0,0,32.0,0.161,31,1
6,137,61,0,0,24.2,0.151,55,0
5,136,84,41,88,35.0,0.286,35,1
9,72,78,25,0,31.6,0.28,38,0
5,168,64,0,0,32.9,0.135,41,1
2,123,48,32,165,42.1,0.52,26,0
4,115,72,0,0,28.9,0.376,46,1
0,101,62,0,0,21.9,0.336,25,0
8,197,74,0,0,25.9,1.191,39,1
1,172,68,49,579,42.4,0.702,28,1
6,102,90,39,0,35.7,0.674,28,0
1,112,72,30,176,34.4,0.528,25,0
1,143,84,23,310,42.4,1.076,22,0
1,143,74,22,61,26.2,0.256,21,0
0,138,60,35,167,34.6,0.534,21,1
3,173,84,33,474,35.7,0.258,22,1
1,97,68,21,0,27.2,1.095,22,0
4,144,82,32,0,38.5,0.554,37,1
1,83,68,0,0,18.2,0.624,27,0
3,129,64,29,115,26.4,0.219,28,1
1,119,88,41,170,45.3,0.507,26,0
2,94,68,18,76,26.0,0.561,21,0
0,102,64,46,78,40.6,0.496,21,0
2,115,64,22,0,30.8,0.421,21,0
8,151,78,32,210,42.9,0.516,36,1
4,184,78,39,277,37.0,0.264,31,1
0,94,0,0,0,0.0,0.256,25,0
1,181,64,30,180,34.1,0.328,38,1
0,135,94,46,145,40.6,0.284,26,0
1,95,82,25,180,35.0,0.233,43,1
2,99,0,0,0,22.2,0.108,23,0
3,89,74,16,85,30.4,0.551,38,0
1,80,74,11,60,30.0,0.527,22,0
2,139,75,0,0,25.6,0.167,29,0
1,90,68,8,0,24.5,1.138,36,0
0,141,0,0,0,42.4,0.205,29,1
12,140,85,33,0,37.4,0.244,41,0
5,147,75,0,0,29.9,0.434,28,0
1,97,70,15,0,18.2,0.147,21,0
6,107,88,0,0,36.8,0.727,31,0
0,189,104,25,0,34.3,0.435,41,1
2,83,66,23,50,32.2,0.497,22,0
4,117,64,27,120,33.2,0.23,24,0
8,108,70,0,0,30.5,0.955,33,1
4,117,62,12,0,29.7,0.38,30,1
0,180,78,63,14,59.4,2.42,25,1
1,100,72,12,70,25.3,0.658,28,0
0,95,80,45,92,36.5,0.33,26,0
0,104,64,37,64,33.6,0.51,22,1
0,120,74,18,63,30.5,0.285,26,0
1,82,64,13,95,21.2,0.415,23,0
2,134,70,0,0,28.9,0.542,23,1
0,91,68,32,210,39.9,0.381,25,0
2,119,0,0,0,19.6,0.832,72,0
2,100,54,28,105,37.8,0.498,24,0
14,175,62,30,0,33.6,0.212,38,1
1,135,54,0,0,26.7,0.687,62,0
5,86,68,28,71,30.2,0.364,24,0
10,148,84,48,237,37.6,1.001,51,1
9,134,74,33,60,25.9,0.46,81,0
9,120,72,22,56,20.8,0.733,48,0
1,71,62,0,0,21.8,0.416,26,0
8,74,70,40,49,35.3,0.705,39,0
5,88,78,30,0,27.6,0.258,37,0
10,115,98,0,0,24.0,1.022,34,0
0,124,56,13,105,21.8,0.452,21,0
0,74,52,10,36,27.8,0.269,22,0
0,97,64,36,100,36.8,0.6,25,0
8,120,0,0,0,30.0,0.183,38,1
6,154,78,41,140,46.1,0.571,27,0
1,144,82,40,0,41.3,0.607,28,0
0,137,70,38,0,33.2,0.17,22,0
0,119,66,27,0,38.8,0.259,22,0
7,136,90,0,0,29.9,0.21,50,0
4,114,64,0,0,28.9,0.126,24,0
0,137,84,27,0,27.3,0.231,59,0
2,105,80,45,191,33.7,0.711,29,1
7,114,76,17,110,23.8,0.466,31,0
8,126,74,38,75,25.9,0.162,39,0
4,132,86,31,0,28.0,0.419,63,0
3,158,70,30,328,35.5,0.344,35,1
0,123,88,37,0,35.2,0.197,29,0
4,85,58,22,49,27.8,0.306,28,0
0,84,82,31,125,38.2,0.233,23,0
0,145,0,0,0,44.2,0.63,31,1
0,135,68,42,250,42.3,0.365,24,1
1,139,62,41,480,40.7,0.536,21,0
0,173,78,32,265,46.5,1.159,58,0
4,99,72,17,0,25.6,0.294,28,0
8,194,80,0,0,26.1,0.551,67,0
2,83,65,28,66,36.8,0.629,24,0
2,89,90,30,0,33.5,0.292,42,0
4,99,68,38,0,32.8,0.145,33,0
4,125,70,18,122,28.9,1.144,45,1
3,80,0,0,0,0.0,0.174,22,0
6,166,74,0,0,26.6,0.304,66,0
5,110,68,0,0,26.0,0.292,30,0
2,81,72,15,76,30.1,0.547,25,0
7,195,70,33,145,25.1,0.163,55,1
6,154,74,32,193,29.3,0.839,39,0
2,117,90,19,71,25.2,0.313,21,0
3,84,72,32,0,37.2,0.267,28,0
6,0,68,41,0,39.0,0.727,41,1
7,94,64,25,79,33.3,0.738,41,0
3,96,78,39,0,37.3,0.238,40,0
10,75,82,0,0,33.3,0.263,38,0
0,180,90,26,90,36.5,0.314,35,1
1,130,60,23,170,28.6,0.692,21,0
2,84,50,23,76,30.4,0.968,21,0
8,120,78,0,0,25.0,0.409,64,0
12,84,72,31,0,29.7,0.297,46,1
0,139,62,17,210,22.1,0.207,21,0
9,91,68,0,0,24.2,0.2,58,0
2,91,62,0,0,27.3,0.525,22,0
3,99,54,19,86,25.6,0.154,24,0
3,163,70,18,105,31.6,0.268,28,1
9,145,88,34,165,30.3,0.771,53,1
7,125,86,0,0,37.6,0.304,51,0
13,76,60,0,0,32.8,0.18,41,0
6,129,90,7,326,19.6,0.582,60,0
2,68,70,32,66,25.0,0.187,25,0
3,124,80,33,130,33.2,0.305,26,0
6,114,0,0,0,0.0,0.189,26,0
9,130,70,0,0,34.2,0.652,45,1
3,125,58,0,0,31.6,0.151,24,0
3,87,60,18,0,21.8,0.444,21,0
1,97,64,19,82,18.2,0.299,21,0
3,116,74,15,105,26.3,0.107,24,0
0,117,66,31,188,30.8,0.493,22,0
0,111,65,0,0,24.6,0.66,31,0
2,122,60,18,106,29.8,0.717,22,0
0,107,76,0,0,45.3,0.686,24,0
1,86,66,52,65,41.3,0.917,29,0
6,91,0,0,0,29.8,0.501,31,0
1,77,56,30,56,33.3,1.251,24,0
4,132,0,0,0,32.9,0.302,23,1
0,105,90,0,0,29.6,0.197,46,0
0,57,60,0,0,21.7,0.735,67,0
0,127,80,37,210,36.3,0.804,23,0
3,129,92,49,155,36.4,0.968,32,1
8,100,74,40,215,39.4,0.661,43,1
3,128,72,25,190,32.4,0.549,27,1
10,90,85,32,0,34.9,0.825,56,1
4,84,90,23,56,39.5,0.159,25,0
1,88,78,29,76,32.0,0.365,29,0
8,186,90,35,225,34.5,0.423,37,1
5,187,76,27,207,43.6,1.034,53,1
4,131,68,21,166,33.1,0.16,28,0
1,164,82,43,67,32.8,0.341,50,0
4,189,110,31,0,28.5,0.68,37,0
1,116,70,28,0,27.4,0.204,21,0
3,84,68,30,106,31.9,0.591,25,0
6,114,88,0,0,27.8,0.247,66,0
1,88,62,24,44,29.9,0.422,23,0
1,84,64,23,115,36.9,0.471,28,0
7,124,70,33,215,25.5,0.161,37,0
1,97,70,40,0,38.1,0.218,30,0
8,110,76,0,0,27.8,0.237,58,0
11,103,68,40,0,46.2,0.126,42,0
11,85,74,0,0,30.1,0.3,35,0
6,125,76,0,0,33.8,0.121,54,1
0,198,66,32,274,41.3,0.502,28,1
1,87,68,34,77,37.6,0.401,24,0
6,99,60,19,54,26.9,0.497,32,0
0,91,80,0,0,32.4,0.601,27,0
2,95,54,14,88,26.1,0.748,22,0
1,99,72,30,18,38.6,0.412,21,0
6,92,62,32,126,32.0,0.085,46,0
4,154,72,29,126,31.3,0.338,37,0
0,121,66,30,165,34.3,0.203,33,1
3,78,70,0,0,32.5,0.27,39,0
2,130,96,0,0,22.6,0.268,21,0
3,111,58,31,44,29.5,0.43,22,0
2,98,60,17,120,34.7,0.198,22,0
1,143,86,30,330,30.1,0.892,23,0
1,119,44,47,63,35.5,0.28,25,0
6,108,44,20,130,24.0,0.813,35,0
2,118,80,0,0,42.9,0.693,21,1
10,133,68,0,0,27.0,0.245,36,0
2,197,70,99,0,34.7,0.575,62,1
0,151,90,46,0,42.1,0.371,21,1
6,109,60,27,0,25.0,0.206,27,0
12,121,78,17,0,26.5,0.259,62,0
8,100,76,0,0,38.7,0.19,42,0
8,124,76,24,600,28.7,0.687,52,1
1,93,56,11,0,22.5,0.417,22,0
8,143,66,0,0,34.9,0.129,41,1
6,103,66,0,0,24.3,0.249,29,0
3,176,86,27,156,33.3,1.154,52,1
0,73,0,0,0,21.1,0.342,25,0
11,111,84,40,0,46.8,0.925,45,1
2,112,78,50,140,39.4,0.175,24,0
3,132,80,0,0,34.4,0.402,44,1
2,82,52,22,115,28.5,1.699,25,0
6,123,72,45,230,33.6,0.733,34,0
0,188,82,14,185,32.0,0.682,22,1
0,67,76,0,0,45.3,0.194,46,0
1,89,24,19,25,27.8,0.559,21,0
1,173,74,0,0,36.8,0.088,38,1
1,109,38,18,120,23.1,0.407,26,0
1,108,88,19,0,27.1,0.4,24,0
6,96,0,0,0,23.7,0.19,28,0
1,124,74,36,0,27.8,0.1,30,0
7,150,78,29,126,35.2,0.692,54,1
4,183,0,0,0,28.4,0.212,36,1
1,124,60,32,0,35.8,0.514,21,0
1,181,78,42,293,40.0,1.258,22,1
1,92,62,25,41,19.5,0.482,25,0
0,152,82,39,272,41.5,0.27,27,0
1,111,62,13,182,24.0,0.138,23,0
3,106,54,21,158,30.9,0.292,24,0
3,174,58,22,194,32.9,0.593,36,1
7,168,88,42,321,38.2,0.787,40,1
6,105,80,28,0,32.5,0.878,26,0
11,138,74,26,144,36.1,0.557,50,1
3,106,72,0,0,25.8,0.207,27,0
6,117,96,0,0,28.7,0.157,30,0
2,68,62,13,15,20.1,0.257,23,0
9,112,82,24,0,28.2,1.282,50,1
0,119,0,0,0,32.4,0.141,24,1
2,112,86,42,160,38.4,0.246,28,0
2,92,76,20,0,24.2,1.698,28,0
6,183,94,0,0,40.8,1.461,45,0
0,94,70,27,115,43.5,0.347,21,0
2,108,64,0,0,30.8,0.158,21,0
4,90,88,47,54,37.7,0.362,29,0
0,125,68,0,0,24.7,0.206,21,0
0,132,78,0,0,32.4,0.393,21,0
5,128,80,0,0,34.6,0.144,45,0
4,94,65,22,0,24.7,0.148,21,0
7,114,64,0,0,27.4,0.732,34,1
0,102,78,40,90,34.5,0.238,24,0
2,111,60,0,0,26.2,0.343,23,0
1,128,82,17,183,27.5,0.115,22,0
10,92,62,0,0,25.9,0.167,31,0
13,104,72,0,0,31.2,0.465,38,1
5,104,74,0,0,28.8,0.153,48,0
2,94,76,18,66,31.6,0.649,23,0
7,97,76,32,91,40.9,0.871,32,1
1,100,74,12,46,19.5,0.149,28,0
0,102,86,17,105,29.3,0.695,27,0
4,128,70,0,0,34.3,0.303,24,0
6,147,80,0,0,29.5,0.178,50,1
4,90,0,0,0,28.0,0.61,31,0
3,103,72,30,152,27.6,0.73,27,0
2,157,74,35,440,39.4,0.134,30,0
1,167,74,17,144,23.4,0.447,33,1
0,179,50,36,159,37.8,0.455,22,1
11,136,84,35,130,28.3,0.26,42,1
0,107,60,25,0,26.4,0.133,23,0
1,91,54,25,100,25.2,0.234,23,0
1,117,60,23,106,33.8,0.466,27,0
5,123,74,40,77,34.1,0.269,28,0
2,120,54,0,0,26.8,0.455,27,0
1,106,70,28,135,34.2,0.142,22,0
2,155,52,27,540,38.7,0.24,25,1
2,101,58,35,90,21.8,0.155,22,0
1,120,80,48,200,38.9,1.162,41,0
11,127,106,0,0,39.0,0.19,51,0
3,80,82,31,70,34.2,1.292,27,1
10,162,84,0,0,27.7,0.182,54,0
1,199,76,43,0,42.9,1.394,22,1
8,167,106,46,231,37.6,0.165,43,1
9,145,80,46,130,37.9,0.637,40,1
6,115,60,39,0,33.7,0.245,40,1
1,112,80,45,132,34.8,0.217,24,0
4,145,82,18,0,32.5,0.235,70,1
10,111,70,27,0,27.5,0.141,40,1
6,98,58,33,190,34.0,0.43,43,0
9,154,78,30,100,30.9,0.164,45,0
6,165,68,26,168,33.6,0.631,49,0
1,99,58,10,0,25.4,0.551,21,0
10,68,106,23,49,35.5,0.285,47,0
3,123,100,35,240,57.3,0.88,22,0
8,91,82,0,0,35.6,0.587,68,0
6,195,70,0,0,30.9,0.328,31,1
9,156,86,0,0,24.8,0.23,53,1
0,93,60,0,0,35.3,0.263,25,0
3,121,52,0,0,36.0,0.127,25,1
2,101,58,17,265,24.2,0.614,23,0
2,56,56,28,45,24.2,0.332,22,0
0,162,76,36,0,49.6,0.364,26,1
0,95,64,39,105,44.6,0.366,22,0
4,125,80,0,0,32.3,0.536,27,1
5,136,82,0,0,0.0,0.64,69,0
2,129,74,26,205,33.2,0.591,25,0
3,130,64,0,0,23.1,0.314,22,0
1,107,50,19,0,28.3,0.181,29,0
1,140,74,26,180,24.1,0.828,23,0
1,144,82,46,180,46.1,0.335,46,1
8,107,80,0,0,24.6,0.856,34,0
13,158,114,0,0,42.3,0.257,44,1
2,121,70,32,95,39.1,0.886,23,0
7,129,68,49,125,38.5,0.439,43,1
2,90,60,0,0,23.5,0.191,25,0
7,142,90,24,480,30.4,0.128,43,1
3,169,74,19,125,29.9,0.268,31,1
0,99,0,0,0,25.0,0.253,22,0
4,127,88,11,155,34.5,0.598,28,0
4,118,70,0,0,44.5,0.904,26,0
2,122,76,27,200,35.9,0.483,26,0
6,125,78,31,0,27.6,0.565,49,1
1,168,88,29,0,35.0,0.905,52,1
2,129,0,0,0,38.5,0.304,41,0
4,110,76,20,100,28.4,0.118,27,0
6,80,80,36,0,39.8,0.177,28,0
10,115,0,0,0,0.0,0.261,30,1
2,127,46,21,335,34.4,0.176,22,0
9,164,78,0,0,32.8,0.148,45,1
2,93,64,32,160,38.0,0.674,23,1
3,158,64,13,387,31.2,0.295,24,0
5,126,78,27,22,29.6,0.439,40,0
10,129,62,36,0,41.2,0.441,38,1
0,134,58,20,291,26.4,0.352,21,0
3,102,74,0,0,29.5,0.121,32,0
7,187,50,33,392,33.9,0.826,34,1
3,173,78,39,185,33.8,0.97,31,1
10,94,72,18,0,23.1,0.595,56,0
1,108,60,46,178,35.5,0.415,24,0
5,97,76,27,0,35.6,0.378,52,1
4,83,86,19,0,29.3,0.317,34,0
1,114,66,36,200,38.1,0.289,21,0
1,149,68,29,127,29.3,0.349,42,1
5,117,86,30,105,39.1,0.251,42,0
1,111,94,0,0,32.8,0.265,45,0
4,112,78,40,0,39.4,0.236,38,0
1,116,78,29,180,36.1,0.496,25,0
0,141,84,26,0,32.4,0.433,22,0
2,175,88,0,0,22.9,0.326,22,0
2,92,52,0,0,30.1,0.141,22,0
3,130,78,23,79,28.4,0.323,34,1
8,120,86,0,0,28.4,0.259,22,1
2,174,88,37,120,44.5,0.646,24,1
2,106,56,27,165,29.0,0.426,22,0
2,105,75,0,0,23.3,0.56,53,0
4,95,60,32,0,35.4,0.284,28,0
0,126,86,27,120,27.4,0.515,21,0
8,65,72,23,0,32.0,0.6,42,0
2,99,60,17,160,36.6,0.453,21,0
1,102,74,0,0,39.5,0.293,42,1
11,120,80,37,150,42.3,0.785,48,1
3,102,44,20,94,30.8,0.4,26,0
1,109,58,18,116,28.5,0.219,22,0
9,140,94,0,0,32.7,0.734,45,1
13,153,88,37,140,40.6,1.174,39,0
12,100,84,33,105,30.0,0.488,46,0
1,147,94,41,0,49.3,0.358,27,1
1,81,74,41,57,46.3,1.096,32,0
3,187,70,22,200,36.4,0.408,36,1
6,162,62,0,0,24.3,0.178,50,1
4,136,70,0,0,31.2,1.182,22,1
1,121,78,39,74,39.0,0.261,28,0
3,108,62,24,0,26.0,0.223,25,0
0,181,88,44,510,43.3,0.222,26,1
8,154,78,32,0,32.4,0.443,45,1
1,128,88,39,110,36.5,1.057,37,1
7,137,90,41,0,32.0,0.391,39,0
0,123,72,0,0,36.3,0.258,52,1
1,106,76,0,0,37.5,0.197,26,0
6,190,92,0,0,35.5,0.278,66,1
2,88,58,26,16,28.4,0.766,22,0
9,170,74,31,0,44.0,0.403,43,1
9,89,62,0,0,22.5,0.142,33,0
10,101,76,48,180,32.9,0.171,63,0
2,122,70,27,0,36.8,0.34,27,0
5,121,72,23,112,26.2,0.245,30,0
1,126,60,0,0,30.1,0.349,47,1
1,93,70,31,0,30.4,0.315,23,0
# encoding: utf-8
import pandas
import matplotlib.pyplot as plt
import seaborn as sns
diabetes = pandas.read_csv('diabetes.csv')
# solution one:
data = diabetes['Outcome'].value_counts()
sns.barplot(x=data.index, y=data.values)
# solution two:
sns.countplot(x='Outcome', data=diabetes)
Related
Large Datsample: failing to better visualize data point using matplotlib plot
The size of the data samples is very large, making it difficult to visualise the data points using a matplotlib plot. Sample Code: import matplotlib.pyplot as plt plt.plot(myList_timestamps, myList_fitnessValues) plt.xlabel('Timestamps (seconds)') #plt.xticks(range(1, 51) #plt.xticks(range(1, 53, 5)) plt.ylabel('WATT - MSU Fitness Values') plt.title('Evolutionary Optimization - Execution Time') plt.show() Output: I have 9113 candidates solutions as data samples to plot against 9113 data samples as fitness values. How should I plot this large data using python to better visualize the data? Data Sample: myList_timestamps = [[0.06160092353820801, 0.07070684432983398, 0.0794517993927002, 0.08730483055114746, 0.09506797790527344, 0.10278487205505371, 0.11050796508789062, 0.11819696426391602, 0.12598776817321777, 0.13364410400390625, 0.1412339210510254, 0.14882898330688477, 0.15642499923706055, 0.16405892372131348, 0.171644926071167, 0.17924880981445312, 0.1868269443511963, 0.1943988800048828, 0.2020108699798584, 0.21060776710510254, 0.219498872756958, 0.22813701629638672, 0.23638296127319336, 0.24529194831848145, 0.25347185134887695, 0.26166296005249023, 0.2696189880371094, 0.2773740291595459, 0.2849307060241699, 0.2925240993499756, 0.30014586448669434, 0.3077728748321533, 0.31533288955688477, 0.32283592224121094, 0.3303370475769043, 0.3378570079803467, 0.34534668922424316, 0.352841854095459, 0.36031174659729004, 0.3678579330444336, 0.3753628730773926, 0.3828439712524414, 0.3903648853302002, 0.39795589447021484, 0.40547990798950195, 0.412992000579834, 0.42046594619750977, 0.42803382873535156, 0.435579776763916, 0.44308996200561523, 0.450577974319458, 0.45802807807922363, 0.4655318260192871, 0.4730229377746582, 0.48052191734313965, 0.488048791885376, 0.49558186531066895, 0.5031087398529053, 0.5106048583984375, 0.5181560516357422, 0.525662899017334, 0.5331556797027588, 0.5406389236450195, 0.5481007099151611, 0.5555720329284668, 0.563060998916626, 0.5705769062042236, 0.578115701675415, 0.5856177806854248, 0.5931298732757568, 0.6006178855895996, 0.6081528663635254, 0.6156718730926514, 0.6231448650360107, 0.6306188106536865, 0.6381428241729736, 0.6456358432769775, 0.6531088352203369, 0.6606647968292236, 0.6682088375091553, 0.6756858825683594, 0.6832168102264404, 0.6907000541687012, 0.6981749534606934, 0.7056229114532471, 0.7130780220031738, 0.7205479145050049, 0.728065013885498, 0.7355530261993408, 0.743027925491333, 0.7505538463592529, 0.7580459117889404, 0.7654819488525391, 0.7729947566986084, 0.7804989814758301, 0.7879579067230225, 0.7954659461975098, 0.8029458522796631, 0.8104219436645508, 0.8179588317871094, 0.8254818916320801, 0.8329558372497559, 0.840451717376709, 0.8479418754577637, 0.8554189205169678, 0.8629167079925537, 0.8704218864440918, 0.8782069683074951, 0.8857617378234863, 0.8933010101318359, 0.9008169174194336, 0.9083929061889648, 0.9159009456634521, 0.923414945602417, 0.9309487342834473, 0.9386038780212402, 0.9461567401885986, 0.9536347389221191, 0.9610898494720459, 0.9685368537902832, 0.9759769439697266, 0.983414888381958, 0.9908480644226074, 0.9982888698577881, 1.0057227611541748, 1.01314377784729, 1.0205698013305664, 1.0280189514160156, 1.035449743270874, 1.0429389476776123, 1.0503628253936768, 1.0578010082244873, 1.0658130645751953, 1.0734107494354248, 1.081054925918579, 1.0888869762420654, 1.0964579582214355, 1.1040010452270508, 1.1115117073059082, 1.1190118789672852, 1.1264939308166504, 1.1339750289916992, 1.141474723815918, 1.1489946842193604, 1.156526803970337, 1.164029836654663, 1.1716160774230957, 1.1790966987609863, 1.1865930557250977, 1.1940937042236328, 1.2019388675689697, 1.2094628810882568, 1.216930866241455, 1.2243878841400146, 1.2318336963653564, 1.2393128871917725, 1.2467608451843262, 1.2542097568511963, 1.2619950771331787, 1.2704198360443115, 1.2786128520965576, 1.2871167659759521, 1.2947309017181396, 1.302293062210083, 1.309783697128296, 1.3177897930145264, 1.3256456851959229, 1.3331577777862549, 1.340836763381958, 1.348417043685913, 1.355942964553833, 1.3635058403015137, 1.3709850311279297, 1.3785638809204102, 1.3860559463500977, 1.3935277462005615, 1.4009969234466553, 1.408479928970337, 1.415954828262329, 1.423440933227539, 1.4309158325195312, 1.4383947849273682, 1.4458889961242676, 1.453355073928833, 1.4608356952667236, 1.468317985534668, 1.4757959842681885, 1.4833028316497803, 1.4908149242401123, 1.4983007907867432, 1.505788803100586, 1.5132827758789062, 1.520780086517334, 1.5282917022705078, 1.5357389450073242, 1.5432488918304443, 1.5507168769836426, 1.5581979751586914, 1.565687656402588, 1.5731756687164307, 1.58066987991333, 1.5881669521331787, 1.5956358909606934, 1.6031649112701416, 1.6106679439544678, 1.6181929111480713, 1.6265389919281006, 1.634814977645874, 1.6424179077148438, 1.6499037742614746, 1.657348871231079, 1.6648588180541992, 1.6722848415374756, 1.6797456741333008, 1.6871848106384277, 1.6946487426757812, 1.7022688388824463, 1.7098469734191895, 1.7173528671264648, 1.724863052368164, 1.73232102394104, 1.7397880554199219, 1.7472498416900635, 1.7546827793121338, 1.762143850326538, 1.7696146965026855, 1.777108907699585, 1.7845828533172607, 1.7920348644256592, 1.7994859218597412, 1.806952953338623, 1.8144299983978271, 1.8218896389007568, 1.8293559551239014, 1.8368110656738281, 1.8442790508270264, 1.851726770401001, 1.8592119216918945, 1.86667799949646, 1.8741397857666016, 1.8815827369689941, 1.8890256881713867, 1.8964788913726807, 1.9039208889007568, 1.911383867263794, 1.918832778930664, 1.9262988567352295, 1.9337799549102783, 1.94124174118042, 1.948828935623169, 1.9562938213348389, 1.9637949466705322, 1.9712047576904297, 1.9786548614501953, 1.986097812652588, 1.9935338497161865, 2.000976800918579, 2.0084168910980225, 2.016091823577881, 2.023655891418457, 2.031132936477661, 2.038616895675659, 2.0460739135742188, 2.053546905517578, 2.060973882675171, 2.0684218406677246, 2.0758438110351562, 2.083289861679077, 2.0906968116760254, 2.0981409549713135, 2.1055638790130615, 2.1129748821258545, 2.1203808784484863, 2.1278228759765625, 2.1352219581604004, 2.1426548957824707, 2.1502327919006348, 2.1577627658843994, 2.165205955505371, 2.1726489067077637, 2.180156946182251, 2.1876187324523926, 2.195056915283203, 2.202542781829834, 2.210002899169922, 2.217458963394165, 2.2249059677124023, 2.232353925704956, 2.2398228645324707, 2.247271776199341, 2.2547237873077393, 2.262202739715576, 2.269657850265503, 2.277296781539917, 2.284979820251465, 2.2924628257751465, 2.2999508380889893, 2.3074228763580322, 2.3148908615112305, 2.3223717212677, 2.329817771911621, 2.3372578620910645, 2.34472393989563, 2.3521809577941895, 2.359632968902588, 2.367115020751953, 2.374567985534668, 2.382063865661621, 2.38950777053833, 2.3970019817352295, 2.404465913772583, 2.4119558334350586, 2.4194018840789795, 2.4268767833709717, 2.4343249797821045, 2.441788911819458, 2.4492337703704834, 2.45668888092041, 2.4641637802124023, 2.471620798110962, 2.479109764099121, 2.48657488822937, 2.494025945663452, 2.501471996307373, 2.508949041366577, 2.5164427757263184, 2.523920774459839, 2.531388998031616, 2.53886079788208, 2.5463309288024902, 2.5537829399108887, 2.5612847805023193, 2.568727731704712, 2.576223850250244, 2.583711862564087, 2.591172933578491, 2.598625898361206, 2.6060757637023926, 2.6135129928588867, 2.621011972427368, 2.628448963165283, 2.635972738265991, 2.643435001373291, 2.650902032852173, 2.6583468914031982, 2.665862798690796, 2.673314094543457, 2.680816888809204, 2.688267946243286, 2.6957550048828125, 2.7032127380371094, 2.7106738090515137, 2.7181079387664795, 2.725554943084717, 2.732996940612793, 2.740450859069824, 2.747886896133423, 2.7553389072418213, 2.7627639770507812, 2.7702107429504395, 2.777662992477417, 2.7851169109344482, 2.7925288677215576, 2.80000376701355, 2.8074288368225098, 2.8148789405822754, 2.8223319053649902, 2.8297858238220215, 2.8372128009796143, 2.84466290473938, 2.852128028869629, 2.85958194732666, 2.8670127391815186, 2.8744797706604004, 2.8819189071655273, 2.8893797397613525, 2.896803855895996, 2.9042470455169678, 2.911679983139038, 2.919153928756714, 2.9266068935394287, 2.9340579509735107, 2.9415018558502197, 2.9490177631378174, 2.9564428329467773, 2.9638688564300537, 2.9712448120117188, 2.9786460399627686, 2.986050844192505, 2.9934427738189697, 3.0008530616760254, 3.0082297325134277, 3.015631914138794, 3.023007869720459, 3.030390977859497, 3.0377516746520996, 3.04512882232666, 3.052503824234009, 3.0598559379577637, 3.067525863647461, 3.074979782104492, 3.082453966140747, 3.089857816696167, 3.0973098278045654, 3.104733943939209, 3.1121609210968018, 3.11958384513855, 3.1270148754119873, 3.1344220638275146, 3.141826868057251, 3.1492297649383545, 3.1566479206085205, 3.1641108989715576, 3.1720409393310547, 3.18062686920166, 3.188631772994995, 3.19647479057312, 3.2040579319000244, 3.211491823196411, 3.2189619541168213, 3.2264137268066406, 3.2338807582855225, 3.241302013397217, 3.248771905899048, 3.256213903427124, 3.263671875, 3.2710888385772705, 3.2785208225250244, 3.285946846008301, 3.293437957763672, 3.3010239601135254, 3.3086907863616943, 3.3162219524383545, 3.3237030506134033, 3.3311376571655273, 3.3386118412017822, 3.3460726737976074, 3.3535208702087402, 3.3609509468078613, 3.368414878845215, 3.3758559226989746, 3.3833189010620117, 3.3907477855682373, 3.3982179164886475, 3.405695915222168, 3.413137912750244, 3.420606851577759, 3.4280447959899902, 3.435490846633911, 3.4429378509521484, 3.4504079818725586, 3.4578518867492676, 3.4652678966522217, 3.4726951122283936, 3.4801628589630127, 3.4876327514648438, 3.4950459003448486, 3.502520799636841, 3.5099668502807617, 3.5174667835235596, 3.5249149799346924, 3.532382011413574, 3.5398058891296387, 3.547271966934204, 3.554724931716919, 3.5621488094329834, 3.5695910453796387, 3.5770299434661865, 3.5844788551330566, 3.5919089317321777, 3.599360942840576, 3.6068217754364014, 3.6142799854278564, 3.6217379570007324, 3.6291840076446533, 3.636641025543213, 3.6440939903259277, 3.651533842086792, 3.658979892730713, 3.6664540767669678, 3.67389178276062, 3.681334972381592, 3.688839912414551, 3.6963768005371094, 3.7038447856903076, 3.711305856704712, 3.718761920928955, 3.726195812225342, 3.7336368560791016, 3.741126775741577, 3.7485568523406982, 3.7559916973114014, 3.763450860977173, 3.770900011062622, 3.778341770172119, 3.785810947418213, 3.7932307720184326, 3.800668954849243, 3.808100938796997, 3.8155479431152344, 3.82303786277771, 3.8304550647735596, 3.8379018306732178, 3.845344066619873, 3.852766990661621, 3.860213041305542, 3.867640733718872, 3.8750839233398438, 3.8825418949127197, 3.8900070190429688, 3.897446870803833, 3.9049458503723145, 3.9123809337615967, 3.919834852218628, 3.927325963973999, 3.934762954711914, 3.9422247409820557, 3.9497127532958984, 3.957167863845825, 3.9645960330963135, 3.972066879272461, 3.9795138835906982, 3.9869298934936523, 3.9943947792053223, 4.001836776733398, 4.0092689990997314, 4.016718864440918, 4.0241899490356445, 4.031642913818359, 4.039106845855713, 4.046592950820923, 4.05404806137085, 4.061479806900024, 4.068920850753784, 4.076357841491699, 4.083805799484253, 4.0912556648254395, 4.098691701889038, 4.106162786483765, 4.1136109828948975, 4.121060848236084, 4.128498792648315, 4.135960817337036, 4.143415689468384, 4.15084171295166, 4.158272981643677, 4.16582989692688, 4.173282861709595, 4.180737733840942, 4.188170909881592, 4.195602893829346, 4.203077793121338, 4.210502862930298, 4.2179529666900635, 4.225406885147095, 4.232857704162598, 4.240309000015259, 4.247731924057007, 4.255206823348999, 4.262646913528442] myList_fitnessValues = [1.177397872785327, 1.1838368070851042, 1.198426283830517, 1.1971495165606483, 1.1300637485336795, 1.2187992912454821, 1.2145353817939883, 1.0729413153620015, 1.2521284084941269, 1.2183068116189408, 1.195634989638366, 1.1613388860470966, 1.2217006054348303, 1.206234560770683, 1.2372446068751055, 1.187058775523, 1.1872546511295015, 1.1966112517544802, 1.2145107120984742, 1.2421864845871378, 1.1890153127520433, 1.1674951340729436, 1.2251505016710167, 1.1958552931582382, 1.2080607542394712, 1.201035514597457, 1.092659066061191, 1.2306418318602446, 1.1995437445068218, 1.2449192292367206, 1.2106208502011808, 1.2112721352650087, 1.1196669840676667, 1.1134332262454683, 1.1197768644022856, 1.2261263457543805, 1.231366828628176, 1.2196350828703688, 1.08741318320004, 1.2032137535738274, 1.2024228903569536, 1.2137572975032105, 1.0738592164216931, 1.1738526733756591, 1.1544974613440897, 1.160844467172908, 1.2187677280979918, 1.162505454897613, 1.2021549705530339, 1.229063908531223, 1.214924462090727, 1.1411833735549284, 1.1883797211741252, 1.1342311436728563, 1.2194421521815677, 1.1237953059433416, 1.185322478323287, 1.1688528378709393, 1.138039592406455, 1.1855580350049484, 1.2303222163698007, 1.2140360262028758, 1.09912727836326, 1.0982013456663848, 1.2074961979865895, 1.2130674992213648, 1.1064772919391566, 1.2183787053226458, 1.2387016873859218, 1.1316362444070998, 1.0955985789217237, 1.2295510887027803, 1.2321228706728062, 1.2291667095487586, 1.1943183790667353, 1.1806877475400122, 1.0821097661565597, 1.1885871916833606, 1.2287827776186633, 1.1245075536475073, 1.246567313324614, 1.1968924804246073, 1.2357189468661003, 1.0798212767853532, 1.210981845170037, 1.1949578119730175, 1.0745447494722138, 1.1842984199966768, 1.1885233082136473, 1.1404877293427729, 1.176750616683678, 1.2322331744279031, 1.2008328893267939, 1.1839763301938666, 1.1740540064695157, 1.1215709455350205, 1.1838699168837248, 1.2190806980658488, 1.2187178223617976, 1.188198435991883, 1.2420874742392598, 1.1936975325903234, 1.145645140863139, 1.1896439998849606, 1.0901724022621744, 1.2214054198855253, 1.202183913330283, 1.2214232388980968, 1.2451547757149166, 1.1542504637802762, 1.2150818383252948, 1.1551718106916113, 1.180265276583371, 1.2259447669065064, 1.23970172148869, 1.2195702465867029, 1.2121212076750423, 1.1196861951049026, 1.084233317578786, 1.2184195145467944, 1.2019297900082373, 1.2197546777584807, 1.1806877475400122, 1.1935874583246553, 1.1947324698675565, 1.1949174251388859, 1.1859323990481676, 1.0906342354229615, 1.1176255050944655, 1.1496417617749741, 1.214221309853014, 1.1871680736265695, 1.1915179673491303, 1.2025838867023781, 1.197499571598236, 1.1366803103334713, 1.2085395261620986, 1.211657983876409, 1.2119904284994945, 1.1499635839213362, 1.2048809684531807, 1.18988003425591, 1.162958419973022, 1.2117707427085584, 1.1243944753618493, 1.1744385678325748, 1.1903600159926122, 1.2016224458259388, 1.211296343777177, 1.1349759574949243, 1.0718396654449382, 1.1964735952940981, 1.2321228706728062, 1.240538488513929, 1.137008792662425, 1.118080518441783, 1.2179995323083854, 1.2332167673456187, 1.2299392260321718, 1.229455434517842, 1.0945646172721897, 1.1684574384092985, 1.2216592587636825, 1.1473954661560457, 1.0972316717042851, 1.2069927716927877, 1.145655054243576, 1.1709533542017871, 1.2399276594736448, 1.0571702762640665, 1.1289925835126173, 1.1978661608433139, 1.1751549861474675, 1.189320827332064, 1.114652077172573, 1.0855461561951376, 1.114545327811882, 1.213725567748654, 1.20353452440095, 1.1820774536021856, 1.186462718947463, 1.1889690769217898, 1.2018835746505774, 1.211090224753304, 1.1831781914671817, 1.1773466438721967, 1.197092394238814, 1.2041535500147282, 1.163132237400184, 1.168563226082197, 1.1678829662040073, 1.1363664937760698, 1.1083990267935506, 1.2031778809291547, 1.0676216251859287, 1.2177599264089978, 1.0990307312997643, 1.21049553896777, 1.1599270669137582, 1.2328076437831437, 1.0972099959852455, 1.2158413254752458, 1.1858591862647971, 1.160354488282236, 1.1885987402151457, 1.242744809392655, 1.180804379621974, 1.1948754664090295, 1.1999708176480794, 1.0863273779101585, 1.1865571118556641, 1.2247520706088966, 1.1902065318111597, 1.1769933798289114, 1.1908864309517615, 1.2057410331253477, 1.2364890730379687, 1.1663675183275037, 1.1088393200653563, 1.20706966917313, 1.2442896235721, 1.1069454133505705, 1.2628901213116968, 1.1207013243831028, 1.1582247278576716, 1.0708548471205084, 1.2155678255250282, 1.1986370029163065, 1.1459855041681286, 1.2054266674604792, 1.192257639008284, 1.197672089140054, 1.198202892392417, 1.1025040708024108, 1.121321746966252, 1.2149674581109837, 1.2123920496821512, 1.227103878165898, 1.189101851528379, 1.253525044950779, 1.2498189114548643, 1.173845452730351, 1.2083118238298576, 1.2030549929175092, 1.2271213348837007, 1.1478325884552891, 1.1960780932197772, 1.1902259956766275, 1.2467831992009593, 1.0792760733500293, 1.1869221700876043, 1.0824793309140637, 1.1955662830576248, 1.1080499423655457, 1.2006240107240815, 1.0880807583848786, 1.2157448455744477, 1.1521531149930204, 1.240280892270902, 1.1238415805874602, 1.1828435837181859, 1.1712592947196425, 1.2137283926841305, 1.2424701024482705, 1.2263538380098462, 1.2070290285031617, 1.1631224185724471, 1.0794787639871248, 1.093670630714558, 1.1265887464291346, 1.2318408943741077, 1.1936771541321396, 1.2169441544187152, 1.198506382581772, 1.186458880174174, 1.2103524823669856, 1.2285778509901992, 1.1200216208405227, 1.1387896672101574, 1.0908173539816957, 1.2308851210556966, 1.2035466664307617, 1.1001905414241768, 1.1424185494658932, 1.2269161990482325, 1.1999656325314627, 1.1967207679880325, 1.1600771097377474, 1.2069027992929418, 1.1385148138423051, 1.1489017335157772, 1.1068267732858115, 1.2205880980904533, 1.218044294574066, 1.2529730847546638, 1.186660925630313, 1.2060697606531923, 1.2045284746581517, 1.1642166388713013, 1.1103498769950435, 1.1756364918041724, 1.1065195117330475, 1.185722908999943, 1.2160505306065248, 1.1583256484574564, 1.1826392418072076, 1.178493074752072, 1.1177123697895326, 1.2412795138296302, 1.2170991263240316, 1.1378564491277, 1.2598329438516054, 1.1594168596923815, 1.067412768958962, 1.0681905031107433, 1.1088495388520627, 1.2260312346475448, 1.1845181121770647, 1.0908462423974803, 1.2254157975354272, 1.1726057354383534, 1.2463105895418234, 1.1938360058317639, 1.1809949387357708, 1.214965669951487, 1.1806096453015262, 1.2120442182541238, 1.2039396191666214, 1.2241011795101584, 1.1835653941636586, 1.1872311824740118, 1.2049867769183018, 1.1032492996465715, 1.2459948771640978, 1.210714791333494, 1.2017638381896383, 1.2082205245581055, 1.2100706475737704, 1.1777593480571773, 1.2463816959419804, 1.1956288937602344, 1.2250384673113388, 1.2232925845822948, 1.2271097732217437, 1.2041158407114751, 1.1731142176012719, 1.089562181699617, 1.2065580430236436, 1.1286176112592208, 1.214260708902002, 1.100397749837259, 1.1634968104491086, 1.2031492654249205, 1.241916873584268, 1.128692464375822, 1.2438405074344832, 1.221942545955605, 1.2122284632985285, 1.2196872139542247, 1.1963958742294165, 1.211163602848183, 1.1876392875222728, 1.1120181290701372, 1.1928622611586417, 1.2310597744441403, 1.0909886287400576, 1.1746761873370748, 1.086400046407615, 1.1948938617215121, 1.237389733833963, 1.2002584041594944, 1.1634829773569397, 1.1560999466513606, 1.1517515881362235, 1.18561959209192, 1.1243333063590204, 1.168110787112396, 1.252233283674239, 1.1809616018853473, 1.1172192014427276, 1.065718486758231, 1.1735702052275503, 1.2319344426459806, 1.2406551834164845, 1.134545708488982, 1.212394683299605, 1.0839740327133316, 1.154921467945748, 1.1868420784058569, 1.27846759456701, 1.1337877151557247, 1.2090680051988998, 1.111959785928736, 1.2162877159119596, 1.2617090658101289, 1.0746368205192902, 1.082494892236285, 1.12003079427392, 1.2349350980294647, 1.2079171758399385, 1.1540805938938137, 1.1904244522100265, 1.0925561509117376, 1.1130713817081679, 1.1996791615125522, 1.1953376557177446, 1.1721740496775683, 1.1498018407550115, 1.2189399864150035, 1.2174001512005672, 1.1841444791371007, 1.185707384067646, 1.1818600419697818, 1.1487639315280984, 1.187990790473883, 1.2070236352846957, 1.183120704393338, 1.2131486529878408, 1.2230034850431808, 1.2598577318052009, 1.222494513225296, 1.1989335894352298, 1.133213715468035, 1.137460808129861, 1.24270509873175, 1.1877173094601927, 1.2104442602106054, 1.2230272768431958, 1.1848372792316968, 1.1892502628879684, 1.2035024239408367, 1.1289245106213106, 1.1547680583390754, 1.1817062724464646, 1.07460992973405, 1.2424105540969468, 1.2006706347201768, 1.1469299638380548, 1.2003475049998125, 1.2628425996056627, 1.1704529581521437, 1.2318309803876157, 1.0800513855721836, 1.228251341459926, 1.20519927398022, 1.2026116263341706, 1.2267213579299914, 1.1944767555176976, 1.0973340714559194, 1.199844572870176, 1.2167600163050747, 1.1973706771935049, 1.1274929727743968, 1.1847494081385286, 1.2179786952027045, 1.2103068524172256, 1.1648972358845942, 1.2012871447601516, 1.0806169290790832, 1.0638847843439245, 1.1523924483632424, 1.2163186571317048, 1.2318610477915777, 1.1790869269637845, 1.1800511479858375, 1.1828738610906249, 1.1414027009085952, 1.2239157840282788, 1.2163662161977793, 1.0777765284762604, 1.1871756186016387, 1.191419398750568, 1.2077786982792487, 1.1306928350191163, 1.2219862084208202, 1.1704952108872595, 1.1350341511093405, 1.2382530787288621, 1.197672089140054, 1.1634636863060297, 1.2198105693727255, 1.1738029086162305, 1.1866104828955661, 1.2050422293564858, 1.0986376515523584, 1.1639928343093937, 1.22645365263098, 1.0831783532562473, 1.1793732758175444, 1.2095496760640134, 1.1933309580469191, 1.0970298786458046, 1.1494963511728211, 1.1967270644046457, 1.2344818441993706, 1.2272379509433546, 1.1112370068652921, 1.221504646323395, 1.2374620707520216, 1.1180642101127265, 1.2499150575244404, 1.1306307576694052, 1.2043884061922128, 1.2148802673894985, 1.1818496551780364, 1.256060021892613, 1.1922912062142983, 1.1902422382130782, 1.1992276134291726, 1.1710757539172894, 1.123994660195365, 1.2214993644613943, 1.155215069374298, 1.1086344864348479, 1.0910943060265557, 1.2191511677776559, 1.210061225791385, 1.177381635100414, 1.181486384213164, 1.165494009707241, 1.1963931772967231, 1.2102493016491176, 1.101845863755783, 1.2104131731458112, 1.2496346326865795, 1.1918641349127161, 1.2362974006491536, 1.2055345356030078, 1.2285741635823975, 1.2335964200302294, 1.2299260975739024, 1.252639296531916, 1.1816404229058095, 1.0906166413304024, 1.2083432826502967, 1.198686258537757, 1.1415695127122047, 1.092894116614261, 1.2066842100186415, 1.156538986861618, 1.2474806142885053, 1.2187478225293684, 1.2316920790783128, 1.2105404142792078, 1.2045940601752774, 1.1231347496689397, 1.1047593741136272, 1.18129835095779, 1.1835647508539222, 1.2450528028358812, 1.2222158604224076, 1.2150490929276319, 1.1816927028319475, 1.1823015755626682, 1.2708857606096744, 1.1919272687522717, 1.199215576802391, 1.2235538374085948, 1.2001199439086292, 1.1730857828737784, 1.209032518532766, 1.240920756903906, 1.102814033624564, 1.218812306587527, 1.1996553618634807, 1.179606921083769, 1.2017295317409378, 1.2330407322845536, 1.1187392156488476, 1.225736440475797, 1.0995456254389886, 1.1398239919352195, 1.2035675444496818, 1.1586383728042269, 1.2287334286814806, 1.195581908342988, 1.182475780454091, 1.1987430360427977, 1.216557035654513, 1.1996494907287538, 1.2383901831314694, 1.1531934815518878, 1.229216103794829, 1.2106112336572799, 1.1849778997346532, 1.18237184590969, 1.2009038458812764, 1.0961585804850271, 1.178040774021339, 1.1722305560727864, 1.2280646936758626, 1.1730878580889061, 1.1798127065856396, 1.224173817391561, 1.2065293766499958, 1.1997898485636171, 1.2424004246290328, 1.1717570065002927, 1.2338402423416157, 1.2494056527462882, 1.2188644637313981, 1.2212661458082938, 1.2339544318944837, 1.1071211607425422, 1.1606278890869028, 1.2189699753534322, 1.180272917562664, 1.1426456950772235, 1.0522788530258245, 1.1829427275613456, 1.2262188308828839, 1.2251773195743205, 1.1956258209753046, 1.2114920876892714, 1.1953916820234736, 1.23382398473895, 1.1582401755284804, 1.191629137388988, 1.2178006337369847, 1.251136439760085, 1.1365976380520602, 1.174275078234959, 1.0808087704223992, 1.2032740733244425, 1.2103517133973012, 1.11326005536463, 1.1909349869585562, 1.2212796832585389, 1.1075096790834102, 1.2498229141296608, 1.084664865732375, 1.1683357564539953, 1.2082937933568851, 1.252239384886692, 1.2241448948948157, 1.2220195905349323, 1.0755183739777228, 1.2246287887655924, 1.203941883586293, 1.1242510612918695, 1.2235007768884452, 1.1730788382137691, 1.0994391409748683, 1.223672903798066, 1.1273787876886823, 1.2387058055283537, 1.2136671563285772, 1.204874914999746, 1.1863124400411849, 1.2194323539365215, 1.139574455552127, 1.1883768406708517, 1.2000846688283575, 1.1745314981161292, 1.2216393545756357, 1.148559186473642, 1.1276502268015958, 1.1678501220114077, 1.248042556728196, 1.1528823530190904, 1.182349952140096, 1.202872559373987, 1.057656133683926, 1.196122637100774, 1.2031121605191817, 1.1634951499402728, 1.2095000735625363, 1.1901826500944825, 1.1705303635565636, 1.221904684759513, 1.2008426805755377, 1.2191513614245515, 1.2383835946927975, 1.1822466263148794, 1.2000277251766025, 1.0675643227701521, 1.2229772647360104, 1.082493154489034, 1.178347854805873, 1.1940673459489852, 1.1946568831787179, 1.219277339137701, 1.135039734235405, 1.2539824081361624, 1.2267246222664205, 1.0960629129827957, 1.2130669354862218, 1.2300957041596126, 1.1573830982698168, 1.096123662648259, 1.2477729284441184, 1.2135638836890315, 1.220630164390247, 1.2162877159119596, 1.2090167543426475, 1.187489906720505, 1.2275503381344637, 1.1086754622565136, 1.1618707919314104, 1.1070407212315239, 1.1923226787718677, 1.0900666694354006, 1.2262690661499525, 1.2056761416930777, 1.2458301275482253, 1.1732441231849604, 1.2211117817426773, 1.1948872902367709, 1.130818495246797, 1.2026206008072473, 1.2067040095784871, 1.1913340391980174, 1.2398675486238038, 1.1780518996775449, 1.1806804473198347, 1.2154433988507445, 1.2041310140780057, 1.1948521569436659, 1.1658255171990985, 1.2146852320116623, 1.2174547247773808, 1.2307680369014695, 1.1682623391256952, 1.2188082178033945, 1.2423527542349246, 1.13230783361083, 1.2097691357097797, 1.2047969399649594, 1.1517698102978422, 1.2065252124817711, 1.0985349880573572, 1.1426104372808603, 1.2351760150170086, 1.1902473719724727, 1.1791482059371399, 1.1185800577890548, 1.1774186347558009, 1.2397017660770022, 1.1932399219346395, 1.1009298704332167, 1.1104128735371144 ] How should I plot this large data using python to better visualize the data?
A simple and common method to get a better overview about this kind of data is to calculate the moving average (mainly it to see if there are any trends). See this post for different approaches to calculate the moving average in python. Note 1: You need to decide how much you want to smooth the data by setting a parameter (called N here). You might have to play around a little with N to see which value best suits your data. Note 2: By calculating the moving average the length of you data changes (it gets N-1 shorter). So the timestamp values must also be shortened. Using the sample data from the question and choosing N=51: import numpy as np N = 51 myList_fitnessValues_ma = np.convolve(myList_fitnessValues, np.ones(N)/N, mode='valid') myList_timestamps_ma = myList_timestamps[int((N-1)/2):-int((N-1)/2)] plt.plot(myList_timestamps_ma, myList_fitnessValues_ma) plt.xlabel('Timestamps (seconds)') plt.ylabel('WATT - MSU Fitness Values (moving average)') plt.title('Evolutionary Optimization - Execution Time') plt.show()
Plot standard deviation with only positive values
I wanted to ask about a problem that I can't find a solution to, I'm quite new to python and programming. I have my code where I calculate different statistical measurements and in the fourth graph axes [1:1] I am trying to represent the standard deviation of my variable (accumulated daily rainfall in mm) but I have a problem and that is that the standard deviation represents values upwards and below average. Precipitation cannot have negative values and I wanted to know if it is possible to put some kind of filter so that only values equal to or greater than 0 are plotted. Here I leave my example code and the data that I use import numpy as np import pandas as pd from sklearn.datasets import load_iris import seaborn as sns from matplotlib import pyplot as plt SALIDAS = 'C:/Users/ferfo/Desktop/' datos = pd.read_excel('C:/Users/ferfo/Desktop/Distribuciones/prueba.xlsx') datos1 = pd.read_excel('C:/Users/ferfo/Desktop/Distribuciones/lineas.xlsx') sns.set_style('darkgrid') fig, axes =plt.subplots(2,2, figsize=(10,6)) sns.ecdfplot(ax=axes[0,0], data=datos) sns.histplot(ax=axes[0,1], data=datos, fill = True, common_norm=False, alpha=0.2, linewidth=2, element="step") sns.lineplot(ax=axes[1,0], data=datos1, markers=True, dashes=False,) sns.barplot(ax=axes[1,1], data=datos, ci = "sd", capsize=0.1, ) axes[0,0].set_ylabel("Probabilidad") axes[0,0].set_xlabel("mm/día") axes[0,0].set_ylim(0, 1.1) axes[0,0].set_yticks([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1]) axes[0,0].set_xticks([0,50,100,150,200,250,300,350]) axes[0,1].set_xticks([0,50,100,150,200,250,300,350]) axes[0,1].set_yticks([0,50,100,150,200,250,300,350,400,450,500]) axes[0,1].set_ylabel("Frecuencia") axes[0,1].set_xlabel("mm/día") axes[0,1].get_legend().remove() axes[1,0].set_yticks([0,50,100,150,200,250,300]) axes[1,0].set_xlabel("Meses") axes[1,0].set_ylabel("mm") axes[1,0].get_legend().remove() axes[1,0].set_xticks([1,3,5,8,11]) #axes[1,1].set_yticks([-10,30]) axes[1,1].set_xlabel("Producto") #axes[1,1].set_ylabel("mm/día") fig.suptitle('lomitas, 2001-2020', fontsize=20) plt.show() fig.savefig(SALIDAS + 'graficos', dpi=600, bbox_inches='tight') prueba.txt This is my data: https://drive.google.com/file/d/1TSwulKNFerHMvv5Mdhc_m1zqwRac0lYj/view?usp=sharing The first 1000 rows (that will fit on SO), out of 1831. Observed data,Imerg data,Persiann Data 33.0,12.70423317,65.75 12.0,13.56632233,31.32 4.0,21.09570122,43.52 1.0,9.74461746,5.77 17.3,1.820376158,6.55 18.0,5.2507658,61.730003 2.0,8.476202965,14.250001 40.0,3.271785736,8.710001 1.0,9.8995018,25.009998 24.0,8.377342225,22.08 1.0,13.10612583,13.53 3.0,7.375349045,14.24 7.0,41.91541291,3.44 68.0,26.54439736,57.81 15.0,4.023840905,2.65 2.0,6.984012125,14.709999 50.0,13.24643517,2.61 35.0,2.314537525,62.61 22.0,4.787216664,47.95 23.0,6.563237665,80.09 41.0,26.61835861,2.73 52.5,87.12622835,35.05 21.0,20.77411652,4.5 5.0,39.9513588,2.77 21.3,34.07968521,46.68 4.0,4.571947575,2.94 21.0,7.785022735,11.190001 7.0,24.5557766,6.7700005 2.0,14.00565529,2.15 14.0,6.835758685,3.9299998 6.0,13.60206604,1.5 1.0,31.71725464,19.919998 7.0,3.962635517,33.16 20.2,1.291003466,12.959999 20.0,55.3718796,1.03 10.0,1.06314838,150.06 2.0,1.467782021,8.41 5.8,4.719767094,7.9300003 2.0,2.669240952,2.72 10.0,17.57000542,17.4 1.0,1.548810959,2.03 8.0,1.151179791,1.37 3.0,20.55989838,3.85 9.0,2.467414141,1.9200001 2.0,1.306825042,2.07 8.0,1.14,2.69 2.0,1.127427101,14.9800005 18.0,1.399605274,2.4500003 10.0,6.10573721,2.1100001 8.0,2.593387604,4.76 16.0,1.714526534,5.64 20.0,7.021852015,1.24 49.0,1.874579191,1.54 3.3,1.057072401,2.88 16.0,5.83480644,3.24 8.0,3.455219269,5.8599997 8.0,1.475891114,2.72 28.0,6.827443125,8.690001 13.0,18.33798981,2.26 4.0,6.57049513,4.49 2.0,31.0540371,1.25 35.0,53.7753334,1.3299999 11.0,21.80572129,2.3899999 6.5,34.6747551,3.56 33.0,1.931889653,2.33 13.0,12.64225388,3.62 5.0,8.975834845,2.33 37.0,1.71813643,15.01 8.0,4.632123471,5.06 16.0,20.17470742,1.51 11.0,27.08102036,3.59 2.0,2.386453629,4.99 1.0,1.059182048,1.5600001 21.0,26.59081078,4.0099998 2.0,12.13219738,7.1099997 45.0,1.741666675,3.78 11.0,1.191877246,2.83 8.0,1.437874556,4.38 36.0,4.313007832,1.56 23.0,43.39625931,2.3700001 1.0,4.652664662,1.39 44.8,2.123159409,7.83 2.0,1.013100386,4.0 4.0,3.444443941,5.9900002 3.0,1.029917956,1.6299999 3.0,64.20615385,1.46 14.0,2.552409411,1.75 15.0,1.070342303,22.1 20.0,19.51611519,14.44 34.0,11.814847,9.370001 20.0,3.378883601,31.640001 17.0,4.592389584,4.62 2.0,5.184751985,4.04 12.0,1.251710058,8.940001 31.0,1.20076859,20.54 3.0,2.656115532,16.52 12.0,3.296927929,22.5 11.0,6.101575375,8.24 37.0,1.621261239,16.720001 47.0,3.146972418,25.58 8.0,23.63509369,3.3600001 5.0,4.09155941,3.7999997 13.0,4.080201626,1.9300001 25.0,13.95099068,13.62 28.5,9.444846155,7.8 4.0,27.48032952,1.25 4.0,38.84066773,42.8 6.0,1.212481141,19.18 5.0,1.080495119,4.09 20.0,40.26078034,2.59 7.0,2.846819878,9.09 4.0,54.2149887,3.52 8.0,13.21701241,18.25 4.0,3.699003458,1.59 5.0,4.130330563,13.790001 5.0,20.58119202,6.25 5.0,6.42111683,4.21 44.0,4.309965134,1.56 10.0,4.79896164,2.24 3.0,7.026090145,1.5999999 3.0,2.08438778,6.4399996 3.0,25.36527062,3.0900002 22.0,24.76248741,23.900002 2.0,26.50693512,56.08 1.0,32.33215714,18.52 4.0,28.11775589,1.8699999 17.0,1.378523588,7.12 11.0,3.523523569,22.32 30.0,5.69707489,16.54 29.0,27.38665581,9.93 1.0,38.52075959,46.18 3.0,1.750359059,4.9399996 1.0,14.85701275,1.88 2.6,41.54547501,37.92 28.0,1.331750036,5.47 16.0,14.75776387,54.08 6.0,3.94290042,13.11 34.0,21.99007416,5.43 12.0,21.82343102,9.42 8.0,2.251169443,18.39 5.0,3.715127945,10.76 24.0,11.68067074,14.76 1.0,8.149575235,10.639999 9.0,3.602071047,11.530001 35.0,35.90866089,27.52 2.0,1.736975193,23.21 8.0,5.936116695,14.05 1.0,2.024060011,24.670002 3.0,7.263765335,21.99 14.0,1.832577467,12.419999 12.0,4.149312973,14.73 15.0,1.578367353,9.52 1.0,1.461082697,3.79 3.0,1.300221563,2.6699998 4.0,3.882947684,6.3 23.0,1.156816244,1.5699999 31.0,1.774330497,3.9099998 1.0,1.081079126,9.86 21.0,63.7815933,1.1 7.0,5.40561533,3.1 38.9,1.916676522,1.3499999 1.0,1.694874764,1.21 2.0,1.020053149,2.6799998 1.0,3.230535031,72.840004 18.0,2.468552113,3.8899999 47.0,2.557238341,1.9 3.0,2.99013114,3.03 1.0,1.321612239,1.81 15.0,11.32548142,1.2 5.0,1.680747986,1.92 2.0,4.724195004,3.9 1.0,3.12424779,2.5700002 1.0,19.96909905,11.53 2.4,38.93196869,1.54 3.0,6.141599655,1.24 2.0,10.2309351,2.06 2.2,1.496399522,1.99 3.0,14.13191891,4.8900003 3.0,6.556683065,2.02 1.0,2.044409514,1.8 7.0,13.88462162,6.32 2.0,2.669220686,2.21 4.0,9.125458715,1.6700001 1.0,5.971014975,4.23 2.0,24.87825394,8.09 40.0,4.818218708,4.5899997 1.0,1.526267767,22.439999 42.0,12.33635044,1.3199999 14.0,6.067589285,7.02 5.0,4.542275429,9.35 14.0,15.26683712,1.36 3.0,2.287184716,1.6099999 27.0,13.89541149,6.42 9.0,2.849863529,5.52 16.0,4.114969254,6.3199997 5.0,2.60952878,2.6299999 7.0,25.81751633,1.12 22.0,7.642860415,54.38 61.0,14.60452652,2.99 3.0,2.860728264,1.4300001 38.0,13.65011311,2.05 24.0,4.403223992,4.0699997 8.0,16.61255455,5.7299995 15.0,1.931255818,1.6700001 4.0,12.71534157,4.97 2.0,13.96313668,1.74 2.0,4.058600903,4.7799997 4.0,4.762280464,2.69 12.0,9.048459055,2.84 7.0,2.783326626,2.87 24.0,2.251889944,5.2999997 17.0,12.83441448,4.16 29.0,11.20629025,1.34 37.0,28.90879059,1.22 4.0,1.714102268,23.29 2.0,1.729247093,1.87 7.0,11.54702091,102.02 14.0,1.603832722,1.26 4.0,48.88271332,3.4900002 5.0,3.357400656,1.33 9.0,26.58070755,1.3499999 7.0,1.279444337,11.709999 52.0,7.07122135,6.92 21.0,4.065811158,1.55 8.0,1.305071712,3.3400002 2.0,33.32134629,34.989998 1.0,25.21928978,5.46 1.0,7.68272543,3.69 8.0,4.058069229,12.27 14.0,1.392273307,31.66 27.0,1.614271045,2.51 1.0,1.43,24.939999 5.0,1.564941883,2.76 1.0,5.490926745,19.510002 2.0,2.741349459,8.51 4.0,1.820300937,7.93 7.0,1.200169325,9.7 27.0,1.227725864,3.3899999 53.0,1.409593702,1.26 13.0,1.020598889,11.91 2.0,1.532613397,10.45 6.0,2.150630713,51.839996 2.0,9.32765293,1.0999999 3.0,3.207234144,27.57 32.0,1.102299214,36.58 4.0,11.28597355,9.549999 1.0,32.67594147,2.3 5.0,17.2740078,15.48 42.0,3.444516182,6.82 10.0,2.200684548,7.47 2.0,42.5202179,30.38 6.0,1.706894517,21.759998 2.0,14.07932759,18.81 11.0,4.025928021,9.6 25.0,16.11277199,2.11 17.0,6.93875265,1.03 9.0,4.846222401,10.18 31.3,1.64617455,6.8199997 18.0,1.422170997,14.7 3.0,2.14275384,16.5 42.0,20.2088604,4.75 28.0,16.17591286,24.34 113.5,1.768956781,5.91 27.0,7.651679995,13.950001 16.0,62.23706435,1.66 40.0,3.120871783,9.92 5.0,1.11462462,1.3499999 25.0,17.13158798,31.470001 1.0,35.90638352,3.34 1.0,11.49289704,30.420002 2.0,1.723016501,3.0900002 7.0,1.727642894,1.8199999 62.5,15.11504936,3.46 15.0,12.78649616,15.449999 6.0,1.142826557,2.9 2.0,4.31261921,1.44 2.0,19.54297829,1.8 5.0,21.42444229,1.17 9.0,1.985171438,5.24 4.0,38.83046723,1.53 3.0,24.3289547,2.63 28.0,21.55071259,8.26 3.0,20.35590744,5.58 18.5,17.1479969,20.69 1.0,2.328164578,6.65 77.0,6.90966034,1.5999999 3.0,8.87460327,4.1 6.0,19.85622978,5.88 18.0,11.50050545,8.62 1.0,2.399034024,4.4399996 13.0,17.8201561,7.3199997 1.0,63.47223665,5.11 5.0,10.70358849,1.9399999 4.0,1.303659797,1.14 5.0,7.051344395,1.2 2.0,1.317322851,2.83 2.0,1.153054357,20.35 1.7,1.288836599,1.0 3.5,6.40096426,2.18 4.7,10.61519242,3.25 2.0,38.07836151,1.4499999 1.0,1.00505364,1.06 5.0,4.601175309,14.140001 13.0,1.059544564,1.11 50.0,1.025045872,1.08 2.4,2.140906573,24.24 5.0,11.28417015,6.04 2.8,1.706882835,1.6299999 15.5,63.1325226,5.55 17.0,5.925836565,2.69 3.0,1.94356668,5.5099998 4.5,9.45316124,12.35 36.0,2.504364014,1.73 1.0,1.470301152,2.85 1.0,1.242533088,3.36 12.1,1.670167685,3.0299997 5.0,57.5176239,1.06 15.0,1.107224822,3.8200002 5.0,3.0542202,6.79 3.0,2.898064137,4.32 7.0,30.05044174,1.75 3.0,3.427459955,1.1800001 4.0,4.624752045,1.04 2.0,11.62128449,1.5600001 8.0,6.490193845,3.7 2.0,1.937290669,2.6000001 7.0,8.65875244,1.4100001 52.0,1.299692512,1.69 5.0,1.855275035,48.739998 1.0,3.769208908,7.24 7.6,4.55385828,6.29 3.5,6.51372051,1.71 1.3,8.0854969,1.21 22.2,1.507522464,109.61 22.5,9.14739609,8.1 7.5,27.17226029,6.6499996 2.0,32.79916382,6.2500005 1.0,1.280574084,1.05 3.5,26.51655007,1.08 2.5,2.701778889,3.1100001 1.0,5.269325735,2.01 8.0,30.63650131,1.4300001 20.0,71.78442385,27.51 32.0,1.373457909,28.66 3.0,12.21031952,21.530003 61.0,35.02967835,2.9800003 7.0,14.67937184,4.88 3.5,4.434751988,2.06 2.0,11.85890293,6.34 35.0,25.02809716,3.44 11.0,3.947379113,21.65 4.5,3.420857191,6.13 31.0,2.146751881,47.380005 2.0,21.10358238,82.47 15.0,2.37749362,6.38 38.0,11.68755818,2.21 6.0,2.17284298,63.430004 21.0,7.695138455,60.98 3.0,11.97859764,30.349998 2.0,14.64129257,1.68 6.0,5.88892269,4.81 13.0,1.734639526,24.029999 5.0,4.035034657,23.36 1.7,1.285043836,1.87 1.5,1.238770008,24.31 5.5,19.83879471,2.27 9.2,4.221150399,10.42 8.0,23.05646897,13.280001 2.0,1.394252658,17.740002 16.0,7.788359165,2.06 4.0,6.4100194,21.4 16.0,67.55716705,11.23 21.0,1.351992965,61.07 5.0,5.084335325,45.9 12.0,12.95212364,4.08 23.0,25.68342018,4.21 6.0,1.988664508,9.7 3.0,3.016326189,10.969999 8.0,2.866974354,25.95 1.0,2.696616888,2.54 1.0,1.581075788,2.5 41.0,2.780577898,4.09 8.0,1.417200446,26.240002 4.0,1.385309816,7.45 10.5,7.5372777,12.17 16.0,7.932168005,69.51 18.0,1.451128483,10.07 11.0,1.840451598,3.63 17.0,1.065397263,2.3 26.0,4.893643856,2.9599998 1.0,1.452208638,2.23 19.0,37.93759156,3.18 4.0,12.90710354,5.83 37.0,6.14060068,1.39 16.4,8.097572325,3.87 5.4,23.57411003,1.8499999 1.0,6.214107035,11.530001 2.9,6.978374005,1.76 5.5,43.03276825,2.3600001 1.0,1.466169358,6.4300003 1.0,1.140809417,3.33 21.5,1.293450475,10.71 7.6,3.49955225,2.32 2.0,14.28147984,1.7900001 1.0,3.699310303,34.33 12.0,4.277731419,2.23 45.0,5.301327705,1.99 69.2,7.982951165,10.09 8.6,3.936149597,10.08 1.0,1.424581647,2.6699998 9.2,4.491571904,46.879997 17.5,2.771928311,1.0 20.0,9.17326832,4.99 3.1,2.072081805,1.12 7.0,5.55553627,1.27 32.7,14.50772381,2.66 26.0,2.33113885,2.65 2.5,5.78749275,48.21 27.3,11.18823529,5.89 49.5,5.236501695,17.56 2.5,7.31285858,8.110001 24.0,1.520752192,1.1600001 9.7,9.462599755,1.9200001 1.6,20.17654228,1.72 3.0,10.11459542,4.84 8.6,27.88303757,4.3 21.0,12.77318192,1.93 1.5,1.652448058,2.9099998 2.3,2.164780855,5.19 1.2,5.11115074,2.9099998 3.1,4.954486847,6.77 4.9,1.114153981,2.13 1.0,2.178640366,2.49 3.8,3.012405396,33.73 22.8,51.1032982,36.66 65.5,11.25961972,72.69 3.0,6.713029385,5.6 14.2,2.496469736,3.9700003 4.0,12.115098,37.68 9.3,2.551826239,2.21 18.2,14.48979855,3.06 24.0,7.24518347,1.51 1.3,21.97145844,79.93 11.3,5.81929302,29.16 2.0,35.17000199,1.5 2.0,21.69516754,10.809999 17.9,8.1897316,2.9 15.0,15.60975838,28.07 33.0,3.585752011,17.85 18.1,7.03698683,26.3 1.0,15.85383892,1.96 5.0,8.665060045,20.49 10.0,5.237526895,7.74 3.0,9.37757492,8.4 11.0,2.525708676,1.0699999 33.0,1.059689999,6.8199997 5.0,1.390462637,62.05 9.0,2.451468468,2.9699998 42.0,1.846368075,12.53 3.0,1.235369563,23.34 3.0,1.421132684,1.9200001 5.0,1.591700435,18.150002 21.0,1.431996823,8.74 3.0,3.120195151,3.44 4.0,10.05565357,9.03 3.0,1.057814002,14.1 22.0,8.63092613,5.19 45.0,11.97591305,42.8 24.0,1.507814646,13.559999 34.0,6.692327025,48.93 8.0,2.86255455,3.81 24.0,3.043321371,25.85 8.5,3.122832775,23.18 1.5,11.90790558,13.000001 9.3,8.271219255,110.89 3.0,14.87175751,5.38 3.5,47.65599442,14.65 11.7,6.447260855,4.29 2.5,16.07569123,8.72 7.0,6.27013159,12.32 3.5,35.76211167,6.0299997 6.0,26.0370102,4.59 1.8,6.6210227,2.03 14.5,6.33511257,1.05 2.5,32.02148819,3.72 5.1,1.203332901,1.84 11.3,11.10483933,1.02 5.3,3.092888594,5.2300005 14.0,41.64496613,3.4299998 4.0,9.58962822,5.64 20.0,1.257387281,4.42 18.0,16.84815598,1.6800001 15.0,15.92509461,3.3799999 5.0,39.24178314,1.0400001 12.0,28.16544533,2.4299998 7.5,4.047671795,5.16 2.0,2.273884535,1.99 11.0,8.58615303,5.0 27.7,22.31294441,1.3499999 2.0,9.67351246,1.05 6.0,17.06152153,2.33 3.0,9.642523765,23.4 25.5,1.165874005,27.91 35.0,11.69623184,52.79 47.0,38.67126847,3.86 2.3,61.18006515,1.7 1.0,7.492923735,1.53 13.5,12.18782616,2.0900002 10.0,17.36215019,10.040001 16.2,9.499432565,2.15 26.0,9.225958825,46.11 1.3,39.28028488,2.56 7.6,3.471356869,1.97 8.5,8.659394265,9.45 17.0,4.660372734,10.440001 36.0,61.9743538,3.2599998 21.7,12.09271908,3.6699998 47.0,24.33893013,4.51 21.0,6.91462612,3.37 27.0,2.297224999,1.51 5.0,1.394450546,1.3599999 5.0,16.00174332,3.46 2.0,14.10092736,11.889999 4.0,22.22217942,1.04 9.0,67.13967135,31.410002 6.0,4.184929371,1.4599999 4.0,6.180713175,19.4 2.0,3.645504713,6.21 5.0,24.17942238,5.4 1.0,11.77395439,11.450001 6.0,16.84624863,5.58 2.0,9.62325859,10.45 6.0,16.02267838,11.73 21.0,13.3161335,6.73 16.0,1.80894053,3.33 4.0,5.394687655,48.8 5.0,24.77208328,17.82 7.0,17.31050492,5.4999995 4.0,9.31569481,96.34 2.0,11.5558157,9.599999 45.0,21.96049881,12.68 34.0,1.795776129,12.01 3.0,4.568071366,2.1299999 64.0,8.809449195,6.38 28.0,17.17154122,14.49 8.0,3.798393965,6.1900005 2.0,3.239580393,14.32 23.0,7.43819666,2.98 3.0,2.554473639,6.05 2.0,7.20397377,3.35 24.0,21.64646912,1.23 28.0,6.8011055,1.65 27.0,51.22446825,1.71 53.0,2.336632967,3.22 14.0,1.857179165,14.05 3.0,3.921233416,14.67 2.0,8.250204085,6.05 33.0,36.43959427,4.37 3.0,35.4586258,2.12 5.0,2.924695492,2.04 17.0,3.519897938,6.7200003 18.0,57.69216535,20.48 11.0,6.79311371,8.83 4.0,2.43661356,10.25 37.0,5.926236155,1.97 2.0,2.30543375,1.2900001 18.0,21.94180298,10.57 1.0,21.24626732,36.19 7.0,4.31278801,3.73 1.0,6.77379656,5.2799997 2.0,5.612919805,17.69 10.0,5.471610545,1.8199999 3.0,5.3090024,2.59 15.0,2.189461708,24.79 20.0,4.415833473,9.45 33.0,2.321558237,9.4 3.0,5.695771215,3.13 44.0,13.87459469,14.059999 14.0,2.366339445,3.52 2.0,3.329537154,5.53 3.0,1.751751542,32.37 4.0,7.689642905,10.49 4.0,1.51193893,1.35 2.0,1.155116558,1.42 1.0,1.199524403,61.78 10.0,3.710379839,7.83 5.0,1.770510078,4.82 10.0,1.905061603,30.7 8.0,5.34256077,27.550001 23.0,1.739247799,76.08 34.0,38.56280136,32.3 1.0,6.42942953,3.15 1.0,11.48092175,62.170002 39.0,2.078872204,3.92 11.0,19.59555435,10.219999 6.0,6.19163275,43.309998 4.0,5.939269065,1.3 3.0,22.87758637,10.98 3.0,2.864192009,1.45 7.0,48.72347641,21.2 8.0,3.442718983,89.59 2.0,7.616796495,10.110001 1.0,2.508226633,2.96 5.0,6.681570055,75.770004 44.0,2.179568291,1.4200001 3.0,2.951803446,10.48 4.0,1.397823572,11.66 9.0,6.152549745,20.35 13.0,44.06642151,1.47 30.0,16.16477585,22.18 2.0,3.826816082,3.3700001 8.0,3.112096072,13.259999 1.0,6.575606345,1.8900001 17.0,1.482020021,48.0 10.0,2.736569643,4.2 21.0,2.932685614,4.33 43.0,9.989481925,1.64 6.0,13.08501339,21.89 28.0,2.157101155,2.53 12.0,1.35453558,132.59 18.0,21.74938965,87.01001 18.0,1.661110401,4.1499996 58.0,2.03024149,2.05 8.0,2.228796006,25.630001 3.0,2.194865465,7.07 29.0,7.931626795,32.85 5.0,7.26604271,17.970001 47.0,20.16017533,56.81 9.0,2.508003474,39.64 22.0,18.76267052,1.51 15.0,23.55038834,20.79 51.0,20.85602761,2.28 64.0,16.18298722,15.879999 2.0,37.16973496,2.93 6.8,10.7100668,1.7 2.0,2.656838179,6.0299997 1.7,8.5988245,4.49 8.8,3.148923874,5.21 4.0,1.364438057,5.59 2.0,2.821480751,2.04 10.0,8.46378422,6.04 20.0,2.713042021,17.470001 3.0,5.70679426,9.54 16.0,1.062875986,1.95 16.0,2.508112192,1.48 10.0,13.24829483,3.1599998 9.0,13.35315609,2.73 86.0,10.60771466,5.7699995 2.0,9.02454853,5.65 5.0,25.73985863,2.47 20.5,8.04908943,1.76 45.0,8.649107935,3.13 6.0,3.438475371,2.8000002 30.0,3.145784617,2.54 11.5,5.690588475,1.6 1.2,3.900574684,3.15 7.0,1.642292857,7.9700003 19.2,95.4910965,3.49 11.0,22.3479023,1.03 5.0,8.625390055,3.28 14.0,17.87278557,1.72 3.0,51.85173415,4.2599998 9.0,9.86716366,1.42 10.0,1.725934148,1.38 7.0,7.497133255,1.32 5.0,36.0772171,2.27 7.0,1.681801677,3.58 22.0,33.22405243,2.79 9.0,1.467683554,4.44 30.0,13.11451245,12.830001 3.0,14.44763184,1.38 3.0,19.91684342,9.0 10.0,41.07674408,37.51 27.0,21.05844116,29.219997 46.0,1.294272781,17.66 9.0,8.95629406,3.35 82.0,2.58863163,2.27 83.0,11.92989922,4.4 15.0,43.7828598,10.33 41.0,7.786485195,1.0600001 13.0,7.31237173,7.79 6.0,1.55503273,1.54 17.0,6.330646515,8.16 29.0,1.532290578,26.54 94.0,30.26382637,34.27 6.0,9.99059868,8.91 43.0,20.92362976,37.43 2.0,1.524400234,30.09 29.0,2.260905266,15.21 61.0,26.32531929,18.919998 11.0,2.334921837,32.82 9.0,9.19584751,59.58 15.0,2.663776636,14.78 28.0,1.73086071,1.3199999 21.0,1.000801564,2.01 7.0,7.184841155,11.57 1.0,16.885458,2.44 1.0,9.996009825,11.049999 11.0,29.07500458,4.76 7.0,28.82209015,1.02 3.0,4.637232781,3.1100001 2.0,2.153310299,30.399998 1.0,2.010419369,45.55 8.0,26.56690979,2.47 16.0,1.144513488,4.73 21.0,1.671649695,6.7600007 3.0,1.65417099,8.87 5.0,4.671144009,5.95 27.0,2.909118414,3.32 4.0,8.24102974,13.8 4.0,2.693380595,14.49 21.0,3.064752341,7.7699995 2.0,8.33625126,1.2 23.0,24.75660515,21.239998 15.0,14.11971665,104.16 107.0,4.368866444,2.97 30.0,3.136216641,1.24 7.0,1.182296515,1.54 19.0,2.363009453,6.37 24.0,67.74961855,7.33 30.0,5.13684225,1.66 24.0,4.606848717,1.3800001 18.0,6.117928505,1.06 15.0,7.6142869,1.75 11.0,7.933288095,3.62 2.0,4.611485005,12.22 73.0,2.199810028,5.0099998 32.0,29.52713013,2.47 10.0,1.146588326,12.360001 2.0,2.026584387,1.8199999 11.0,1.142000914,4.53 57.0,11.43570423,12.92 7.0,43.80160141,1.77 10.0,1.085262776,13.07 7.0,2.720019579,7.9700003 49.0,3.989929915,5.35 2.0,2.600961924,1.08 4.0,6.558179855,1.35 3.0,9.41394329,3.7799997 2.0,6.647725105,5.58 1.0,38.19209671,4.21 5.0,4.519927502,5.95 18.0,3.880130053,1.11 9.0,1.045809627,1.53 37.0,2.701902867,1.0 4.0,6.56444454,1.44 5.0,3.529962302,4.21 25.0,19.17519951,2.39 7.0,1.562627673,1.54 1.0,39.37012863,2.31 12.0,16.47767449,1.9499999 1.0,58.903965,5.2200003 1.0,16.95523072,1.9 9.0,3.100278616,2.21 12.0,45.80677033,1.0699999 4.0,26.81613541,1.35 1.0,3.593140841,2.04 5.0,1.917018533,14.929999 28.0,2.88641119,5.74 2.0,34.33824539,3.42 2.0,2.267287493,11.120001 19.0,7.366959095,2.5 10.0,70.9339676,2.44 9.0,19.76496125,1.34 4.0,2.355486632,5.45 1.0,4.309099198,8.219999 1.0,2.074670315,13.22 2.0,1.886642456,2.85 14.0,40.44182587,2.05 5.0,32.99110413,23.02 5.0,1.268943787,6.58 4.0,2.145960093,1.3 5.0,1.39419365,2.2 20.0,1.174509287,1.18 11.0,2.198520899,14.9800005 6.0,2.230074644,19.82 6.0,6.072119235,1.45 1.0,4.664021969,3.4100003 4.0,2.227411747,3.12 7.0,2.113803625,16.439999 14.0,6.688260555,6.2200003 39.0,1.226664901,2.26 21.0,3.213046551,21.76 40.0,1.002687574,6.41 30.0,1.483391285,43.269997 7.0,13.00875283,7.74 6.0,2.928070784,2.54 6.0,31.15128517,21.2 15.0,9.223342895,13.26 17.0,59.55508805,1.42 16.0,1.27139616,5.62 42.0,2.204371214,5.0699997 2.0,2.447686196,2.46 4.0,14.17787552,35.41 4.0,43.20114517,3.27 5.0,36.44638825,21.529999 10.0,14.93710041,41.4 8.0,8.20574093,1.4200001 12.0,1.637166262,5.71 33.0,1.203313589,3.8300002 41.0,21.69332695,32.79 25.0,4.260479927,21.29 9.0,2.558784724,38.98 25.0,3.04798007,5.02 4.0,3.111752034,31.34 4.0,6.786047935,24.27 7.0,8.4459219,4.18 26.0,11.70038319,31.630001 51.0,3.495490313,1.24 5.0,4.241265774,1.4 11.0,4.8981843,7.13 13.0,9.211686135,2.54 50.0,12.39083863,8.24 19.0,9.209892275,9.120001 83.0,2.324657202,10.95 23.0,9.65412903,9.49 21.0,31.06323052,2.95 38.0,1.128272534,1.1 1.0,2.512983084,1.8299999 5.0,16.3822918,1.3 3.0,11.90946579,1.63 6.0,7.08117676,1.01 2.0,19.39507294,2.15 15.0,19.04957772,1.14 5.0,53.11849215,4.01 25.0,42.92922592,1.77 6.0,14.9218731,1.3599999 1.0,21.0775013,1.72 6.0,32.00092316,1.38 5.0,1.04565537,1.4200001 11.0,12.34065342,1.53 8.0,39.12719345,2.82 20.0,21.81253624,1.4 2.0,33.09275818,2.6599998 6.0,1.996003509,2.35 4.0,10.73557759,9.23 20.0,3.835647583,1.13 3.0,11.55557251,1.18 18.0,58.3459854,2.71 2.0,63.196373,1.76 2.0,3.220089197,2.6799998 20.0,23.93250275,2.54 38.0,2.286283016,7.25 2.0,1.07400322,11.82 2.0,59.8628502,2.29 30.0,2.739398718,3.05 3.0,23.52008248,10.07 2.0,7.707740785,2.71 8.0,10.88557053,1.12 12.0,2.47727871,17.189999 10.0,6.07909584,2.24 9.0,3.649833203,1.7700001 4.0,32.12921524,2.2399998 19.0,1.531433821,1.25 22.0,1.535874009,1.23 11.0,1.569700599,9.17 42.0,2.108448267,6.5999994 11.0,77.33182525,2.2 8.0,3.344490767,1.5899999 4.0,9.55613613,3.1 10.0,4.887585163,9.41 18.0,35.29027939,1.22 2.0,2.152896881,2.17 25.0,2.639908314,6.58 7.0,1.753674388,22.89 2.0,37.65769196,22.029999 10.0,2.503957987,4.27 19.0,2.736332894,2.92 2.0,2.734235764,4.6400003 5.0,34.71192932,30.09 2.0,79.5751724,22.71 28.0,15.41206646,1.74 1.0,30.84560204,20.79 1.0,1.311088205,75.11 3.0,24.92964554,2.2 22.0,29.93969918,27.46 5.0,27.75062371,26.349998 3.0,31.69940377,30.82 1.0,3.944314957,2.4499998 2.0,1.557312489,50.29 13.0,1.235749007,4.5899997 3.0,12.3859272,42.89 6.5,38.85156632,2.64 17.0,6.500573635,12.950001 13.0,38.20243073,60.57 6.0,22.09395218,46.91 5.0,29.17655945,15.75 10.0,1.43235457,6.68 6.0,4.367777825,10.860001 40.0,5.10657072,17.16 20.0,12.44417382,5.5600004 15.0,1.133333683,20.51 2.0,2.290113449,4.52 2.0,59.1026268,37.29 1.0,8.303461075,8.29 2.0,1.454311133,12.51 1.0,6.68616104,14.710001 4.0,1.05869627,1.99 3.0,7.288159845,9.14 19.0,4.696534157,2.97 11.0,1.543948889,61.05 16.0,1.902146697,11.7 4.0,10.61460114,8.91 4.0,10.18768692,1.16 4.0,11.54320431,5.18 15.0,4.913286686,3.13 7.0,4.915909291,1.14 5.0,1.031675935,9.58 7.0,3.898350954,29.689999 35.0,34.91336441,6.7200003 17.0,18.01113892,5.75 2.0,2.833272219,13.74 28.0,5.176920415,6.09 5.0,16.68647957,7.79 9.0,9.293769835,17.48 15.0,4.145808697,1.03 5.0,19.18017769,36.120003 29.0,2.869644404,5.0299997 25.0,7.71194124,1.3900001 21.0,1.118057967,4.15 4.0,1.011766196,1.24 3.0,4.288121224,1.59 15.0,18.01800728,11.950001 17.0,2.095095396,4.27 21.0,5.09799528,1.21 4.0,3.605466366,2.26 5.0,4.272053242,1.4399999 20.0,1.356512428,1.71 19.0,4.395007611,3.11 2.0,16.10503197,2.2400002 59.0,8.85128689,2.54 2.0,3.780042649,2.44 18.0,25.41714287,2.6 21.0,18.50357628,2.6100001 23.0,12.17268467,9.51 12.0,1.71827972,1.46 20.0,1.340227962,4.1 10.0,4.668937683,2.88 4.0,1.653563857,13.76 3.0,11.45629502,2.8600001 40.0,23.80907822,3.53 4.0,8.023687365,1.54 25.0,13.02610493,10.79 2.0,10.09106159,3.98 40.0,1.432140589,1.05 36.0,49.78308106,1.5999999 31.0,25.32273484,28.27 4.0,10.05254841,1.79 25.0,12.45585251,4.94 25.0,7.96915245,3.36 16.0,4.125425816,5.0299997 2.0,17.35515785,7.01 20.0,2.154047728,43.85 15.0,1.133311153,1.3599999 20.0,6.99955845,3.4099998 25.0,7.06923151,13.52 9.0,2.061743498,11.83 6.0,15.1108923,5.86 6.0,3.659174204,8.83 21.0,25.09469795,63.71 12.0,12.78966046,1.03 7.0,3.70449996,4.68 2.0,81.32299805,1.62 10.0,1.47226286,2.44 11.0,1.767955542,4.1099997 9.0,14.35262299,4.1800003 2.0,26.53904343,7.3300004 7.0,29.06570626,1.6500001 10.0,1.977015496,24.59 3.0,4.072252751,29.779999 4.0,56.03784945,74.07 29.0,50.3431473,14.5 2.0,2.982461214,1.08 1.0,1.07741952,3.1200001 2.0,23.38036537,10.590001 1.0,19.09048653,55.350002 1.0,41.51933289,5.07 1.0,5.85829115,1.5 3.0,81.27360535,6.6 16.0,7.64243841,4.65 2.0,32.28141022,13.530001 40.0,2.746798277,7.29 3.0,1.134368301,1.86 1.0,1.18452096,1.29 4.0,11.01940632,14.890001 44.0,2.367835284,45.96 6.0,9.290693285,8.3 13.0,6.92009163,1.75 10.0,12.8741827,5.77 5.0,7.534250735,2.24 21.0,14.394454,1.32 20.0,6.47271347,1.48 12.0,1.485815168,1.3 29.0,1.470686913,2.6499999 46.0,2.631582499,13.61 22.0,3.658107281,1.3499999 8.0,3.507339239,2.4399998 11.0,9.38621521,1.08 21.0,1.363355041,5.6800003 2.0,2.211771965,2.9899998
Newly Data Points Hidden Behind the Previously Plotted data in Plotly in the same graph -- plotly.express as px, and plotly.graph_objects as go
I am plotting some data points on a graph. Output: Now, I plotted some ambulance locations (Dataset is in two excel files) Does not work As we can see above, the new plotted data as ambulance location is hidden due to previous plotted data. How do we solve this? Here is my code (Dataset is in two excel files): import plotly.express as px import plotly.graph_objects as go import numpy as np import pandas as pd import matplotlib.pyplot as plt import geopandas as gpd from openpyxl import load_workbook import numpy as np import pandas as pd from mplcursors import cursor import numpy as np; np.random.seed(0) import seaborn as sns; from matplotlib.pyplot import figure import pandas as pd import numpy as np import io file_loc_1 = "AgeGroupData_time_to_treatment.xlsx" df_centroid_Coord = pd.read_excel(file_loc_1, index_col=None, na_values=['NA']) df_centroid_Coord file_loc2Amb = "Ambulance IDs.xlsx" df_station = pd.read_excel(file_loc2Amb, index_col=None, na_values=['NA'], usecols="A:D") df_station.rename(columns={'Longtitude':'x', 'Latitude':'y'}, inplace=True) df_centroid_Coord['Ambulance_Treatment_Time'] = df_centroid_Coord ['Base_TT'] fig = px.scatter(df_centroid_Coord, x="x", y="y", title="Southern Region Centroids", color='Ambulance_Treatment_Time', log_x=True, size_max=60, color_continuous_scale='Reds', range_color=(0.5,2), ) fig.update_traces(marker={'size': 4, 'symbol': 1}) fig.add_trace(go.Scatter(x=df_station['x'], y=df_station['y'], mode='markers+text', text=df_station['Ambulance station name'], textposition='top center', showlegend=True, marker=dict( size=12, symbol=2, color='black' ) ) ) fig.update_layout(width=1000, height=800, paper_bgcolor="LightSteelBlue") fig.show() Working Code: (Dataset is inside code) import plotly.express as px import plotly.graph_objects as go import numpy as np import pandas as pd import matplotlib.pyplot as plt import geopandas as gpd from openpyxl import load_workbook import numpy as np import pandas as pd from io import StringIO import numpy as np; np.random.seed(0) import seaborn as sns; data = ''' x y Base_TT 14.1315559 55.75811117 1.871884861 14.66228957 57.02751992 1.599971112 14.49407157 56.06563489 1.307165278 13.21996788 55.4786748 1.411554445 14.00501286 55.72120854 1.968138334 12.73736102 56.71097302 1.309849028 14.56668525 56.74872925 1.719116945 13.24138764 56.41359089 2.000620417 14.94308088 56.54283706 1.668724723 14.5744739 56.05695327 1.266861528 13.06800876 56.6356658 1.58923875 14.69964193 56.47959746 1.960050139 13.02976922 55.48474858 1.2549575 13.16901029 56.23281882 1.429789167 13.05906805 55.85369617 1.553721944 13.7382052 55.60193648 1.326429166 13.72987233 56.34767237 1.709020555 14.58803736 56.29060354 1.444833472 13.1687123 55.90031115 1.527546805 15.02422205 56.27331725 1.692005 12.91010076 56.24668905 1.090544167 13.2053785 55.45149986 1.438993611 13.37256031 55.61560233 1.632310694 13.26737288 56.19829081 1.869085 13.23818589 55.42501479 1.646565973 14.50187617 56.70356708 1.880334584 14.70189174 56.19209891 1.31886875 13.34482545 56.27124013 1.81529125 12.8785792 55.94059005 1.418415555 12.93136079 55.85161507 1.40189875 12.89164916 55.99473803 1.45182125 13.10496461 56.22286779 1.456101528 15.38666411 56.9824605 1.922860277 13.32430726 56.00137807 1.941762638 13.51541698 56.45311516 1.768057778 15.0413443 57.17170192 2.024309722 12.8606001 55.97622841 1.401550417 13.46749777 56.03019927 1.883145 14.72922746 56.88394501 1.273883612 14.55821135 56.07486606 1.331545972 12.93914018 56.60663923 1.351015694 13.9743559 55.67602686 1.874753334 14.64564524 57.04544092 1.668993889 12.66824186 56.24236656 1.333240139 14.0105656 56.75454085 1.378468056 13.60274138 55.39377504 1.582678472 15.75049672 56.25307533 1.564625833 13.60115485 55.43869065 1.577717361 15.7653804 56.19008971 1.372651944 13.1832264 56.95189695 1.748949583 15.60524952 56.25387079 1.3378925 14.23746798 56.04634612 1.200910417 14.35058672 56.00206764 1.385281667 13.60986899 56.97533616 2.631095833 13.45346163 56.38047383 1.811332917 15.3486521 56.43454959 2.049025556 12.83048942 56.22734439 1.118363333 13.84310479 56.34878109 1.626188472 13.03675856 55.97916057 1.681367638 14.42929903 56.1012924 1.947557639 13.2062902 56.12552876 1.535386944 13.34357303 57.04397378 1.86576 14.03682213 57.00630325 1.720512917 15.18750805 56.64153377 1.769290139 14.47260163 56.46087204 2.272563194 15.44375218 56.24557042 1.541445833 14.46883407 56.73038276 1.778631806 13.10870739 55.81852133 1.51138625 12.86285426 56.80305259 1.40997375 13.49439127 56.98298455 2.250301528 13.70360937 56.16769145 1.196677639 14.08919483 55.52417158 1.591170417 13.55740496 55.77068518 1.535861945 14.18123581 55.66859517 1.996627778 15.23403607 56.25512928 1.548016667 15.70489096 56.40608375 2.047458055 14.37376278 56.55025699 2.067875139 14.502587 56.64966538 2.082391666 13.02508849 56.832684 1.706181111 13.14274787 55.77410524 1.375705139 14.84565179 56.5068175 1.885311528 14.20034005 56.28870701 1.691717361 13.8812731 55.59433892 1.5328325 14.14035572 56.80042421 1.561514584 13.76343201 55.80887467 1.749841528 13.89449225 56.25041347 1.46041875 15.17289149 57.00988892 1.521688473 14.77824552 56.9199763 1.376412361 13.27891612 55.57837586 1.622874028 14.24058672 56.70224862 1.666531805 14.37017794 56.76585965 2.005441666 13.52451801 55.79725389 1.521532778 13.71088665 55.46685563 1.222417361 14.9588848 56.96508403 1.38658 14.82826594 56.75834768 1.485242778 13.1940657 56.38595264 1.792493889 14.84402516 56.90210837 1.235783333 14.46031787 56.18229581 1.681354444 14.63590428 56.35364532 1.650511111 13.34460314 55.52535888 1.473964166 14.62952158 57.00946017 1.6048425 13.71970327 55.68262124 1.564198333 13.13107617 56.34907413 1.663111806 13.48159711 56.89298141 2.3218075 13.81128734 55.80934654 1.869087639 14.15612237 56.82748426 1.526720834 13.25994595 57.06979504 1.953888333 13.36341923 55.45371566 1.683035417 13.53607897 55.91421314 1.662510139 14.84502823 56.65954652 1.808187361 13.5819665 56.40896643 1.723420972 14.10802101 56.09040464 1.322613333 12.59101931 56.18696069 1.285278334 15.22304196 57.13557739 1.861801667 13.93212119 56.63709467 1.879722361 14.04083953 56.20670871 1.426582917 13.20977325 55.70320438 1.036230556 14.50691645 56.31726101 1.512323056 14.04385954 55.43396451 1.518698611 14.62176554 56.14695594 1.436045973 12.94595993 56.48094227 1.284676667 13.43761668 56.76664816 2.052952223 13.4881 55.91363347 1.748883611 13.30499035 56.44143388 1.901664722 14.59756066 56.91952527 1.202981944 13.2574875 55.70389081 1.129174861 13.47396568 56.67724669 2.238806528 12.73718764 56.44136418 1.683367917 13.83580567 55.5220256 1.431533473 14.59492984 57.16207179 1.922699306 14.64495938 57.11730653 1.864279583 14.4312567 57.05363464 1.896975417 13.41144319 55.83179083 1.403585 14.22184539 56.81892717 1.746305417 13.50202498 56.38107009 1.659256389 12.68761018 56.18880561 1.355646945 14.94282338 56.71353347 1.63897125 15.02454518 56.77643118 1.68773 15.57297141 56.25402442 1.414539028 12.964589 56.43631667 1.382988472 13.45825395 55.45494721 1.820561111 14.63191383 56.76690666 1.694100278 13.14103724 55.81002734 1.48003625 15.21769188 56.21922061 1.580773194 14.10257692 55.63210186 1.773493889 13.17668301 56.07117614 1.724194167 15.84692703 56.23448315 1.807886528 13.44350876 55.42779971 1.808543611 15.1857457 56.28216487 1.575294861 13.31802754 56.51349734 1.770477639 12.8935671 56.83951966 1.609666389 15.86386582 56.27030588 2.006792778 13.34532169 55.88483834 1.414042917 14.02227635 55.66743196 1.754815834 15.54234554 56.37096273 1.768464167 14.17727266 55.85726695 1.794488889 13.02668442 55.86216815 1.630864584 14.02130349 56.97024678 1.49533125 14.70175234 56.21006795 1.380317916 13.4056505 56.3618967 1.847926389 14.52330627 56.29935591 1.458468611 15.45924302 56.19160552 1.353913194 13.64578835 55.52007228 1.636670139 15.54272866 56.39791466 1.825142222 13.77315439 57.01298115 2.218526667 15.81485761 56.2436834 1.651075833 13.50857285 55.7970615 1.55940875 13.2405817 55.37112529 1.525214028 13.77433597 56.9770554 1.827475 13.02797412 55.52067001 1.181577917 14.94264555 56.83032305 1.482392778 14.79657364 56.5696361 1.996696389 14.42283094 56.53252583 2.141961944 13.30174382 55.41692656 1.592043888 12.91793298 56.39959593 1.43073125 12.90894568 56.85775049 1.762173056 13.75637136 56.52764363 1.831847639 14.47776811 56.08353697 1.370715 13.22852136 55.64056743 1.272487639 13.58430026 56.34609492 1.82778375 13.49063969 56.66846469 2.12446875 13.10834154 56.8070164 1.948958889 14.04485542 56.0450056 1.215075973 14.13354678 55.66826782 1.915392223 15.50829522 56.24532218 1.578224028 15.13989252 56.99196316 1.574268333 14.38668231 56.75695784 1.967270138 14.37062878 56.73890974 2.157887638 14.17479551 55.97406075 1.204406945 12.94883204 55.51937 1.279889722 13.58529757 56.31914974 1.783001805 13.27981504 55.91988672 1.720325555 13.59881528 56.83145749 2.139697778 13.59915061 56.82247642 2.074659723 13.40296577 56.03836683 1.7947475 14.29429163 55.57045392 1.731105417 12.80578871 56.65827783 1.060809167 14.53129548 56.96421286 1.476721806 13.26306176 55.57815222 1.600958055 14.49804298 56.99103484 1.81823625 13.4719759 55.50904044 1.673925972 13.91167961 56.78067047 1.325035834 14.12918279 56.57573794 1.790625556 14.04255435 55.48787141 1.424878194 14.04189635 56.80869138 1.407714861 14.79691051 56.50674739 1.909035139 13.45649939 55.4998595 1.623631389 14.03861222 55.6495892 1.614189445 14.04342496 55.45193356 1.590481667 13.71133755 56.89556193 2.093918334 14.17229995 56.09085224 1.279623194 13.6748116 56.06854362 1.526770972 12.70417007 56.71935248 1.316963472 13.30434416 56.0909687 1.68737375 14.56792192 56.64092518 2.210113889 13.34417417 55.91178236 1.465459028 14.08469442 56.39572484 1.527290833 13.5484731 55.58186417 1.765038889 14.94294571 56.63267787 1.661855694 14.08079768 55.8835409 1.572365695 13.07503267 55.85394699 1.526148195 13.87707642 56.84325494 1.201778611 14.74834811 56.4797057 2.201030833 14.71780758 56.2190903 1.312630416 14.84688074 56.20134805 1.064184305 13.9756613 56.83511828 1.106081945 13.37482084 56.32555295 1.955326527 13.28496775 55.80313232 1.281214445 13.48814841 55.50025435 1.612392361 13.33917893 56.02853829 1.843289861 13.78947363 55.99783619 1.712659583 13.94116263 56.3137174 1.441294722 12.94495248 55.89677924 1.427171389 13.93984079 56.9426305 1.49043875 15.12394257 57.14469774 1.834394167 13.43537424 56.82053079 1.990671805 14.3348616 55.98401349 1.42602875 15.07312973 56.51587606 1.730443055 13.06228068 55.46729248 1.334419722 15.09067168 57.05489271 1.720642222 15.3000038 56.43467672 2.145260556 14.42783245 56.2001194 1.928752916 12.62154803 56.21451481 1.284935278 14.5647095 56.91941521 1.203295972 12.82352863 56.06545274 1.310144583 15.12128092 56.32716729 1.653416527 15.41977285 57.00032105 1.830578333 13.0108648 56.48199917 1.334979166 13.79627271 56.29442363 1.608296806 13.69390585 55.9788893 1.636546111 13.85415898 56.51959889 1.940849583 13.42994326 56.16451808 1.556413611 13.94165947 56.29575144 1.459196945 13.63833274 55.73566343 1.742808889 13.78097707 56.26731808 1.453552362 ''' df_centroid_Coord = pd.read_csv(StringIO(data), delim_whitespace=True) data = ''' ID "Ambulance station name" Longtitude Latitude 0 1 AImhult 14.128734 56.547992 1 2 Angelhdm 12.870739 56.242114 2 3 Alvesta 14.549503 56.920740 3 4 "Ostra Ljungby" 13.057450 56.188099 4 5 Broby 14.080958 56.254481 5 6 Bromölla 14.466869 56.072272 6 7 Försláv 12.814913 56.350098 7 9 Hasslehdm 13.778234 56.161536 8 10 Haganas 12.556995 56.206016 9 11 Hörby 13.643265 55.849811 10 12 "Halmstad.Vaster" 12.819960 56.674306 ''' df_station = pd.read_csv(StringIO(data), delim_whitespace=True) df_station.rename(columns={'Longtitude':'x', 'Latitude':'y'}, inplace=True) df_centroid_Coord['Ambulance_Treatment_Time'] = df_centroid_Coord ['Base_TT'] fig = px.scatter(df_centroid_Coord, x="x", y="y", title="Southern Region Centroids", color='Ambulance_Treatment_Time', log_x=True, size_max=60, color_continuous_scale='Reds', range_color=(0.5,2), ) fig.update_traces(marker={'size': 4, 'symbol': 1}) fig.add_trace(go.Scatter(x=df_station['x'], y=df_station['y'], mode='markers+text', text=df_station['Ambulance station name'], textposition='top center', showlegend=True, marker=dict( size=8, symbol=2, color='black' ) ) ) fig.show() If I read the same data from externals files, it does not work. Like if I plot the data of map coordniates (from Excel file) and then plot ambulance data (from Excel file), ambulance symbol in the diamond shape appears behind the map. It is not showing on the front. When dataset inside the code, the ambulance data is shown and not hidden Increased ambulance size - When dataset inside the code, the ambulance data is shown and not hidden
I think that there is no problem, I tried the same code with 2 Excel files with your data and I got the plot below: import plotly.express as px import plotly.graph_objects as go from openpyxl import load_workbook import pandas as pd import numpy as np import io file_loc_1 = "AgeGroupData_time_to_treatment.xlsx" df_centroid_Coord = pd.read_excel(file_loc_1, index_col=None, na_values=['NA']) df_centroid_Coord file_loc2Amb = "Ambulance IDs.xlsx" df_station = pd.read_excel(file_loc2Amb, index_col=None, na_values=['NA'], usecols="A:D") df_station.rename(columns={'Longtitude':'x', 'Latitude':'y'}, inplace=True) df_centroid_Coord['Ambulance_Treatment_Time'] = df_centroid_Coord ['Base_TT'] fig = px.scatter(df_centroid_Coord, x="x", y="y", title="Southern Region Centroids", color='Ambulance_Treatment_Time', log_x=True, size_max=60, color_continuous_scale='Reds', range_color=(0.5,2), ) fig.update_traces(marker={'size': 4, 'symbol': 1}) fig.add_trace(go.Scatter(x=df_station['x'], y=df_station['y'], mode='markers+text', text=df_station['Ambulance station name'], textposition='top center', showlegend=True, marker=dict( size=12, symbol=2, color='black' ) ) ) fig.update_layout(width=1000, height=800, paper_bgcolor="LightSteelBlue") fig.show()
Scatter plot looks good but line plot looks weird on non-monotonically increasing data set
I have a monotonically increasing data set as shown below. R,M 7.0868,1.8102943986273166 7.087,1.810312919954896 7.0872,1.8102755711577103 7.0875,1.8102573284176724 7.0876,1.810237664390435 7.0887,1.810218897273047 7.0891,1.8102001649403308 7.0893,1.810178092508343 7.0894,1.8101553469354064 7.0902,1.8101359159985828 7.0907,1.810114549302785 7.0913,1.81009305646246 7.0916,1.8100731291478405 7.0919,1.8100505894431602 7.0923,1.8100245482326576 7.0933,1.810004843857531 7.0941,1.809981589365771 7.0948,1.8099565489521152 7.0949,1.8099337348073137 7.0957,1.8099052572558645 7.096,1.8098801233168886 7.0963,1.8098547472451978 7.0968,1.8098277762241366 7.0976,1.8098018568760064 7.0988,1.8097719856008248 7.099,1.8097424026714641 7.0994,1.8097145467653863 7.1002,1.8096846260698558 7.1005,1.8096553317621344 7.1016,1.8096207945226712 7.1023000000000005,1.8095909693292185 7.1031,1.8095572406207299 7.1038,1.8095238119406782 7.1043,1.8094894673202357 7.1053,1.8094538233723965 7.1064,1.8094182142472666 7.1067,1.8093818127358254 7.1079,1.8093437811755255 7.1088000000000005,1.8093041362243816 7.1098,1.809264041823682 7.1107000000000005,1.8092243783159143 7.1112,1.8091814057573945 7.1126000000000005,1.8091391534332957 7.1136,1.809094359509292 7.1148,1.809048533354942 7.1158,1.8090036536620597 7.1169,1.8089557015211883 7.1181,1.8089046493876206 7.1193,1.8088552101687183 7.1204,1.8088020551150032 7.1219,1.808747338797958 7.1225000000000005,1.8086919257417675 7.1247,1.8086350956553856 7.1258,1.8085748348942912 7.1275,1.808514553392964 7.1291,1.8084534203833889 7.1306,1.8083867543300092 7.1325,1.8083196215972281 7.1338,1.80825088250088 7.136,1.808178483206244 7.1374,1.8081044657602499 7.1392,1.8080287144430973 7.1412,1.8079480881686774 7.1431000000000004,1.8078648303094877 7.1456,1.8077807725153732 7.1476,1.8076892427316402 7.1503000000000005,1.807599230113512 7.1525,1.8075034794947091 7.1552,1.8074049113668145 7.1578,1.8073014641377354 7.1612,1.8071891350684717 7.1637,1.8070785128831843 7.1675,1.80696372890561 7.1701,1.8068419878230761 7.1737,1.8067122501065405 7.1779,1.8065802344915192 7.1814,1.8064383616085946 7.1856,1.806293933093177 7.1896,1.806138911817485 7.1947,1.8059806108944794 7.1993,1.80580908721362 7.2053,1.8056328160830435 7.2107,1.8054479682161961 7.2173,1.8052525284387695 7.2237,1.8050465193576883 7.2309,1.8048296381956124 7.2392,1.8045988960975694 7.2474,1.8043595071215677 7.2564,1.8041082364687364 7.2666,1.8038382553758734 7.2781,1.8035594899544896 7.2901,1.8032661790541915 7.3036,1.8029587616930072 7.3192,1.8026419692687126 7.3365,1.802313214895432 7.3559,1.8019832998820766 7.3782000000000005,1.8016547858228427 7.4039,1.8013374225262055 7.434,1.8010610354808818 7.469,1.8008525385497174 7.4728,1.8008375055547212 7.4766,1.8008241798024116 7.4805,1.8008134283846535 7.485,1.8008014895962607 7.4889,1.8007906472467445 7.4931,1.8007836940234814 7.4974,1.8007772872833665 7.502,1.8007773636348627 7.5066,1.800777214492662 7.5111,1.800772599047411 7.5161,1.8007769259270974 7.5204,1.8007812794388944 7.5251,1.8007885071607819 7.5309,1.8007961396426069 7.5354,1.800809332665 7.5404,1.800828880377808 7.5456,1.800846702941447 7.5511,1.8008692674381197 7.5565,1.8008933437321841 7.5623000000000005,1.8009237058574081 7.5682,1.800958157045992 7.5744,1.8009948449267943 7.58,1.8010363488385235 7.5863000000000005,1.8010832972433193 7.5923,1.8011350711403118 7.5989,1.8011921478121384 7.6052,1.801254330745158 7.6122000000000005,1.8013200393645774 7.619,1.801396979723438 7.6262,1.801481231944994 7.6332,1.8015680286606623 7.6412,1.8016656871159082 7.6485,1.8017686065785499 7.6562,1.8018805264670845 7.664,1.8020043241836483 7.6723,1.8021374134198185 7.6806,1.802276358227313 7.689,1.802430876035706 7.698,1.8025962404854161 7.7073,1.802773424707928 7.7165,1.8029615206656595 7.7261,1.8031700727690376 7.7358,1.8033901306600841 7.746,1.8036245439350242 7.7569,1.8038801831608258 7.7674,1.8041511397011663 7.7785,1.8044409511998807 7.7895,1.804751063391503 7.8016000000000005,1.8050889378483397 7.8137,1.8054500843221957 7.8260000000000005,1.8058344798814248 7.839,1.8062497893213036 7.8523000000000005,1.8066916535420319 7.8660000000000005,1.807171119554773 7.8801000000000005,1.8076802794778468 7.8950000000000005,1.8082299359839067 7.91,1.808815338202358 7.9256,1.8094485033102967 7.9419,1.8101332152002367 7.9588,1.8108583555324504 7.9762,1.8116377906606793 7.9942,1.812480154325305 8.013300000000001,1.8133886252401064 8.0323,1.8143645477074526 8.0526,1.8154146330511043 8.073500000000001,1.8165442307174358 8.0957,1.8177698166402039 8.1182,1.819085725400004 8.1417,1.8205097465554974 8.1664,1.8220480025653125 8.192,1.8237072998986206 8.2188,1.8255111058560254 8.2468,1.827455350126501 8.2759,1.8295663029422389 8.3064,1.831861429607547 8.3383,1.8343455967834263 8.3716,1.837047237198313 8.4065,1.8399908757968044 8.4431,1.8431886841980547 8.4816,1.846678932529894 8.5218,1.8504805320192779 8.5642,1.8546328838729316 8.6085,1.859161369210759 8.655,1.8641143534208833 8.7039,1.8695256342139759 8.754900000000001,1.875446560741857 8.8087,1.881922204419208 8.8655,1.8890064461692662 8.9244,1.8967439742289458 8.9863,1.905188505881128 9.0511,1.9143851329920027 9.1186,1.924363320273434 9.188600000000001,1.9351143409915226 9.2613,1.9466051165466298 9.3348,1.9586922001685116 9.4098,1.970987602510523 9.4882,1.9833342806468837 9.5729,1.9958205973858019 9.6658,2.008306966070422 9.6757,2.0095470086686014 9.6853,2.0107829319774146 9.6956,2.0120161755240176 9.706,2.013246638357084 9.7155,2.0144724860531107 9.726,2.01569779646471 9.7361,2.01691593463459 9.7469,2.0181299858892676 9.7574,2.019339103824116 9.768,2.0205367574186544 9.7784,2.0217329512312534 9.789200000000001,2.022924537891196 9.8004,2.024103911848606 9.8115,2.0252755733660237 9.822700000000001,2.026442290408354 9.8339,2.027595562850575 9.8451,2.0287425260513627 9.8566,2.02987789695615 9.8683,2.031004255291417 9.8802,2.0321140981371753 9.8917,2.033211262029186 9.9039,2.03429873554374 9.9159,2.035370601551793 9.9284,2.036428080910105 9.9404,2.03746680777716 9.953100000000001,2.038486511766415 9.9657,2.039488307130752 9.9784,2.040471399292025 9.9911,2.0414350165353037 10.0042,2.0423773356028083 10.0178,2.043291283530465 10.030800000000001,2.0441838862321724 10.044500000000001,2.0450464474687147 10.0585,2.0458827447198584 10.0716,2.0466886270813385 10.0859,2.047468383690954 10.0998,2.0482043647433352 10.113900000000001,2.0489096859138938 10.1285,2.0495761215721746 10.1431,2.0501996224170225 10.158,2.0507863441183343 10.173,2.05132507354447 10.1883,2.0518124042758448 10.2033,2.052257120191798 10.2188,2.052637398387419 10.2344,2.0529609887501064 10.2505,2.053231208698309 10.266300000000001,2.053430956645957 10.2827,2.0535609020452807 10.2992,2.053618768726303 10.315900000000001,2.0535986346512063 10.3324,2.053499145209982 10.3495,2.0533064233065197 10.3668,2.0530215567767636 10.3844,2.0526369031524108 10.402000000000001,2.0521636845730233 10.42,2.0515392027607855 10.4381,2.0508116828399494 10.4563,2.0499535127064785 10.4748,2.0489576534963168 10.4937,2.0478138062588847 10.5128,2.046511793430433 10.532,2.0450378909729627 10.5515,2.043383966625784 10.5714,2.0415367556333575 10.591000000000001,2.039475707572078 10.6113,2.0371915999694594 10.6318,2.034681992486926 10.6523,2.031875344830552 10.6732,2.028806016957831 10.6943,2.0254302835993974 10.7156,2.021729410221098 10.737,2.0176679331240632 10.7585,2.0132226995271503 10.7804,2.0083569404787207 10.8025,2.003033377167351 10.8245,1.9972070467548615 10.8468,1.99084498211035 10.8693,1.9838848370723352 10.8916,1.976265341594595 10.913400000000001,1.9679245337116287 10.9359,1.9587753705415543 10.958,1.9487087547075432 10.9801,1.937613087921291 11.0016,1.925359737260557 11.0228,1.911811244861433 11.043700000000001,1.896814109152176 11.0641,1.880201767746232 11.0839,1.861791757645824 11.103,1.8413880752742964 11.1143,0.6798071334659402 11.1148,0.6620484741207461 11.115400000000001,0.7308628786759206 11.1163,0.643905710436412 11.1173,0.7471776126414391 11.1188,0.6253614804987849 11.119,0.7631699685933497 11.1209,1.8187639653487393 11.121,0.7788332436619917 11.1226,0.6064184938116979 11.1233,0.7941958537153351 11.1252,0.8092591741702967 11.1277,0.5870678163436467 11.1302,0.8385380585848173 11.1326,0.8527702605010601 11.135200000000001,0.5673102326921188 11.1377,0.8804746147417499 11.138300000000001,1.7936929573835567 11.1404,0.8939630164904495 11.142800000000001,0.9072161422501497 11.1443,0.5471696019139972 11.1457,0.920255663318353 11.148,0.933064576156273 11.1506,0.9456674682901905 11.152800000000001,0.958071445468564 11.1539,1.7659104790175046 11.1555,0.9702722709283456 11.1563,0.526626294457235 11.1578,0.982282581805736 11.16,0.994125843269314 11.1625,1.005758474384689 11.1651,1.0172259729870816 11.1667,1.0285290632922044 11.1681,1.7351407435690962 11.1694,1.0396641713997514 11.1708,1.0506369116951209 11.1715,0.5057129912122545 11.1728,1.06145775881892 11.1752,1.0721969265059947 11.177100000000001,1.0826438965199432 11.178700000000001,1.0930140692041797 11.1804,1.7010859834099117 11.180900000000001,1.1032438870571097 11.1824,1.113341990904366 11.184000000000001,1.123299806468843 11.1857,1.1331296145407677 11.1873,1.1428308979922694 11.1889,1.152401698215316 11.1903,1.161856869794937 11.1904,0.48445364974714356 11.1919,1.663399436215842 11.192,1.1711910394172824 11.1934,1.1804087961074725 11.1942,1.1895091584397912 11.195500000000001,1.1985002253694752 11.1974,1.2073817550934374 11.1981,1.2161518746407876 11.199300000000001,1.2248195347259854 11.2006,1.233382363999008 11.2012,1.6217221083677575 11.201600000000001,1.2418573170671454 11.2026,1.2502123181321048 11.2036,1.2584707455312942 11.2044,1.2666389953934527 11.205300000000001,1.2747462832375793 11.2059,1.282698337211604 11.2071,1.2905889671447655 11.2075,1.2983932387539374 11.208400000000001,1.5756312874271927 11.2089,1.3061289118283488 11.2093,1.3137413392392563 11.209900000000001,1.3212844363707013 11.2105,1.3287440211738633 11.2111,1.3361240786859585 11.2118,1.3434226680704695 11.2121,1.3506419841724973 11.2127,1.35780576619357 11.2131,1.3718370881026203 11.2135,1.5246558611202008 11.213700000000001,1.364846987030096 11.214,1.5138285906034126 11.2142,1.385586125420797 11.2144,1.5083287553910607 11.214500000000001,1.5027740924000998 11.2146,1.3990472473875148 11.2147,1.491494982843448 11.2148,1.4122266556473997 11.2149,1.4187122779735373 11.215,1.392352319217516 11.2151,1.4799814651383028 11.215200000000001,1.4682238422417109 11.215300000000001,1.4056725030722297 11.2154,1.4562337169860362 11.2155,1.4251295454595927 11.2156,1.4314822279446662 R,M 7.0868,1.8102943986273166 7.087,1.810312919954896 7.0872,1.8102755711577103 7.0875,1.8102573284176724 7.0876,1.810237664390435 7.0887,1.810218897273047 7.0891,1.8102001649403308 7.0893,1.810178092508343 7.0894,1.8101553469354064 7.0902,1.8101359159985828 7.0907,1.810114549302785 7.0913,1.81009305646246 7.0916,1.8100731291478405 7.0919,1.8100505894431602 7.0923,1.8100245482326576 7.0933,1.810004843857531 7.0941,1.809981589365771 7.0948,1.8099565489521152 7.0949,1.8099337348073137 7.0957,1.8099052572558645 7.096,1.8098801233168886 7.0963,1.8098547472451978 7.0968,1.8098277762241366 7.0976,1.8098018568760064 7.0988,1.8097719856008248 7.099,1.8097424026714641 7.0994,1.8097145467653863 7.1002,1.8096846260698558 7.1005,1.8096553317621344 7.1016,1.8096207945226712 7.1023000000000005,1.8095909693292185 7.1031,1.8095572406207299 7.1038,1.8095238119406782 7.1043,1.8094894673202357 7.1053,1.8094538233723965 7.1064,1.8094182142472666 7.1067,1.8093818127358254 7.1079,1.8093437811755255 7.1088000000000005,1.8093041362243816 7.1098,1.809264041823682 7.1107000000000005,1.8092243783159143 7.1112,1.8091814057573945 7.1126000000000005,1.8091391534332957 7.1136,1.809094359509292 7.1148,1.809048533354942 7.1158,1.8090036536620597 7.1169,1.8089557015211883 7.1181,1.8089046493876206 7.1193,1.8088552101687183 7.1204,1.8088020551150032 7.1219,1.808747338797958 7.1225000000000005,1.8086919257417675 7.1247,1.8086350956553856 7.1258,1.8085748348942912 7.1275,1.808514553392964 7.1291,1.8084534203833889 7.1306,1.8083867543300092 7.1325,1.8083196215972281 7.1338,1.80825088250088 7.136,1.808178483206244 7.1374,1.8081044657602499 7.1392,1.8080287144430973 7.1412,1.8079480881686774 7.1431000000000004,1.8078648303094877 7.1456,1.8077807725153732 7.1476,1.8076892427316402 7.1503000000000005,1.807599230113512 7.1525,1.8075034794947091 7.1552,1.8074049113668145 7.1578,1.8073014641377354 7.1612,1.8071891350684717 7.1637,1.8070785128831843 7.1675,1.80696372890561 7.1701,1.8068419878230761 7.1737,1.8067122501065405 7.1779,1.8065802344915192 7.1814,1.8064383616085946 7.1856,1.806293933093177 7.1896,1.806138911817485 7.1947,1.8059806108944794 7.1993,1.80580908721362 7.2053,1.8056328160830435 7.2107,1.8054479682161961 7.2173,1.8052525284387695 7.2237,1.8050465193576883 7.2309,1.8048296381956124 7.2392,1.8045988960975694 7.2474,1.8043595071215677 7.2564,1.8041082364687364 7.2666,1.8038382553758734 7.2781,1.8035594899544896 7.2901,1.8032661790541915 7.3036,1.8029587616930072 7.3192,1.8026419692687126 7.3365,1.802313214895432 7.3559,1.8019832998820766 7.3782000000000005,1.8016547858228427 7.4039,1.8013374225262055 7.434,1.8010610354808818 7.469,1.8008525385497174 7.4728,1.8008375055547212 7.4766,1.8008241798024116 7.4805,1.8008134283846535 7.485,1.8008014895962607 7.4889,1.8007906472467445 7.4931,1.8007836940234814 7.4974,1.8007772872833665 7.502,1.8007773636348627 7.5066,1.800777214492662 7.5111,1.800772599047411 7.5161,1.8007769259270974 7.5204,1.8007812794388944 7.5251,1.8007885071607819 7.5309,1.8007961396426069 7.5354,1.800809332665 7.5404,1.800828880377808 7.5456,1.800846702941447 7.5511,1.8008692674381197 7.5565,1.8008933437321841 7.5623000000000005,1.8009237058574081 7.5682,1.800958157045992 7.5744,1.8009948449267943 7.58,1.8010363488385235 7.5863000000000005,1.8010832972433193 7.5923,1.8011350711403118 7.5989,1.8011921478121384 7.6052,1.801254330745158 7.6122000000000005,1.8013200393645774 7.619,1.801396979723438 7.6262,1.801481231944994 7.6332,1.8015680286606623 7.6412,1.8016656871159082 7.6485,1.8017686065785499 7.6562,1.8018805264670845 7.664,1.8020043241836483 7.6723,1.8021374134198185 7.6806,1.802276358227313 7.689,1.802430876035706 7.698,1.8025962404854161 7.7073,1.802773424707928 7.7165,1.8029615206656595 7.7261,1.8031700727690376 7.7358,1.8033901306600841 7.746,1.8036245439350242 7.7569,1.8038801831608258 7.7674,1.8041511397011663 7.7785,1.8044409511998807 7.7895,1.804751063391503 7.8016000000000005,1.8050889378483397 7.8137,1.8054500843221957 7.8260000000000005,1.8058344798814248 7.839,1.8062497893213036 7.8523000000000005,1.8066916535420319 7.8660000000000005,1.807171119554773 7.8801000000000005,1.8076802794778468 7.8950000000000005,1.8082299359839067 7.91,1.808815338202358 7.9256,1.8094485033102967 7.9419,1.8101332152002367 7.9588,1.8108583555324504 7.9762,1.8116377906606793 7.9942,1.812480154325305 8.013300000000001,1.8133886252401064 8.0323,1.8143645477074526 8.0526,1.8154146330511043 8.073500000000001,1.8165442307174358 8.0957,1.8177698166402039 8.1182,1.819085725400004 8.1417,1.8205097465554974 8.1664,1.8220480025653125 8.192,1.8237072998986206 8.2188,1.8255111058560254 8.2468,1.827455350126501 8.2759,1.8295663029422389 8.3064,1.831861429607547 8.3383,1.8343455967834263 8.3716,1.837047237198313 8.4065,1.8399908757968044 8.4431,1.8431886841980547 8.4816,1.846678932529894 8.5218,1.8504805320192779 8.5642,1.8546328838729316 8.6085,1.859161369210759 8.655,1.8641143534208833 8.7039,1.8695256342139759 8.754900000000001,1.875446560741857 8.8087,1.881922204419208 8.8655,1.8890064461692662 8.9244,1.8967439742289458 8.9863,1.905188505881128 9.0511,1.9143851329920027 9.1186,1.924363320273434 9.188600000000001,1.9351143409915226 9.2613,1.9466051165466298 9.3348,1.9586922001685116 9.4098,1.970987602510523 9.4882,1.9833342806468837 9.5729,1.9958205973858019 9.6658,2.008306966070422 9.6757,2.0095470086686014 9.6853,2.0107829319774146 9.6956,2.0120161755240176 9.706,2.013246638357084 9.7155,2.0144724860531107 9.726,2.01569779646471 9.7361,2.01691593463459 9.7469,2.0181299858892676 9.7574,2.019339103824116 9.768,2.0205367574186544 9.7784,2.0217329512312534 9.789200000000001,2.022924537891196 9.8004,2.024103911848606 9.8115,2.0252755733660237 9.822700000000001,2.026442290408354 9.8339,2.027595562850575 9.8451,2.0287425260513627 9.8566,2.02987789695615 9.8683,2.031004255291417 9.8802,2.0321140981371753 9.8917,2.033211262029186 9.9039,2.03429873554374 9.9159,2.035370601551793 9.9284,2.036428080910105 9.9404,2.03746680777716 9.953100000000001,2.038486511766415 9.9657,2.039488307130752 9.9784,2.040471399292025 9.9911,2.0414350165353037 10.0042,2.0423773356028083 10.0178,2.043291283530465 10.030800000000001,2.0441838862321724 10.044500000000001,2.0450464474687147 10.0585,2.0458827447198584 10.0716,2.0466886270813385 10.0859,2.047468383690954 10.0998,2.0482043647433352 10.113900000000001,2.0489096859138938 10.1285,2.0495761215721746 10.1431,2.0501996224170225 10.158,2.0507863441183343 10.173,2.05132507354447 10.1883,2.0518124042758448 10.2033,2.052257120191798 10.2188,2.052637398387419 10.2344,2.0529609887501064 10.2505,2.053231208698309 10.266300000000001,2.053430956645957 10.2827,2.0535609020452807 10.2992,2.053618768726303 10.315900000000001,2.0535986346512063 10.3324,2.053499145209982 10.3495,2.0533064233065197 10.3668,2.0530215567767636 10.3844,2.0526369031524108 10.402000000000001,2.0521636845730233 10.42,2.0515392027607855 10.4381,2.0508116828399494 10.4563,2.0499535127064785 10.4748,2.0489576534963168 10.4937,2.0478138062588847 10.5128,2.046511793430433 10.532,2.0450378909729627 10.5515,2.043383966625784 10.5714,2.0415367556333575 10.591000000000001,2.039475707572078 10.6113,2.0371915999694594 10.6318,2.034681992486926 10.6523,2.031875344830552 10.6732,2.028806016957831 10.6943,2.0254302835993974 10.7156,2.021729410221098 10.737,2.0176679331240632 10.7585,2.0132226995271503 10.7804,2.0083569404787207 10.8025,2.003033377167351 10.8245,1.9972070467548615 10.8468,1.99084498211035 10.8693,1.9838848370723352 10.8916,1.976265341594595 10.913400000000001,1.9679245337116287 10.9359,1.9587753705415543 10.958,1.9487087547075432 10.9801,1.937613087921291 11.0016,1.925359737260557 11.0228,1.911811244861433 11.043700000000001,1.896814109152176 11.0641,1.880201767746232 11.0839,1.861791757645824 11.103,1.8413880752742964 11.1143,0.6798071334659402 11.1148,0.6620484741207461 11.115400000000001,0.7308628786759206 11.1163,0.643905710436412 11.1173,0.7471776126414391 11.1188,0.6253614804987849 11.119,0.7631699685933497 11.1209,1.8187639653487393 11.121,0.7788332436619917 11.1226,0.6064184938116979 11.1233,0.7941958537153351 11.1252,0.8092591741702967 11.1277,0.5870678163436467 11.1302,0.8385380585848173 11.1326,0.8527702605010601 11.135200000000001,0.5673102326921188 11.1377,0.8804746147417499 11.138300000000001,1.7936929573835567 11.1404,0.8939630164904495 11.142800000000001,0.9072161422501497 11.1443,0.5471696019139972 11.1457,0.920255663318353 11.148,0.933064576156273 11.1506,0.9456674682901905 11.152800000000001,0.958071445468564 11.1539,1.7659104790175046 11.1555,0.9702722709283456 11.1563,0.526626294457235 11.1578,0.982282581805736 11.16,0.994125843269314 11.1625,1.005758474384689 11.1651,1.0172259729870816 11.1667,1.0285290632922044 11.1681,1.7351407435690962 11.1694,1.0396641713997514 11.1708,1.0506369116951209 11.1715,0.5057129912122545 11.1728,1.06145775881892 11.1752,1.0721969265059947 11.177100000000001,1.0826438965199432 11.178700000000001,1.0930140692041797 11.1804,1.7010859834099117 11.180900000000001,1.1032438870571097 11.1824,1.113341990904366 11.184000000000001,1.123299806468843 11.1857,1.1331296145407677 11.1873,1.1428308979922694 11.1889,1.152401698215316 11.1903,1.161856869794937 11.1904,0.48445364974714356 11.1919,1.663399436215842 11.192,1.1711910394172824 11.1934,1.1804087961074725 11.1942,1.1895091584397912 11.195500000000001,1.1985002253694752 11.1974,1.2073817550934374 11.1981,1.2161518746407876 11.199300000000001,1.2248195347259854 11.2006,1.233382363999008 11.2012,1.6217221083677575 11.201600000000001,1.2418573170671454 11.2026,1.2502123181321048 11.2036,1.2584707455312942 11.2044,1.2666389953934527 11.205300000000001,1.2747462832375793 11.2059,1.282698337211604 11.2071,1.2905889671447655 11.2075,1.2983932387539374 11.208400000000001,1.5756312874271927 11.2089,1.3061289118283488 11.2093,1.3137413392392563 11.209900000000001,1.3212844363707013 11.2105,1.3287440211738633 11.2111,1.3361240786859585 11.2118,1.3434226680704695 11.2121,1.3506419841724973 11.2127,1.35780576619357 11.2131,1.3718370881026203 11.2135,1.5246558611202008 11.213700000000001,1.364846987030096 11.214,1.5138285906034126 11.2142,1.385586125420797 11.2144,1.5083287553910607 11.214500000000001,1.5027740924000998 11.2146,1.3990472473875148 11.2147,1.491494982843448 11.2148,1.4122266556473997 11.2149,1.4187122779735373 11.215,1.392352319217516 11.2151,1.4799814651383028 11.215200000000001,1.4682238422417109 11.215300000000001,1.4056725030722297 11.2154,1.4562337169860362 11.2155,1.4251295454595927 11.2156,1.4314822279446662 The data is imported using Pandas with the code below. import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('data.txt') df = df.sort_values(by=['R']) plt.plot(df['R'], df['M']) plt.gcf().set_size_inches(2.55*8,1*8) plt.xlabel(r'$r$ $(km)$') plt.ylabel(r'$M/M_\odot$') plt.show() exit() I've shorted data short by X ('R') and it look weird where Y is not monotonically increasing as picture below Also, if I short the data by Y ('M'), the plot doesn't look so well where X is not monotonically increasing. Scatter plot looks as shown below. I have no idea for an equation to fit this plot. Is there any method or package for connecting the point properly? Edit1: I've tried doing spline fit. The result is as below. import numpy as np tck = interpolate.splrep(df['R'], df['M'],) xnew= np.linspace(min(df['R'].to_numpy()),max(df['R'].to_numpy()),1000) ynew = interpolate.splev(xnew, tck) plt.plot(xnew, ynew)
I guess in this particular case a solution to get the data in the desired order is to sort them by the polar angle of the points in a cartesian plane. X = <your data> order = np.argsort(np.arctan2(X[:,1], X[:,0])) plt.plot(X[order,0], X[order,1]) plt.show()
How to set seaborn jointplot axis to log scale
How to set axis to logarithmic scale in a seaborn jointplot? I can't find any log arguments in seaborn.jointplot Notebook import seaborn as sns import pandas as pd df = pd.read_csv("https://storage.googleapis.com/mledu-datasets/california_housing_train.csv", sep=",") g = sns.jointplot(x="total_bedrooms", y="median_house_value", data = df, kind="reg", logx=True ) 300 rows of sample data of the relevant columns, incase the data link dies median_house_value,total_bedrooms 66900.0,1283.0 80100.0,1901.0 85700.0,174.0 73400.0,337.0 65500.0,326.0 74000.0,236.0 82400.0,680.0 48500.0,168.0 58400.0,1175.0 48100.0,309.0 86500.0,801.0 62000.0,483.0 48600.0,248.0 70400.0,464.0 45000.0,378.0 69100.0,587.0 94900.0,322.0 25000.0,33.0 44000.0,386.0 27500.0,24.0 44400.0,360.0 59200.0,243.0 50000.0,95.0 71300.0,129.0 53500.0,397.0 100000.0,139.0 71100.0,322.0 80900.0,270.0 68600.0,191.0 74300.0,294.0 65800.0,394.0 67500.0,262.0 146300.0,196.0 113800.0,171.0 95800.0,113.0 107800.0,220.0 40000.0,373.0 88500.0,246.0 91200.0,666.0 102800.0,104.0 64000.0,389.0 84700.0,440.0 70100.0,573.0 142500.0,72.0 88400.0,913.0 75500.0,492.0 43300.0,523.0 46700.0,218.0 63700.0,287.0 72700.0,610.0 42500.0,136.0 53400.0,283.0 60800.0,262.0 58600.0,382.0 66400.0,366.0 67500.0,387.0 79200.0,337.0 63100.0,275.0 67700.0,581.0 40000.0,199.0 62200.0,634.0 70700.0,340.0 60300.0,545.0 61200.0,325.0 69400.0,373.0 96000.0,268.0 60600.0,395.0 70800.0,454.0 60400.0,403.0 143000.0,365.0 80800.0,530.0 67500.0,316.0 61000.0,142.0 59600.0,221.0 53600.0,162.0 84300.0,606.0 107200.0,480.0 59400.0,416.0 63900.0,375.0 69400.0,328.0 62500.0,835.0 58300.0,438.0 70800.0,490.0 86200.0,202.0 76200.0,283.0 140300.0,217.0 62300.0,269.0 63500.0,256.0 61100.0,301.0 67500.0,289.0 93800.0,594.0 73600.0,208.0 97200.0,235.0 87500.0,279.0 71700.0,282.0 96300.0,143.0 87500.0,203.0 64400.0,507.0 110100.0,414.0 90800.0,274.0 159900.0,307.0 94400.0,177.0 72500.0,187.0 83200.0,317.0 62000.0,244.0 61200.0,231.0 125000.0,235.0 55200.0,340.0 87500.0,99.0 50000.0,238.0 30000.0,448.0 87500.0,103.0 93800.0,81.0 47500.0,18.0 68900.0,379.0 41000.0,1257.0 32500.0,49.0 62800.0,248.0 67500.0,95.0 67500.0,272.0 58800.0,43.0 53800.0,25.0 54400.0,81.0 53800.0,46.0 54300.0,536.0 51300.0,57.0 43900.0,280.0 66400.0,958.0 62800.0,515.0 94500.0,97.0 65600.0,65.0 81300.0,94.0 66900.0,290.0 66800.0,2331.0 76100.0,89.0 65600.0,1997.0 84700.0,354.0 100000.0,820.0 47800.0,1228.0 82600.0,705.0 112500.0,54.0 65400.0,499.0 61400.0,277.0 65900.0,800.0 47500.0,203.0 58600.0,512.0 155000.0,19.0 66700.0,654.0 67500.0,476.0 60600.0,625.0 96300.0,273.0 61800.0,409.0 68200.0,192.0 68900.0,714.0 82200.0,787.0 100000.0,176.0 100900.0,295.0 32900.0,386.0 42500.0,468.0 69400.0,858.0 68500.0,352.0 58800.0,258.0 124700.0,849.0 72100.0,221.0 76900.0,1326.0 90000.0,1349.0 104100.0,566.0 93400.0,1039.0 95000.0,2224.0 67500.0,187.0 50000.0,91.0 92900.0,444.0 382400.0,1222.0 83700.0,284.0 65800.0,109.0 199300.0,2555.0 167400.0,760.0 137500.0,481.0 55400.0,556.0 93400.0,410.0 91800.0,851.0 98000.0,831.0 54200.0,487.0 81000.0,861.0 100000.0,367.0 57400.0,411.0 158500.0,3923.0 353100.0,2000.0 176400.0,514.0 62300.0,406.0 110700.0,606.0 78500.0,3098.0 121300.0,1859.0 318100.0,1542.0 98700.0,1152.0 65000.0,1238.0 116300.0,348.0 194500.0,3479.0 134500.0,2405.0 258100.0,2460.0 73300.0,1149.0 74400.0,2257.0 128000.0,1618.0 238800.0,2007.0 78000.0,1089.0 97800.0,872.0 259200.0,500.0 168800.0,476.0 177800.0,893.0 285000.0,1260.0 341700.0,2837.0 138300.0,782.0 103100.0,48.0 84000.0,1296.0 115100.0,1343.0 500001.0,438.0 98100.0,361.0 72400.0,1303.0 88400.0,1266.0 97500.0,1110.0 403300.0,249.0 99100.0,1206.0 134600.0,992.0 127100.0,643.0 104200.0,920.0 83000.0,745.0 65300.0,1234.0 85200.0,471.0 142500.0,1512.0 90900.0,2481.0 113600.0,441.0 81000.0,913.0 145200.0,2020.0 115300.0,272.0 65900.0,636.0 148900.0,1875.0 146400.0,868.0 66600.0,1882.0 87500.0,85.0 94800.0,1229.0 248100.0,1074.0 64700.0,713.0 51300.0,2634.0 61100.0,1395.0 66000.0,780.0 61000.0,306.0 89600.0,754.0 112500.0,1444.0 130400.0,859.0 145200.0,2315.0 189900.0,852.0 68200.0,648.0 125200.0,763.0 110900.0,2186.0 159000.0,1839.0 220500.0,463.0 124100.0,1714.0 199400.0,1217.0 183900.0,1387.0 235600.0,1780.0 500001.0,562.0 69600.0,1529.0 321900.0,399.0 148200.0,361.0 22500.0,1743.0 76600.0,67.0 50000.0,166.0 230200.0,1652.0 345500.0,82.0 116500.0,876.0 113500.0,827.0 172900.0,365.0 198100.0,538.0 67400.0,1719.0 169100.0,847.0 240600.0,157.0 193800.0,74.0 161100.0,711.0 156300.0,374.0 66300.0,109.0 81700.0,875.0 122900.0,682.0 214300.0,661.0 158200.0,946.0 143400.0,1070.0 217400.0,845.0 308600.0,481.0 111400.0,849.0 42500.0,10.0 173400.0,268.0 187200.0,702.0 214500.0,751.0 63000.0,525.0 221000.0,1946.0 90000.0,68.0 231800.0,786.0 206100.0,520.0 100000.0,63.0 274600.0,565.0 84700.0,1527.0
After you create the plot, you can set the axes to be log scale, using matplotlib's ax.set_xscale('log') and ax.set_yscale('log'). In this case, we need to get the axis from the JointGrid created by jointplot. If you catch the JointGrid returned as g, then the joint axis is g.ax_joint. For example: g = sns.jointplot(x="predictions", y="targets", data = calibration_data, kind="reg", logx=True, ) g.ax_joint.set_xscale('log') g.ax_joint.set_yscale('log')