Hi, I'm making a plot in which I plot a bunch of velocity vectors that show the deviation of the material from it's average velocity. I use quiverkey to show the size scale of the vectors, but I'd also like to show the mean velocity vector on the plot. So, what I need is the meaning of the scale value. I'm using units='dots' and have set the scale value by trial and error to 0.75 to get a good looking plot. Given these, can someone tell me how to translate some value from a magnitude for a vector to a length on my plot? I've looked at the code for quiver and quiverkey and it's a bit opaque to me, at least without spending significant time studying it. Regards, Jon ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA [hidden email] 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ _______________________________________________ Matplotlib-users mailing list [hidden email] https://mail.python.org/mailman/listinfo/matplotlib-users |
Jon,
The relevant parameters are 'scale_units' (not 'units') and 'scale'. I think the docstring entry for 'scale_units' will clarify the situation: scale_units : [ 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y' | 'xy' ], \ None, optional If the *scale* kwarg is *None*, the arrow length unit. Default is *None*. e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u,v) = (1,0)``, then the vector will be 0.5 inches long. If *scale_units* is 'width'/'height', then the vector will be half the width/height of the axes. If *scale_units* is 'x' then the vector will be 0.5 x-axis units. To plot vectors in the x-y plane, with u and v having the same units as x and y, use ``angles='xy', scale_units='xy', scale=1``. In other words, data_value * scale_units / scale = size in scale_units I suspect it would have been less confusing if scale had been defined as the reciprocal of what it is--but we are stuck with it as-is. Eric On 2018/03/01 10:53 AM, Slavin, Jonathan wrote: > Hi, > > I'm making a plot in which I plot a bunch of velocity vectors that show > the deviation of the material from it's average velocity. I use > quiverkey to show the size scale of the vectors, but I'd also like to > show the mean velocity vector on the plot. > So, what I need is the meaning of the scale value. I'm using > units='dots' and have set the scale value by trial and error to 0.75 to > get a good looking plot. Given these, can someone tell me how to > translate some value from a magnitude for a vector to a length on my > plot? I've looked at the code for quiver and quiverkey and it's a bit > opaque to me, at least without spending significant time studying it. > > Regards, > Jon > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > [hidden email] <mailto:[hidden email]> 60 Garden > Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > > _______________________________________________ > Matplotlib-users mailing list > [hidden email] > https://mail.python.org/mailman/listinfo/matplotlib-users > _______________________________________________ Matplotlib-users mailing list [hidden email] https://mail.python.org/mailman/listinfo/matplotlib-users |
Free forum by Nabble | Edit this page |