Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Mads Ipsen <madsipsen@gm...>  20110309 11:07:47

Hi, I am using the Qt4 based back engine for displaying a 2D plot in a widget. The plot typically contains lots of line plots. Suppose I add a CirclePolygon to the plot like this: circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', facecolor='red', zorder=1) axes.add_patch(circle) Then when I start to zoom in the window the aspect ratio of the circle is not preserved (it appears like an ellipse). If you plot a line with points, displaying its points using circles, these circles do have their aspect ratio (and size) preserved. There must be some approach for achieving the same effect for a manually added circle. Any help is appreciated, Best regards, Mads  ++  Mads Ipsen, Scientific developer  +++  QuantumWise A/S  phone: +4529716388   Lersø Parkallé 107  www: http://www.quantumwise.com   DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  +++ 
From: Aman Thakral <aman.thakral@gm...>  20110309 13:44:40
Attachments:
Message as HTML

Hi Mads, Did you add axis='equal' to you axes command? e.g. ax = fig.add_subplot(111, aspect='equal') Aman On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen <madsipsen@...> wrote: > Hi, > > I am using the Qt4 based back engine for displaying a 2D plot in a > widget. The plot typically contains lots of line plots. Suppose I add a > CirclePolygon to the plot like this: > > circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', > facecolor='red', zorder=1) > axes.add_patch(circle) > > Then when I start to zoom in the window the aspect ratio of the circle > is not preserved (it appears like an ellipse). If you plot a line with > points, displaying its points using circles, these circles do have their > aspect ratio (and size) preserved. There must be some approach for > achieving the same effect for a manually added circle. > > Any help is appreciated, > > Best regards, > > Mads > >  > ++ >  Mads Ipsen, Scientific developer  > +++ >  QuantumWise A/S  phone: +4529716388  >  Lersø Parkallé 107  www: http://www.quantumwise.com  >  DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  > +++ > > > > >  > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization  today and in the future. > http://p.sf.net/sfu/internapsfd2d > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Mads Ipsen <madsipsen@gm...>  20110309 13:58:31
Attachments:
Message as HTML

I tried that, but that will make the entire plot look very strange if xlim = [0;100] and ylim=[1:1]. What I really want to do is add a scale free aspect ratio correct circle to the plot. Just like the circles that appear on a scatter plot. Best regards, Mads On 20110309 14:44, Aman Thakral wrote: > Hi Mads, > > Did you add axis='equal' to you axes command? > > e.g. ax = fig.add_subplot(111, aspect='equal') > > > Aman > > On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen <madsipsen@... > <mailto:madsipsen@...>> wrote: > > Hi, > > I am using the Qt4 based back engine for displaying a 2D plot in a > widget. The plot typically contains lots of line plots. Suppose I > add a > CirclePolygon to the plot like this: > > circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', > facecolor='red', zorder=1) > axes.add_patch(circle) > > Then when I start to zoom in the window the aspect ratio of the circle > is not preserved (it appears like an ellipse). If you plot a line with > points, displaying its points using circles, these circles do have > their > aspect ratio (and size) preserved. There must be some approach for > achieving the same effect for a manually added circle. > > Any help is appreciated, > > Best regards, > > Mads > >  > ++ >  Mads Ipsen, Scientific developer  > +++ >  QuantumWise A/S  phone: +4529716388  >  Lersø Parkallé 107  www: http://www.quantumwise.com > <http://www.quantumwise.com>;  >  DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@... > <mailto:mads.ipsen@...>  > +++ > > > >  > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization  today and in the future. > http://p.sf.net/sfu/internapsfd2d > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > <mailto:Matplotlibusers@...> > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >  ++  Mads Ipsen, Scientific developer  +++  QuantumWise A/S  phone: +4529716388   Lersø Parkallé 107  www: http://www.quantumwise.com   DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  +++ 
From: Aman Thakral <aman.thakral@gm...>  20110309 14:01:20
Attachments:
Message as HTML

