Axes_Grid1:刻度,刻度标签和标签

时间:2015-11-13 19:07:59

标签: python matplotlib

我正在调用我的网格

from mpl_toolkits.axes_grid1 import AxesGrid
grid  = AxesGrid(fig, 111,
                            nrows_ncols=(2, 2),
                            axes_pad=0.05,
                            share_all=True,
                            label_mode="L",
                            cbar_location="right",
                            cbar_mode="single",
                            )

但我似乎无法执行通常的xticks()set_xlabel()命令。我尝试调用grids[i].imshow(),并将其作为args添加到AxesGrid()。后者只是一种信仰的飞跃,它并没有真正记录下来。但是,在教程中没有做到这一点,所以我真的不知道如何做到这一点。

1 个答案:

答案 0 :(得分:2)

似乎使用share_all,更改单个轴时会更新所有轴。如果您禁用import pylab as pl from mpl_toolkits.axes_grid1 import AxesGrid fig = pl.figure() grid = AxesGrid(fig, 111, nrows_ncols=(2, 2), axes_pad=0.05, share_all=False, label_mode="L", cbar_location="right", cbar_mode="single", ) ax = grid.axes_all[0] ax.set_xticks([0,1]) ,则可以使用以下内容:

$result = mysql_query("SELECT `uID` FROM `user` WHERE `uUserName` = '$username'");
$user_id = 0;   // default value, meaning user not found

if ($result && mysql_num_rows($result) > 0){
    $row = mysql_fetch_assoc($result);
    $user_id = $row[0];
}

return $user_id;
相关问题