From: pybokeh <pybokeh@gm...>  20120613 20:01:33

Are you trying to make 9 scatter plots? In your for loop, if you are trying to make a set of x values and a set of y values, then I think this is wrong. Since you didn't provide import statements I don't know which rand() function you are using. Assuming it is scipy.rand(), you will only have one x value and one y value, not much of scatter chart with just one point :) Otherwise, Mike's suggestion is valid. Regards, Daniel On Jun 13, 2012 3:35 PM, "Steven Boada" <boada@...> wrote: > Whoops, I forgot to change the subject. Sorry list. > > List, > > I'm making a scatter plot using a for loop. Here's a simple example.. > > for i in range(10): > x=rand() > y=rand() > scatter(x,y,label='point') > > legend() > show() > > > When you do this, you get a legend entry for every single point. In this > case, I get 9 entries in my legend. > > Is there a way to only get a single entry? I have looked into creating > the legends by hand, but I'm not having much luck. Googling, only turned > up a single example of someone else with the same problem. > > Help me list, you're my only hope. > > Steven > > On 06/13/2012 01:33 PM, Eric Firing wrote: > > On 06/13/2012 07:31 AM, jonasr wrote: > >> Hi, > >> > >> im actually trying to make a countour plot Z=f(X,Y) from two variables > X,Y . > >> My Problem is that i have to use a logarithmic scale for the Z values. > >> If i plot the data with the logarithmic scale it gets pretty ugly, > because i > >> have a lot of values which are zero, > >> which means on the log scale the value goes to inf. > >> Here is an example what i mean > >> > >> http://www.imagebanana.com/view/qh1khpxp/example.png > >> > >> I acutally have no idea how to make the plot look better, > >> maybe somebody has an idea ? > > Use np.ma.masked_less to mask out values below some threshold before > > taking the log. > > > > e.g., > > > > import matplotlib.pyplot as plt > > import numpy as np > > x = np.arange(0, 1, 0.01) > > y = np.arange(0, 8, 0.05) > > X, Y = np.meshgrid(x, y) > > Z = 10 ** (5 + 11 * X * np.sin(Y)) > > Z = np.ma.masked_less(Z, 1e4) > > Zlog = np.ma.log10(Z) > > CS = plt.contourf(X, Y, Zlog, levels=np.arange(3, 5.01, 1.0), > > extend='both') > > plt.colorbar() > > > > > > > > Eric > > > >> thank you > > > > >  > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Matplotlibusers mailing list > > Matplotlibusers@... > > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > >  > Steven Boada > Dept. Physics and Astronomy > Texas A&M University > boada@... > > > >  > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 