Could you provide some sample code that recreates the problem (and shows what you're trying to accomplish)? On Wed, Mar 9, 2011 at 8:58 AM, Mads Ipsen <madsipsen@...> wrote: > I tried that, but that will make the entire plot look very strange if xlim > = [0;100] and ylim=[1:1]. > > What I really want to do is add a scale free aspect ratio correct circle to > the plot. Just like the circles that appear on a scatter plot. > > Best regards, > > Mads > > > On 20110309 14:44, Aman Thakral wrote: > > Hi Mads, > > Did you add axis='equal' to you axes command? > > e.g. ax = fig.add_subplot(111, aspect='equal') > > Aman > > On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen <madsipsen@...> wrote: > >> Hi, >> >> I am using the Qt4 based back engine for displaying a 2D plot in a >> widget. The plot typically contains lots of line plots. Suppose I add a >> CirclePolygon to the plot like this: >> >> circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', >> facecolor='red', zorder=1) >> axes.add_patch(circle) >> >> Then when I start to zoom in the window the aspect ratio of the circle >> is not preserved (it appears like an ellipse). If you plot a line with >> points, displaying its points using circles, these circles do have their >> aspect ratio (and size) preserved. There must be some approach for >> achieving the same effect for a manually added circle. >> >> Any help is appreciated, >> >> Best regards, >> >> Mads >> >>  >> ++ >>  Mads Ipsen, Scientific developer  >> +++ >>  QuantumWise A/S  phone: +4529716388  >>  Lersø Parkallé 107  www: http://www.quantumwise.com  >>  DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  >> +++ >> >> >> >> >>  >> Colocation vs. Managed Hosting >> A question and answer guide to determining the best fit >> for your organization  today and in the future. >> http://p.sf.net/sfu/internapsfd2d >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > > >  > ++ >  Mads Ipsen, Scientific developer  > +++ >  QuantumWise A/S  phone: +4529716388  >  Lersø Parkallé 107  www: http://www.quantumwise.com  >  DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  > +++ > > > 
From: Mads Ipsen <madsipsen@gm...>  20110309 14:15:24
Attachments:
Message as HTML

Here is a script (below). I want the blue circle to appear as a circle with a 1:1 aspect ratio, making it look like a circle and not an ellipse. Just like the scale free circles making up the curve of the damped oscillationsn also shown in the plot. Preferably, the circle should also be scale free making it have the same size nomatter how much the plot has been zoomed. Best regards, Mads import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import CirclePolygon x = np.arange(0, 10, 0.1) y = np.exp(x/2.) * np.sin(2*np.pi*x) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, 'ro', zorder=0) ax.set_xlim(0, 10) ax.set_ylim(1, 1) # I want this circle to appear as a circle circle = CirclePolygon((7.5,0.0), radius=0.1, zorder=1) ax.add_patch(circle) plt.show() On 20110309 15:00, Aman Thakral wrote: > Could you provide some sample code that recreates the problem (and > shows what you're trying to accomplish)? > > On Wed, Mar 9, 2011 at 8:58 AM, Mads Ipsen <madsipsen@... > <mailto:madsipsen@...>> wrote: > > I tried that, but that will make the entire plot look very strange > if xlim = [0;100] and ylim=[1:1]. > > What I really want to do is add a scale free aspect ratio correct > circle to the plot. Just like the circles that appear on a scatter > plot. > > Best regards, > > Mads > > > On 20110309 14:44, Aman Thakral wrote: >> Hi Mads, >> >> Did you add axis='equal' to you axes command? >> >> e.g. ax = fig.add_subplot(111, aspect='equal') >> >> >> Aman >> >> On Wed, Mar 9, 2011 at 6:07 AM, Mads Ipsen <madsipsen@... >> <mailto:madsipsen@...>> wrote: >> >> Hi, >> >> I am using the Qt4 based back engine for displaying a 2D plot >> in a >> widget. The plot typically contains lots of line plots. >> Suppose I add a >> CirclePolygon to the plot like this: >> >> circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', >> facecolor='red', zorder=1) >> axes.add_patch(circle) >> >> Then when I start to zoom in the window the aspect ratio of >> the circle >> is not preserved (it appears like an ellipse). If you plot a >> line with >> points, displaying its points using circles, these circles do >> have their >> aspect ratio (and size) preserved. There must be some >> approach for >> achieving the same effect for a manually added circle. >> >> Any help is appreciated, >> >> Best regards, >> >> Mads >> >>  >> ++ >>  Mads Ipsen, Scientific developer  >> +++ >>  QuantumWise A/S  phone: +4529716388  >>  Lersø Parkallé 107  www: http://www.quantumwise.com >> <http://www.quantumwise.com>;  >>  DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@... >> <mailto:mads.ipsen@...>  >> +++ >> >> >> >>  >> Colocation vs. Managed Hosting >> A question and answer guide to determining the best fit >> for your organization  today and in the future. >> http://p.sf.net/sfu/internapsfd2d >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> <mailto:Matplotlibusers@...> >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> > >  > ++ >  Mads Ipsen, Scientific developer  > +++ >  QuantumWise A/S  phone: +4529716388  >  Lersø Parkallé 107  www:www.quantumwise.com <http://www.quantumwise.com>;  >  DK2100 Copenhagen Ø, Denmark  email:mads.ipsen@... <mailto:mads.ipsen@...>  > +++ > > >  ++  Mads Ipsen, Scientific developer  +++  QuantumWise A/S  phone: +4529716388   Lersø Parkallé 107  www: http://www.quantumwise.com   DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  +++ 
From: Warren Weckesser <warren.weckesser@en...>  20110309 14:28:27
Attachments:
text/plain
image.png

