[Matplotlib-users] resizing of markers when a plot is resized ?"
Hi folks, I have a marker on a plot that is 5 units long, if I resize the figure, the markers don't get resized appropriately. How do I address this? code snippet to display markers: self.axes.annotate("text", xy=(0.5, 0.5), markerprops=dict(marker=TICKRIGHT, markerfacecolor='black', markersize=5, markeredgecolor='black', markeredgewidth = 2),) -iyer Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] question on annotating subplot / size of markers
Hello, I was wondering if it would be possible to draw a vertical line in a subplot, in such a way that the line exactly covers top to bottom of the subplot, say - if the subplot has a height of 80 points, the vertical line's length will be 80 points. Also, this vertical line may have an horizontal line that starts from it for a given length. like this |-; | being the vertical line and being the horizontal line. Is there any way to implement this in Matplotlib. It'd also be nice to have a text annotating the horizontal and vertical line, something like this: --- | | | |annotation1 | | subplot | | | | | | | | | --- There likely will be 3-4 subplots like the above in a figure. The 3-4 subplots contain a plot of some data. In effect, it is like placing an annotation on the subplot data with a marker that illustrates the data position where the annotation is, and the length of the marker that specifies how long the portion of data on the plot the annotation runs. Here's a snippet I wrote, but it doesn't cover the height of the subplot fully, it takes xycoords as 'data'. self.axes.annotate("annotation1", xy=(locn,ytextlocn), xycoords='data', color='brown', markerprops=dict(marker='|', markerfacecolor='black', markersize=94, markeredgecolor='black', markeredgewidth = 2), ) self.axes.annotate("annotation1", xy=(locn, ytextlocn), xycoords='data', color='brown', markerprops=dict(marker=TICKRIGHT, markerfacecolor='black', markersize=(length_of_annotation1), markeredgecolor='black', markeredgewidth = 2), horizontalalignment='right', verticalalignment='top', ) What could be the best way to avoid annotations from overlapping in the plot? I guess this is kind of a complicated question. Please let me know if I wasn't sufficiently clear. I'm new to Mpl, and I may have overlooked something, or I may be doing something wrong. Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
Hi I apologize for my late response, I was in the hospital. Thanks for the tip, the ticks are now magically divided by a constant. Here's some input on scaling the input data: Say -- you have 25000 points of data. You want to capture each and every point of data on a plot. Mpl lists the ticks as a function of the number of data points, which is cool. Now comes a situation where in you want to manipulate the ticks to display - say the time, for eg., the 100th data point came in at 1 sec, the 200th came in at 2 sec, and so on - Is scaling the input data the way to go ? -iyer --- John Hunter <[EMAIL PROTECTED]> wrote: > On 4/10/07, Iyer <[EMAIL PROTECTED]> wrote: > > > If only someone could guide me, so that I can > > understand better how to "translate" the ticks > from > > the default "number of sample" ticks to that of > > different ticks - say > > new_ticks=original_ticks/(some_constant). Right > now > > I'm clueless, your input will help a lot in > > understanding Mpl. > > > OK, your persistence is admirable. You are still > asking the wrong > question and applying the wrong solution, but > dog-golly, you've earned > the right to do it the wrong way! > > from matplotlib.ticker import FuncFormatter > > def myformatter(x, pos=None): > return '%1.3f'%(x/4.) > > ax = subplot(111) > ax.plot(x, y) > ax.xaxis.set_major_formatter(FuncFormatter(myformatter)) > > Now all your ticks are magically divided by 4. > > But really, simply scaling your x input data is the > way to go. If we > want to move this conversation forward, you should > try instead > > plot(x/4, y) > > and then explain as clearly as possibly this doesn't > do what you want. > Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
With all respect, I have certainly perused the tutorials before posting the question. I'm still a newbie and I acknowledge I have miles and miles to go before I can be someone who can help out in the Matplotlib group like you guys do. The problem is simple, it is like the date examples in the Matplotlib code -- the ticks for the date examples (seconds, hours, time etc) are different from the usual ticks, which is usually the number of samples. If only someone could guide me, so that I can understand better how to "translate" the ticks from the default "number of sample" ticks to that of different ticks - say new_ticks=original_ticks/(some_constant). Right now I'm clueless, your input will help a lot in understanding Mpl. Thanks guys for your feedback and help iyer --- Eric Firing <[EMAIL PROTECTED]> wrote: > There seems to be a huge misunderstanding here, and > I am not sure what > it is, but what you need to do is run examples and > experiment with > variations until you have some inkling of what mpl > is actually doing. > Start with > http://matplotlib.sourceforge.net/tutorial.html. > > Please note that the ticks are simply labeled > locations--they have no > effect on what data are plotted. > > When you do ax.plot(ind*dt, y), absolutely *nothing* > is lost; every > value of y in your array is plotted. mpl is plotting > (x,y) pairs--all of > them--and labeling the axes accordingly. > > To see what is being plotted, you can use > plot(x,y,'ro'), for example, > to plot each point as a red circle. Experiment with > this. > > Don't worry right now about avoiding the pylab > interface; take advantage > of its simplicity to get the most basic plotting > concepts straightened > out via quick experimentation. Use the gui zoom > button to see how axis > labeling works. Make your own simple examples; plot > random points, plot > sin waves. > > Eric > > Iyer wrote: > > It is not what I need.. > > > > > http://matplotlib.sourceforge.net/matplotlib.axes.html > > > > The plot method (plot(self, *args, **kwargs)) > accepts > > only x,y pairs, in ax.plot(ind*dt, y) -- the x > > parameter is ind*dt - the sample times, but the > data > > between the sample points is lost. IMHO, the > likely > > way to prevent loss of sampled data points is > changing > > the ticks, isn't that possible to change the > ticks, > > while keeping the data as it is -- plotted as if > it > > were for a number of data points. > > > > -iyer > > > > > > > > > > --- John Hunter <[EMAIL PROTECTED]> wrote: > > > >> On 4/10/07, John Hunter <[EMAIL PROTECTED]> > wrote: > >>> On 4/10/07, Iyer <[EMAIL PROTECTED]> wrote: > >>>> I apologize if I haven't been sufficiently > >> clear. > >>>> While your suggestion picks out the samples > from > >> the > >>>> sample set, and discards other samples - what I > >> was > >>>> looking at -- > >> My suggestion does not "discard other samples", > so > >> you may not be > >> understanding what I am saying. Perhaps you can > try > >> the suggested > >> code and see if it does what you want. My > example > >> plots all the > >> samples; it simply scales the xaxis to represent > >> time and not sample > >> number. > >> > > > > > > > > > > > > > Looking for earth-friendly autos? > > Browse Top Cars by "Green Rating" at Yahoo! Autos' > Green Center. > > http://autos.yahoo.com/green_center/ > > > > > - > > Take Surveys. Earn Cash. Influence the Future of > IT > > Join SourceForge.net's Techsay panel and you'll > get the chance to share your > > opinions on IT & business topics through brief > surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
It is not what I need.. http://matplotlib.sourceforge.net/matplotlib.axes.html The plot method (plot(self, *args, **kwargs)) accepts only x,y pairs, in ax.plot(ind*dt, y) -- the x parameter is ind*dt - the sample times, but the data between the sample points is lost. IMHO, the likely way to prevent loss of sampled data points is changing the ticks, isn't that possible to change the ticks, while keeping the data as it is -- plotted as if it were for a number of data points. -iyer --- John Hunter <[EMAIL PROTECTED]> wrote: > On 4/10/07, John Hunter <[EMAIL PROTECTED]> wrote: > > On 4/10/07, Iyer <[EMAIL PROTECTED]> wrote: > > > I apologize if I haven't been sufficiently > clear. > > > > > > While your suggestion picks out the samples from > the > > > sample set, and discards other samples - what I > was > > > looking at -- > > My suggestion does not "discard other samples", so > you may not be > understanding what I am saying. Perhaps you can try > the suggested > code and see if it does what you want. My example > plots all the > samples; it simply scales the xaxis to represent > time and not sample > number. > Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
Wouldn't it make sense to simply change the xticks to reflect the time instead of the number of data points ? Like, if we needed to display 0 t0 1000 points over a period of time, wouldn't it be nice to translate the xticks to reflect the period of time ? Would you suggest using IndexLocator in that sense ? -iyer > hence is there a good way > to > > "translate ticks" ? > > Yes, you can certainly do this, but what we are > suggesting is that it > makes more sense to simply scale your data before > plotting. Is there > a reason you don't want to do this > > ax.plot(ind*dt, y) > > The index locator > > JDH > Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
I apologize if I haven't been sufficiently clear. While your suggestion picks out the samples from the sample set, and discards other samples - what I was looking at -- when I plot a sample set, of say - 1000 points, the xticks shows up as 0 to 1000 points on the plot. I was wondering if there could be a way to translate the xtick display to that of seconds, if the sampling frequency is 250 Hz, the plot would still display the original data set, but with different xticks -- for e.g. it would display xticks as 0 to 4 seconds rather than 0 to 1000 points.. hence is there a good way to "translate ticks" ? -iyer --- John Hunter <[EMAIL PROTECTED]> wrote: > On 4/10/07, Iyer <[EMAIL PROTECTED]> wrote: > > I'd like to avoid the pylab interface... > > linspace is good. > > from matplotlib.mlab import linspace > > But linspace may not be what you want. Probably > better: > > In [1]: Fs = 4. # sampling at 4Hz > > In [2]: dt = 1./Fs > > In [3]: import numpy > > In [4]: ind = numpy.arange(1000.) # the sample > number > > In [5]: t = ind*dt # the sample times > > In [6]: t[0] > Out[6]: 0.0 > > In [7]: t[1] > Out[7]: 0.25 > > > linspace gives a slightly different answer, because > it includes the > endpoint. Sometimes this is what you want, > sometimes not. > The fish are biting. Get more visitors on your site using Yahoo! Search Marketing. http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
Thanx for the response.. I'd like to avoid the pylab interface... linspace is good. assume you have 1000 points of data and you'd like the ticks to display from 0 to 4, since the 1000 points of data were sampled at 250 Hz. any "non-pylab" ideas ? Indexlocator? -iyer --- Antonio Gonzalez <[EMAIL PROTECTED]> wrote: > Not sure if I understand, but I think this is what > you want to do: > > y = rand(1000) # your 1000 random points > x = linspace(0, 250, y.size) > plot(x,y) > > /A > > > Iyer wrote: > > I think this is a trivial question.. > > > > If there are a set of data points being plotted in > a > > subplot, say 0 to 1000 points; the subplot > displays > > the ticks as 0 to 1000 points and it is desired to > > "translate" those points to 0 t0 250 points on the > > subplot display - with point 0 mapping to point 0, > > point 250 mapping to point 2 and so on, what could > be > > the best way to do this ? > > > > Just curious, > > thanks, > > iyer > > > > > > > > > > > > > > > > > > > Never miss an email again! > > Yahoo! Toolbar alerts you the instant new Mail > arrives. > > > http://tools.search.yahoo.com/toolbar/features/mail/ > > > > > - > > Take Surveys. Earn Cash. Influence the Future of > IT > > Join SourceForge.net's Techsay panel and you'll > get the chance to share your > > opinions on IT & business topics through brief > surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Translating ticks a la MultipleLocator ?
I think this is a trivial question.. If there are a set of data points being plotted in a subplot, say 0 to 1000 points; the subplot displays the ticks as 0 to 1000 points and it is desired to "translate" those points to 0 t0 250 points on the subplot display - with point 0 mapping to point 0, point 250 mapping to point 2 and so on, what could be the best way to do this ? Just curious, thanks, iyer Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Scrollbars and subplots..
That's unfortunate that a subplot cannot be bounded within a scrollbar.. I guess if it could be possible to turn a subplot into a GUI widget and have GUI widgets over another GUI widget (the frame), that'd be good... I was wondering how we can differentiate between data on a subplot and the background. i.e, if there is a subplot such as: _ | __/\___| | / \ | | \ | |_| what could be the best way to predict where the subplot starts and ends ? thanx, iyer John Hunter <[EMAIL PROTECTED]> wrote: On 3/26/07, lazardo wrote: > > Thanks for your helpful response. > > I used wx, I'm mystified to as how to make the scroll bars bound the > subplot. not the frame. The gtk example you pointed me to creates horizontal > and vertical scrollbars around the whole frame, not within the subplot. > i.e., if the subplot is very large , scrollbars bounding the subplot would > be great.. This is not possible. The subplot is not a GUI widget in matplotlib, it is part of the entire FigureCanvas, which is a widget. You can make the Axes take up all of the figure area if you want ax = axes([0,1,0,1]) but then you will not see you tick labels and axis labels as they will be outside the canvas area JDH - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users