Okay I've learnt a bit more about this:

http://img229.imageshack.us/img229/6467/scatterplot5st6.png

I need to explicitly make a new figure as well as a new axis, and put
the rc calls before the figure calls, rc changes only seem to take
effect on figures created afterwards. Also I was stupidly using the plot
function (for plotting lines) for a scatter plot, I've now discovered
the scatter function.

Things are pretty much how I want them now, but I still have a couple of
questions:

How do I get rid of the redundant ticks on the top and right edges?

Is there any way to stop some of my text labels from overlapping?

Why is there such a big gap between the plot itself and the axes ticks?
The scatter function seems to do this, but I don't see any option to
control the size of the gap. I wonder if I've done something weird like
create an axes within an axes. I don't mind the gap much, it's just
surprising, and could do with being much smaller to make the figure
easier to read.

Here's my new source code:

rc('xtick.major',size=8)
rc('xtick',direction='out')
rc('ytick.major',size=8)
rc('ytick',direction='out')
fig = figure(facecolor='white' )
axes(frameon=False)
title('Comparison of lower- and upper-bounds per function in week one
and week two')
l =
scatter(functions.lowerboundsweek1,functions.lowerboundsweek2,marker='s',color='g')
u =
scatter(functions.upperboundsweek1,functions.upperboundsweek2,marker='^',color='b')
legend((l,u),('Lower-bounds','Upper-bounds'),'best')
plot([0,1],[0,1],color='#999999',linestyle='--')
xlabel('Week 1')
ylabel('Week 2')
xticks(functions.upperboundsweek1+functions.lowerboundsweek1,'
'*len(functions.upperboundsweek1+functions.lowerboundsweek1))
yticks(functions.upperboundsweek2+functions.lowerboundsweek2,'
'*len(functions.upperboundsweek2+functions.lowerboundsweek2))
for function,x,y in
map(None,functions.shortnames,functions.upperboundsweek1,functions.upperboundsweek2):
    annotate(function,xy=(x,y),size=8,color='b')       
for function,x,y in
map(None,functions.shortnames,functions.lowerboundsweek1,functions.lowerboundsweek2):
    annotate(function,xy=(x,y),size=8,color='g')     


On Tue, 2008-02-26 at 16:51 +0000, chombee wrote:
> I'm having a couple of problems drawing a basic relational scatter plot.
> (Specifically, it's called a dot-dash-plot in the book I have and is
> described as "framing the bivariate scatter with the marginal distribution
> of each variable.") The idea is that you have a bivariate scatter plot
> and use the two marginal frequency distributions of the data as the two
> axes.
> 
> 1. By setting the x and y tick length and using space characters as the
> tick labels I was able to get ticks only and no labels on the axes as I
> want. But these ticks appear along the top and right edges of the plot,
> as well as the left and bottom. Is there any way to get rid of the top
> and right ticks?
> 
> 2. I'm getting phantom numbers on my axes, the 0.2, 0.4, 0.6 etc. I
> don't know where these are coming from or what they measure (my data
> ranges from 0-7 on both axes, not 0-1).
> 
> 3. I want to label each data point with a string. I'm doing this with
> annotate but the strings sometimes overlap each other. Any idea how to
> avoid this?
> 
> Here's a PNG of my plot as it is:
> 
> http://img137.imageshack.us/img137/4015/scatterplotlk2.png
> 
> And here's the source:
> 
> # datax and datay are equal length lists of floats, the data I want to 
> # plot. labels is another equal length list containing the strings I 
> # want to label the data points with. All three lists are in the same
> # order.
> 
> axes(frameon=False)
> rc('xtick.major',size=8)
> rc('xtick',direction='out')
> xticks(datax,' '*len(datax))
> rc('ytick.major',size=8)
> rc('ytick',direction='out')
> yticks(datay,' '*len(datay))
> plot(datax,datay,'r.')
> plot([0,7],[0,7])    
> xlabel('Proportion of total number of cards, week 1')
> ylabel('Proportion of total number of cards, week 2')
> title('Frequency of cards per function')
> for label,x,y in map(None,labels,datax,datay):
>     annotate(function,xy=(x,y),size=8)
> 
> Thanks!
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to