after some great help from the Numpy users list, I have managed to
create "parallel curves".
Basically I have a set of X, Y data (around 1,000 elements each) and I
want to create 2 parallel "curves" (offset curves) to the original
one; "parallel" means curves which are displaced from the base curve
by a constant offset, either positive or negative, in the direction of
the curve's normal. I attach a sample demonstrating what I am doing
(and if you have the Shapely package installed, the two additional
subplots look even nicer).
Now, the generated parallels are really parallels (see right subplot),
but visually it doesn't seem so (see the left subplot) because the X
and Y scales are different and the axes area is not square. I know I
could force the axes to be equals via:
But I can't really do that with the set of data I have, as the X and Y
variables have different order of magnitude and I need a single
subplot on the figure to have rectangular axes (not square). In my
situation, unfortunately it wouldn't make sense to set the axes
square/equal as the plot will lose its meaning and visual usefulness.
I have been told to scale the X, Y variables normalizing them by the
display units of the plot, but I must be dumber than usual as I can't
get it to work properly. So, my question would be: how do I scale the
X and Y vectors so that the parallels look parallel to the main curve
even if the axes are not square and the X and Y variables have
Thank you in advance for your suggestions.
"Imagination Is The Only Weapon In The War Against Reality."
sample_buffer.py (3.82 KB)