[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Matplotlib-users] "Visually equivalent" contours/parallels Andrea Gavana Tue Feb 14 08:01:19 2012

Hi Jerzy,

On 14 February 2012 16:03, Jerzy Karczmarczuk wrote:
> Andrea Gavana :
>> after some great help from the Numpy users list, I have managed to
>> create "parallel curves".
>> 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).
> (...)
>> 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
>> different data-ranges/magnitudes?
> Andrea, you have TWO problems.
> The first is to scale your offset according to your axes range. This can
> be done using ax.get_data_ratio(). In your case you will get 5, and this
> factor should enhance your vertical offset wrt. the horizontal.
> (Or, use .get_xlim() and .get_ylim() and do the computations yourself).

Thank you for your answer, I have implemented this and it looks a bit
better (on the real X/Y pairs I have).

> The second problem is that your FIGURE scales your plot visually,
> independently of your axes, so without special scaling it will have
> different aspects according to your manipulation. An arbitrary affine
> transform will keep straight lines parallel, but no chance with
> arbitrary curves.  You may play with fig.get_figwidth(), etc., but here
> my digging stops.

Will this argument still stand if I am only interested in a single
figure size (maximized window on my screen, plus set_size_inches(20,
12)) and fixed axes positions (set by figure.subplots_adjust)? If not,
should the further scaling simply be the ratio between the x-axis
extent and y-axis extent (in pixels)? Or am I missing something

Thank you in advance for your suggestions.


"Imagination Is The Only Weapon In The War Against Reality."

Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
Matplotlib-users mailing list