MCPcopy Index your code
hub / github.com/plotly/plotly.py / __init__

Method __init__

plotly/figure_factory/_streamline.py:137–168  ·  view source on GitHub ↗
(self, x, y, u, v, density, angle, arrow_scale, **kwargs)

Source from the content-addressed store, hash-verified

135 """
136
137 def __init__(self, x, y, u, v, density, angle, arrow_scale, **kwargs):
138 self.x = np.array(x)
139 self.y = np.array(y)
140 self.u = np.array(u)
141 self.v = np.array(v)
142 self.angle = angle
143 self.arrow_scale = arrow_scale
144 self.density = int(30 * density) # Scale similarly to other functions
145 self.delta_x = self.x[1] - self.x[0]
146 self.delta_y = self.y[1] - self.y[0]
147 self.val_x = self.x
148 self.val_y = self.y
149
150 # Set up spacing
151 self.blank = np.zeros((self.density, self.density))
152 self.spacing_x = len(self.x) / float(self.density - 1)
153 self.spacing_y = len(self.y) / float(self.density - 1)
154 self.trajectories = []
155
156 # Rescale speed onto axes-coordinates
157 self.u = self.u / (self.x[-1] - self.x[0])
158 self.v = self.v / (self.y[-1] - self.y[0])
159 self.speed = np.sqrt(self.u**2 + self.v**2)
160
161 # Rescale u and v for integrations.
162 self.u *= len(self.x)
163 self.v *= len(self.y)
164 self.st_x = []
165 self.st_y = []
166 self.get_streamlines()
167 streamline_x, streamline_y = self.sum_streamlines()
168 arrows_x, arrows_y = self.get_streamline_arrows()
169
170 def blank_pos(self, xi, yi):
171 """

Callers

nothing calls this directly

Calls 5

get_streamlinesMethod · 0.95
sum_streamlinesMethod · 0.95
get_streamline_arrowsMethod · 0.95
intFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected