Skip to content

Commit

Permalink
replace with double quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaLingWeng authored Oct 24, 2023
1 parent 59b2a10 commit 640dcac
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/examples_arguments_syntax/arrow_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
vector1 = [0, 0, 3, -1]
vector2 = [0, 0, 2, 3]

v = pd.DataFrame([vector1, vector2], columns=['x1','y1','x2','y2'])
v = pd.DataFrame([vector1, vector2], columns=["x1","y1","x2","y2"])

# calculate the vector
v['x_'] = v['x2'] - v["x1"]
v['y_'] = v['y2'] - v["y1"]
v["x_"] = v["x2"] - v["x1"]
v["y_"] = v["y2"] - v["y1"]

# calculate the angle between current vector and the default point mark direction (0,1)
# dot product = (x_,y_) dot (0,1) = y_
v["norm"] = np.sqrt(v['x_']**2 + v['y_']**2)
v["theta"] = np.degrees(np.arccos(v['y_']/v["norm"] ))
v["norm"] = np.sqrt(v["x_"]**2 + v["y_"]**2)
v["theta"] = np.degrees(np.arccos(v["y_"]/v["norm"] ))


lines = alt.Chart(v).mark_line().encode(
x=alt.X("x1", scale=alt.Scale(domain=(-4, 4)), title='x'),
y=alt.Y("y1", scale=alt.Scale(domain=(-4, 4)), title='y'),
x=alt.X("x1", scale=alt.Scale(domain=(-4, 4)), title="x"),
y=alt.Y("y1", scale=alt.Scale(domain=(-4, 4)), title="y"),
x2="x2",
y2="y2"
)
Expand All @@ -36,7 +36,7 @@
y="y2",
angle=alt.Angle("theta", scale=alt.Scale(domain=[0, 360])),
size=alt.value(300),
color=alt.value('#000000')
color=alt.value("#000000")
)

lines + wedge
lines + wedge

0 comments on commit 640dcac

Please sign in to comment.