From: JaeJoon Lee <lee.j.joon@gm...>  20110309 16:42:15

You may use offsetbox module. Here is an complete example. Note that the circle always has a size of 25 point and also is draggable, Regards, JJ import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import CirclePolygon, Circle x = np.arange(0, 10, 0.1) y = np.exp(x/2.) * np.sin(2*np.pi*x) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, 'ro', zorder=0) ax.set_xlim(0, 10) ax.set_ylim(1, 1) # I want this circle to appear as a circle from matplotlib.offsetbox import DrawingArea, AnnotationBbox, DraggableAnnotation circle_radius = 25 # in points da = DrawingArea(width=2*circle_radius, height=2*circle_radius, xdescent=circle_radius, ydescent=circle_radius, clip=False) circle = Circle((0.,0.), radius=circle_radius, zorder=1, alpha=0.5) da.add_artist(circle) an1 = AnnotationBbox(da, xy=(7.5, 0.0), xycoords='data', frameon=False, pad=0., annotation_clip=False, box_alignment=(0.5, 0.5), ) ax.add_artist(an1) class DraggableAnn(DraggableAnnotation): def finalize_offset(self): loc_in_canvas = self.annotation.xytext self.annotation.textcoords = "data" pos_data = self.annotation.axes.transData.inverted().transform_point(loc_in_canvas) self.annotation.xytext = tuple(pos_data) drag1 = DraggableAnn(an1, use_blit=False) plt.show() On Wed, Mar 9, 2011 at 11:15 PM, Mads Ipsen <madsipsen@...> wrote: > I want the blue circle to appear as a circle with a 1:1 aspect ratio, making > it look like a circle and not an ellipse. Just like the scale free circles > making up the curve of the damped oscillationsn also shown in the plot. > > Preferably, the circle should also be scale free making it have the same > size nomatter how much the plot has been zoomed. > > 
From: Benjamin Root <ben.root@ou...>  20110309 14:29:03

On Wednesday, March 9, 2011, Mads Ipsen <madsipsen@...> wrote: > Hi, > > I am using the Qt4 based back engine for displaying a 2D plot in a > widget. The plot typically contains lots of line plots. Suppose I add a > CirclePolygon to the plot like this: > > circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', > facecolor='red', zorder=1) > axes.add_patch(circle) > > Then when I start to zoom in the window the aspect ratio of the circle > is not preserved (it appears like an ellipse). If you plot a line with > points, displaying its points using circles, these circles do have their > aspect ratio (and size) preserved. There must be some approach for > achieving the same effect for a manually added circle. > > Any help is appreciated, > > Best regards, > > Mads > Mads, The way this is done is tricky. The transform object assigned to the circles in plot() and scatter() are different than the default when you make a circle polygon yourself. The easiest way to get them is to just simply use scatter() and pass in your own size value. I hope that helps! Ben Root 
From: Mads Ipsen <madsipsen@gm...>  20110309 15:13:14

Thanks. The intention is to make the added circle dragable by the mouse by listening to mouse press, move, and release. That means that I have to modify the data of the added scatter data. I believe that the axes.scatter() method returns a matplotlib.collections.CircleCollection object. How do I change the position of the circles (one circle) contained in this object? Mads On 20110309 15:28, Benjamin Root wrote: > On Wednesday, March 9, 2011, Mads Ipsen<madsipsen@...> wrote: >> Hi, >> >> I am using the Qt4 based back engine for displaying a 2D plot in a >> widget. The plot typically contains lots of line plots. Suppose I add a >> CirclePolygon to the plot like this: >> >> circle = CirclePolygon((x,y), radius=0.04, edgecolor='black', >> facecolor='red', zorder=1) >> axes.add_patch(circle) >> >> Then when I start to zoom in the window the aspect ratio of the circle >> is not preserved (it appears like an ellipse). If you plot a line with >> points, displaying its points using circles, these circles do have their >> aspect ratio (and size) preserved. There must be some approach for >> achieving the same effect for a manually added circle. >> >> Any help is appreciated, >> >> Best regards, >> >> Mads >> > Mads, > > The way this is done is tricky. The transform object assigned to the > circles in plot() and scatter() are different than the default when > you make a circle polygon yourself. The easiest way to get them is to > just simply use scatter() and pass in your own size value. > > I hope that helps! > Ben Root  ++  Mads Ipsen, Scientific developer  +++  QuantumWise A/S  phone: +4529716388   Lersø Parkallé 107  www: http://www.quantumwise.com   DK2100 Copenhagen Ø, Denmark  email: mads.ipsen@...  +++ 
Sign up for the SourceForge newsletter:
No, thanks