Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14011

Finding the Outlines of a Graph

$
0
0

I'm trying to find the equations of the outlines of a graph in python with matplotlib.pyplot (in terms of μ and σ). I already, numpy and scipy outlined the graph, but I can't find a way of getting the equations of both of the lines in terms of the mean and standard deviation.

import matplotlib.pyplot as pltimport numpy as npfrom scipy.spatial import ConvexHullx_axis = []y_axis = []nth_triple = []average_triple = []def return_average(lst):    counter = 0    for el in lst:        counter += el    return counter/len(lst)def pythagoreanTriplets(limits) :     counter = 0    c, m = 0, 2    while c < limits :          for n in range(1, m) :             a = m * m - n * n             b = 2 * m * n             c = m * m + n * n             if c > limits :                 break            triple = [a, b, c]            x_axis.append(a)            y_axis.append(b)            nth_triple.append(counter)            average_triple.append(return_average(triple))            counter += 1        m = m + 1limit = 100000pythagoreanTriplets(limit)points = np.column_stack((nth_triple, average_triple))hull = ConvexHull(points)mu_x = np.mean(points[hull.vertices, 0])mu_y = np.mean(points[hull.vertices, 1])sigma_x = np.std(points[hull.vertices, 0])sigma_y = np.std(points[hull.vertices, 1])plt.scatter(nth_triple, average_triple, s=1, marker=',', color='orange', edgecolors='none')plt.plot(points[hull.vertices, 0], points[hull.vertices, 1], color='black', label='Convex Hull Outline', linestyle='dotted')plt.show()

The dashed lines are the equations I want to find:outlines

Any guidance would be greatly appreciated. Thanks in advance.


Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>