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

Class _Quiver

plotly/figure_factory/_quiver.py:125–265  ·  view source on GitHub ↗

Refer to FigureFactory.create_quiver() for docstring

Source from the content-addressed store, hash-verified

123
124
125class _Quiver(object):
126 """
127 Refer to FigureFactory.create_quiver() for docstring
128 """
129
130 def __init__(self, x, y, u, v, scale, arrow_scale, angle, scaleratio=1, **kwargs):
131 try:
132 x = utils.flatten(x)
133 except exceptions.PlotlyError:
134 pass
135
136 try:
137 y = utils.flatten(y)
138 except exceptions.PlotlyError:
139 pass
140
141 try:
142 u = utils.flatten(u)
143 except exceptions.PlotlyError:
144 pass
145
146 try:
147 v = utils.flatten(v)
148 except exceptions.PlotlyError:
149 pass
150
151 self.x = x
152 self.y = y
153 self.u = u
154 self.v = v
155 self.scale = scale
156 self.scaleratio = scaleratio
157 self.arrow_scale = arrow_scale
158 self.angle = angle
159 self.end_x = []
160 self.end_y = []
161 self.scale_uv()
162 barb_x, barb_y = self.get_barbs()
163 arrow_x, arrow_y = self.get_quiver_arrows()
164
165 def scale_uv(self):
166 """
167 Scales u and v to avoid overlap of the arrows.
168
169 u and v are added to x and y to get the
170 endpoints of the arrows so a smaller scale value will
171 result in less overlap of arrows.
172 """
173 self.u = [i * self.scale * self.scaleratio for i in self.u]
174 self.v = [i * self.scale for i in self.v]
175
176 def get_barbs(self):
177 """
178 Creates x and y startpoint and endpoint pairs
179
180 After finding the endpoint of each barb this zips startpoint and
181 endpoint pairs to create 2 lists: x_values for barbs and y values
182 for barbs

Callers 1

create_quiverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected