plotly / plotly/plotly.py

useless line in the _Quiver class definition

Open
#3,490 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

In the _Quiver class definition (more precisely within the body of one of its methods) there is a useless line https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/figure_factory/_quiver.py#L257 which just leads to repeating the calculations of the elements in the four lists under the for loop:

for index in range(len(self.end_x)):
    point1_x = [i - j * self.scaleratio for i, j in zip(self.end_x, seg1_x)]
    point1_y = [i - j for i, j in zip(self.end_y, seg1_y)]
    point2_x = [i - j * self.scaleratio for i, j in zip(self.end_x, seg2_x)]
    point2_y = [i - j for i, j in zip(self.end_y, seg2_y)]

The for line must be removed and the next four lines moved a tab at left.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open packages/python/plotly/plotly/figure_factory/_quiver.py at line 257 and inspect the surrounding _Quiver method. Remove the loop line and move the four listed assignments outward as requested. Done means the calculations are performed once rather than repeated for each index; verify existing quiver behavior afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.