I am comparing straight line distances to the shortest discovered path. I have millions of points with a pair (straight line distance,shortest computed path) or (S,P) assigned to them. $0.0001 < S < 100$. $R=\frac{P}{S}$ and $D = P-S$

  1. Path is shorter than straight line ($R < 1$)
  2. Path is much longer than the straight line ($R >> 10$)

Small $D$ implies rounding errors and such cases are less interesting.

Example data

enter image description here

I am looking for a plot, possibly a scatter plot that would

  1. Work across several orders of magnitude
  2. Reveal cases with large $D$ and $R>>1$ or $R<1$ 3.$P$ and $S$ should be apparent from the plot

Scatter plot $log(R)$ vs $log(D)$ is attractive, but how to deal with negative $D$ values?


symlog seems to be what you are looking for. This is an simple version in python

import pandas
import matplotlib.pyplot as plt

df = pandas.DataFrame([
    {'s' : 1, 'p' : 1.8},
    {'s' : 0.0004, 'p' : 0.0003},
    {'s' : 5, 'p' : 4},
    {'s' : 0.0001, 'p' : 0.0201},
    {'s' : 0.1, 'p' : 5}
df['r'] = df['p'] / df['s']
df['d'] = df['p'] - df['s']

plt.ylim(-20, 20)

plt.plot(df['r'], df['d'], '*', ms = 4)

enter image description here

  • $\begingroup$ symlog was the answer. Thank you. $\endgroup$ – Stepan Feb 4 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.