Scaling graph

Hi,

I'm trying to draw a line given an angle, magnitude, x0 and y0 location on a 2d line plot. I use the "cosine" and "sine" to find the x1 and y1 locations so that I can draw a line segment from x0, y0 to x1, y1. This works fine on a 200 x 200 (Width x Height) pixel graph. However, I have an input form where the user can change the plot size, for example 200x800 or 800x200.

The "magnitude" is along the y-axis and "time" is along the x-axis. At a particular point in time the magnitude and angle is given and I have to calculate the x1 and y1 values. The max magnitude along the y-axis (height) is always the same whether it is 200 pixels in height or 800 pixels in height.

The scientist I'm working with wants to see the magnitude (x1,y1) of each plot look correct if the graph is 800 pixels or 200 pixels in height. He also wants the correct angle if you stretch the graph from 200 pixels wide to 800 pixels wide and then down to 100 pixels wide.

I've been trying to use a ratio of the graph size to maintain the correct sizing but with no luck. Basically, the scientist want to maintain the same angle and reduce or increase the magnitude in the y-axis if the graph height is reduced or increased.

Does anyone have an answer to this solution? Maintaining the same angle and varying the magnitude based on the y-axis height.

Since, I have a lot of points I started to use a LineCollection to speed the rendering speed.

Gerardo

Gerardo,

I think the approach used in this code should do what you want. Dorry I don't have time for more explanation...

-Chris

Gerardo Rivera wrote:

VecPlot.py (2.4 KB)

···

Hi,

I'm trying to draw a line given an angle, magnitude, x0 and y0 location on a 2d line plot. I use the "cosine" and "sine" to find the x1 and y1 locations so that I can draw a line segment from x0, y0 to x1, y1. This works fine on a 200 x 200 (Width x Height) pixel graph. However, I have an input form where the user can change the plot size, for example 200x800 or 800x200.

The "magnitude" is along the y-axis and "time" is along the x-axis. At a particular point in time the magnitude and angle is given and I have to calculate the x1 and y1 values. The max magnitude along the y-axis (height) is always the same whether it is 200 pixels in height or 800 pixels in height.

The scientist I'm working with wants to see the magnitude (x1,y1) of each plot look correct if the graph is 800 pixels or 200 pixels in height. He also wants the correct angle if you stretch the graph from 200 pixels wide to 800 pixels wide and then down to 100 pixels wide.

I've been trying to use a ratio of the graph size to maintain the correct sizing but with no luck. Basically, the scientist want to maintain the same angle and reduce or increase the magnitude in the y-axis if the graph height is reduced or increased.

Does anyone have an answer to this solution? Maintaining the same angle and varying the magnitude based on the y-axis height.

Since, I have a lot of points I started to use a LineCollection to speed the rendering speed.

Gerardo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...