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: Bernhard Voigt <Bernhard.Voigt@de...>  20080228 13:19:52
Attachments:
Message as HTML

> How do I get rid of the redundant ticks on the top and right edges? pylab.gca().get_xaxis().set_ticks_postion('bottom') same for yaxis > Is there any way to stop some of my text labels from overlapping? don't know > Why is there such a big gap between the plot itself and the axes ticks? did you try pylab.axis('tight') Bernhard 
From: chombee <chombee@ne...>  20080226 16:55:04

I'm having a couple of problems drawing a basic relational scatter plot. (Specifically, it's called a dotdashplot 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 07 on both axes, not 01). 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! 
From: chombee <chombee@ne...>  20080227 18:08:00

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 would like to get rid of the gap because it makes the graphic less readable, in particular it gives a misleading impression about where (0,0) is located. 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 upperbounds 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),('Lowerbounds','Upperbounds'),'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, 20080226 at 16:51 +0000, chombee wrote: > I'm having a couple of problems drawing a basic relational scatter plot. > (Specifically, it's called a dotdashplot 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 07 on both axes, not 01). > > 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/ > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: John Hunter <jdh2358@gm...>  20080228 13:57:23

On Wed, Feb 27, 2008 at 12:04 PM, chombee <chombee@...> wrote: > Is there any way to stop some of my text labels from overlapping? For the ones that are tightly clustered, you could use the annotate command to move the text farther away from the associated point. Annotate has support for drawing an arrow from the text label to the annotated point. But it won't do autolayout  you'll still have to choose the coordinates of the text label so they don't overlap. JDH 
From: Bernhard Voigt <Bernhard.Voigt@de...>  20080228 13:19:52
Attachments:
Message as HTML

> How do I get rid of the redundant ticks on the top and right edges? pylab.gca().get_xaxis().set_ticks_postion('bottom') same for yaxis > Is there any way to stop some of my text labels from overlapping? don't know > Why is there such a big gap between the plot itself and the axes ticks? did you try pylab.axis('tight') Bernhard 
From: chombee <chombee@ne...>  20080228 14:55:37

On Thu, 20080228 at 14:19 +0100, Bernhard Voigt wrote: > > How do I get rid of the redundant ticks on the top and right > edges? > > pylab.gca().get_xaxis().set_ticks_postion('bottom') > > same for yaxis That worked, thanks! > Why is there such a big gap between the plot itself and the > axes ticks? > > did you try pylab.axis('tight') That did improve the situation slightly, but it still looks like something odd is going on. It's clearer if I actually draw the axis frame. These two screenshots show the graphic before and after calling axis('tight'): http://img87.imageshack.us/img87/7352/beforetightku8.png http://img403.imageshack.us/img403/9506/aftertightyk5.png As you can see the data moves a little closer to the axes when I call axis('tight'). But that dashed line starts at (0,0), it is plotted with the simple command: plot([0,7],[0,7],color='#999999',linestyle='') and yet the beginning of the line is nowhere near either axis, even after calling axis('tight'). So something's up. Here's the output of axis('tight'): (0.33718689788053952, 7.0809248554913298, 0.34782608695652173, 7.3043478260869561) And here's the source code that produced the graphic in the first place: rc('xtick.major',size=8) rc('xtick',direction='out') rc('ytick.major',size=8) rc('ytick',direction='out') fig = figure(facecolor='white' ) ax = axes(frameon=True) ax.get_xaxis().set_ticks_position('bottom') ax.get_yaxis().set_ticks_position('left') title('Comparison of frequency of cards per function in week one and week two') s = scatter(functions.proportioncardsweek1,functions.proportioncardsweek2,marker='s',color='g') plot([0,7],[0,7],color='#999999',linestyle='') xlabel('Proportion of total number of cards, week 1') ylabel('Proportion of total number of cards, week 2') xticks(functions.proportioncardsweek1,' '*len(functions.proportioncardsweek1)) yticks(functions.proportioncardsweek2,' '*len(functions.proportioncardsweek2)) for function,x,y in map(None,functions.shortnames,functions.proportioncardsweek1,functions.proportioncardsweek2): annotate(function,xy=(x,y),size=8) 
From: John Hunter <jdh2358@gm...>  20080228 15:09:40

On Thu, Feb 28, 2008 at 8:51 AM, chombee <chombee@...> wrote: > That did improve the situation slightly, but it still looks like > something odd is going on. It's clearer if I actually draw the axis > frame. These two screenshots show the graphic before and after calling > axis('tight'): When did you call axis('tight')? It should be after all of your other plotting commands. JDH 
From: chombee <chombee@ne...>  20080228 15:16:19

Okay I see what's going on now. The output from axis('tight') specifies the limits of the two axes: > (0.33718689788053952, > 7.0809248554913298, > 0.34782608695652173, > 7.3043478260869561) As you can see it's actually setting negative minimum limits for both axes, which is why the axes are offset from the (0,0) position. The clue to this behaviour is in the axis function docstring: > axis('auto') or 'normal' (deprecated) restores default behavior; > axis limits are automatically scaled to make the data fit > comfortably within the plot box. and > axis('tight') changes x and y axis limits such that all data is > shown. If all data is already shown, it will move it to the center > of the figure without modifying (xmaxxmin) or (ymaxymin). Note > this is slightly different than in matlab. Neither of those will necessarily set the xmin and ymin of the axes to 0. It depends on what data you've plotted before calling axis(). I found that if I call axis('tight') before plotting anything (i.e. before calling plot or scatter) then the axes xmin and ymin do get set to 0, but this is because at the time of calling axis('tight') there is no data to show. If you call axis('tight') after plotting data then (contrary to the docstring) it seems to adjust the axes so that all data is shown **and none of it is too close to the axes**, there is some degree of padding, although it is tighter than with axis('auto'). I'm not sure about this 'auto' and 'tight' behaviour. To my eye the corner formed by the x and y axes at the bottomleft signifies (0,0), unless otherwise stated. The padding applied by 'normal' and 'tight' breaks this expectation. In my case, when I don't have any numerical labels on the axes to show that they begin at (0.34,0.35), I should probably make sure that they begin at (0,0). You can explicitly set the axes limits with axis(xmin=0,ymin=0). 
From: Sean Hammond <seanh@sd...>  20080226 22:41:36

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 upperbounds 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),('Lowerbounds','Upperbounds'),'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, 20080226 at 16:51 +0000, chombee wrote: > I'm having a couple of problems drawing a basic relational scatter plot. > (Specifically, it's called a dotdashplot 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 07 on both axes, not 01). > > 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/ > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
Sign up for the SourceForge newsletter:
No, thanks