|
From: Steven B. <bo...@ph...> - 2013-03-22 16:30:12
|
Well... I jumped the gun. To better illustrate the problem(s) I am
having, I wrote a simple script that doesn't work...
import pylab as pyl
from mpl_toolkits.axes_grid1 import AxesGrid
# make some data
xdata = pyl.random(100) * 25.
ydata = pyl.random(100) * 8.
colordata = pyl.random(100) * 3.
# make us a figure
F = pyl.figure(1,figsize=(5.5,3.5))
grid = AxesGrid(F, 111,
nrows_ncols=(1,2),
axes_pad = 0.1,
add_all=True,
share_all = True,
cbar_mode = 'each',
cbar_location = 'top')
# Plot!
sc1 = grid[0].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral')
sc2 = grid[1].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral')
# Add colorbars
grid.cbar_axes[0].colorbar(sc1)
grid.cbar_axes[1].colorbar(sc2)
grid[0].set_xlim(0,25)
grid[0].set_ylim(0,8)
pyl.show()
And you get some squashed figures... I'll attach a png.
Thanks again.
Steven
On Fri Mar 22 10:49:44 2013, Steven Boada wrote:
>
> Thanks JJ!
>
> That did fix my problem, but I can't say I understand what the
> difference is. Why does Axesgrid make them squashed while just Grid
> works?
>
>
> On Thu Mar 21 22:28:34 2013, Jae-Joon Lee wrote:
>>
>> It is not clear what your problem is.
>> AxesGrid implicitly assumes aspect=1 for each axes. So, I guess your
>> y-limits are smaller (in its span) than x-limits.
>> If you don't want this behavior, there is no need of using the
>> AxesGrid. Rather use Grid, or simply subplots.
>>
>> import matplotlib.pyplot as plt
>> from mpl_toolkits.axes_grid1 import Grid
>>
>> F = plt.figure(1,(5.5,3.5))
>> grid = Grid(F, 111,
>> nrows_ncols=(1,3),
>> axes_pad = 0.1,
>> add_all=True,
>> label_mode = 'L',
>> )
>>
>> If this is not the answer you're looking for, I recommend you to post
>> a complete but simple script that reproduces your problem and describe
>> the problem more explicitly.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Fri, Mar 22, 2013 at 6:03 AM, Steven Boada <bo...@ph...
>> <mailto:bo...@ph...>> wrote:
>>
>> Heya List,
>>
>> See attached image for what I mean.
>>
>> Here is the grid creation bit. I can't seem to figure out what
>> might be causing such a problem.
>>
>> F = pyl.figure(1,(5.5,3.5))
>> grid = AxesGrid(F, 111,
>> nrows_ncols=(1,3),
>> axes_pad = 0.1,
>> add_all=True,
>> label_mode = 'L',
>> aspect=True)
>>
>> Should be simple enough right?
>>
>> --
>>
>> Steven Boada
>>
>> Doctoral Student
>> Dept of Physics and Astronomy
>> Texas A&M University
>> bo...@ph... <mailto:bo...@ph...>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_mar
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> <mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University
> bo...@ph...
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University
> bo...@ph...
|