<bdo id='zi4W9'></bdo><ul id='zi4W9'></ul>

<i id='zi4W9'><tr id='zi4W9'><dt id='zi4W9'><q id='zi4W9'><span id='zi4W9'><b id='zi4W9'><form id='zi4W9'><ins id='zi4W9'></ins><ul id='zi4W9'></ul><sub id='zi4W9'></sub></form><legend id='zi4W9'></legend><bdo id='zi4W9'><pre id='zi4W9'><center id='zi4W9'></center></pre></bdo></b><th id='zi4W9'></th></span></q></dt></tr></i><div id='zi4W9'><tfoot id='zi4W9'></tfoot><dl id='zi4W9'><fieldset id='zi4W9'></fieldset></dl></div>

        <small id='zi4W9'></small><noframes id='zi4W9'>

        <tfoot id='zi4W9'></tfoot>
      1. <legend id='zi4W9'><style id='zi4W9'><dir id='zi4W9'><q id='zi4W9'></q></dir></style></legend>

        Python matplotlib 减小颜色条标签的大小

        时间:2023-09-13

          <small id='0spfZ'></small><noframes id='0spfZ'>

        • <legend id='0spfZ'><style id='0spfZ'><dir id='0spfZ'><q id='0spfZ'></q></dir></style></legend>
          <i id='0spfZ'><tr id='0spfZ'><dt id='0spfZ'><q id='0spfZ'><span id='0spfZ'><b id='0spfZ'><form id='0spfZ'><ins id='0spfZ'></ins><ul id='0spfZ'></ul><sub id='0spfZ'></sub></form><legend id='0spfZ'></legend><bdo id='0spfZ'><pre id='0spfZ'><center id='0spfZ'></center></pre></bdo></b><th id='0spfZ'></th></span></q></dt></tr></i><div id='0spfZ'><tfoot id='0spfZ'></tfoot><dl id='0spfZ'><fieldset id='0spfZ'></fieldset></dl></div>

              <bdo id='0spfZ'></bdo><ul id='0spfZ'></ul>

              <tfoot id='0spfZ'></tfoot>

                <tbody id='0spfZ'></tbody>

                1. 本文介绍了Python matplotlib 减小颜色条标签的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要你的帮助!我有一个绘图代码,如下所示:

                  I need your help! I have a plotting code which is the following:

                  fig = plt.figure()
                  ax1 = fig.add_subplot(111)
                  
                  imax1 = ax1.imshow(data,interpolation = 'nearest', origin = 'lower',cmap=cm.jet)#plot
                  cbar = plt.colorbar(imax1, extend='neither', spacing='proportional',
                                  orientation='vertical', shrink=0.7, format="%.0f")
                  cbar.set_label(r"ET [mm/month]", size=10)
                  
                  titlestr = "Evapotranspiration in mm/month"
                  plt.title(titlestr)
                  #plt.xlabel("Longitude")
                  #plt.ylabel("Latitude")
                  imax1.set_clim(0,60)
                  labels = [item.get_text() for item in ax1.get_xticklabels()]
                  for ii in range(np.shape(labels)[0]):
                      labels[ii] = str(grid_lon[75*ii/np.shape(labels)[0]])
                  
                  ax1.set_xticklabels(labels, rotation = 45, ha='right', size = 10)
                  
                  labels = [item.get_text() for item in ax1.get_yticklabels()]
                  for ii in range(np.shape(labels)[0]):
                      labels[ii] = str(grid_lat[75*ii/np.shape(labels)[0]])
                  
                  ax1.set_yticklabels(labels, size = 10)
                  
                  pngname = "./out/2d_"+variable+"_"+mm+".png"
                  print "save ", pngname
                  plt.savefig(pngname, dpi=None, facecolor='w', edgecolor='w',
                      orientation='portrait', papertype=None, format=None,
                      transparent=False, bbox_inches=None, pad_inches=0.1)
                  
                  
                  print "plot finished"
                  

                  我想将颜色条标签的标签大小(例如 0、10、20、...60)设置为 10 或更小.这可能会进入imax1.set_clim(0,60) 行.有什么想法吗?我也有兴趣将 imax1 对象的信息打印到命令行.我该怎么做?例如 imax1 的可用属性和功能.

                  I would like to set the label size of the colorbar labels (e.g. 0,10,20,...60) to size of 10 or smaller. This will probably go into the line "imax1.set_clim(0,60). Any ideas? I'd be also interested to print information of the imax1 object to command line. How could I do that? E.g. available attributes and functions of imax1.

                  非常感谢您的帮助!

                  推荐答案

                  啊哈!这里找到了答案:

                  cbar.ax.tick_params(labelsize=10) 
                  

                  附:支持那个回答并给保罗一些爱!

                  P.S. Upvote that answer and give Paul some love!

                  这篇关于Python matplotlib 减小颜色条标签的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在对象列表中获取具有 max 属性值的对象 下一篇:检查python类属性

                  相关文章

                  最新文章

                    • <bdo id='XYA9O'></bdo><ul id='XYA9O'></ul>
                  1. <legend id='XYA9O'><style id='XYA9O'><dir id='XYA9O'><q id='XYA9O'></q></dir></style></legend>
                    <i id='XYA9O'><tr id='XYA9O'><dt id='XYA9O'><q id='XYA9O'><span id='XYA9O'><b id='XYA9O'><form id='XYA9O'><ins id='XYA9O'></ins><ul id='XYA9O'></ul><sub id='XYA9O'></sub></form><legend id='XYA9O'></legend><bdo id='XYA9O'><pre id='XYA9O'><center id='XYA9O'></center></pre></bdo></b><th id='XYA9O'></th></span></q></dt></tr></i><div id='XYA9O'><tfoot id='XYA9O'></tfoot><dl id='XYA9O'><fieldset id='XYA9O'></fieldset></dl></div>

                    <small id='XYA9O'></small><noframes id='XYA9O'>

                    <tfoot id='XYA9O'></tfoot>