当前位置: 首页>>代码示例>>Python>>正文


Python TextArea.set_text方法代码示例

本文整理汇总了Python中matplotlib.offsetbox.TextArea.set_text方法的典型用法代码示例。如果您正苦于以下问题:Python TextArea.set_text方法的具体用法?Python TextArea.set_text怎么用?Python TextArea.set_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.offsetbox.TextArea的用法示例。


在下文中一共展示了TextArea.set_text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_plot

# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_text [as 别名]
    def do_plot(self, wallet, history):
        balance_Val=[]
#        fee_val=[]
        value_val=[]
        datenums=[]
        unknown_trans = 0
        pending_trans = 0
        for item in history:
            tx_hash, confirmations, is_mine, value, fee, balance, timestamp = item
            if confirmations:
                if timestamp is not None:
                    try:
                        datenums.append(md.date2num(datetime.datetime.fromtimestamp(timestamp)))
                        balance_string = format_satoshis(balance, False, decimal_point=self.window.decimal_point)
                        balance_Val.append(float(balance_string))
                    except [RuntimeError, TypeError, NameError] as reason:
                        unknown_trans=unknown_trans+1
                        pass
                else:
                    unknown_trans=unknown_trans+1

                if value is not None:
                    value_string = format_satoshis(value, True, decimal_point=self.window.decimal_point)
                    value_val.append(float(value_string))
                else:
                    value_string = '--'
            else:
                pending_trans=pending_trans+1


#            if fee is not None:
#                fee_string = format_satoshis(fee, True)
#                fee_val.append(float(fee_string))
#            else:
#                fee_string = '0'

            if tx_hash:
                label, is_default_label = wallet.get_label(tx_hash)
                label = label.encode('utf-8')
            else:
                label = ""


        f, axarr = plt.subplots(2, sharex=True)

        plt.subplots_adjust(bottom=0.2)
        plt.xticks( rotation=25 )
        ax=plt.gca()
        x=19
        if unknown_trans > 0:
            test11="Unknown transactions =  "+str(unknown_trans)+" ."
            box1 = TextArea(" Test : Number of unkown transactions", textprops=dict(color="k"))
            box1.set_text(test11)


            box = HPacker(children=[box1],
                align="center",
                pad=0.1, sep=15)

            anchored_box = AnchoredOffsetbox(loc=3,
                child=box, pad=0.5,
                frameon=True,
                bbox_to_anchor=(0.5, 1.02),
                bbox_transform=ax.transAxes,
                borderpad=0.5,
            )


            ax.add_artist(anchored_box)


        plt.ylabel(self.window.base_unit())
        plt.xlabel('Dates')
        xfmt = md.DateFormatter('%Y-%m-%d')
        ax.xaxis.set_major_formatter(xfmt)


        axarr[0].plot(datenums,balance_Val,marker='o',linestyle='-',color='blue',label='Balance')
        axarr[0].legend(loc='upper left')
        axarr[0].set_title('Confirmed Balance History')


        xfmt = md.DateFormatter('%Y-%m-%d')
        ax.xaxis.set_major_formatter(xfmt)
        axarr[1].plot(datenums,value_val,marker='o',linestyle='-',color='green',label='Tx Value')
        axarr[1].legend(loc='upper left')
        axarr[1].set_title('Confirmed Transaction History')




     #   plt.annotate('unknown transaction = %d \n pending transactions = %d' %(unknown_trans,pending_trans),xy=(0.7,0.05),xycoords='axes fraction',size=12)
        plt.annotate('pending transactions = %d' %pending_trans,xy=(0.7,-0.45),xycoords='axes fraction',size=12)
        plt.show()
开发者ID:martexcoin,项目名称:encompass,代码行数:96,代码来源:plot.py

示例2: do_plot

# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_text [as 别名]
    def do_plot(self, wallet, history):
        balance_Val=[]
        fee_val=[]
        value_val=[]
        datenums=[]
        unknown_trans = 0
        pending_trans = 0
        counter_trans = 0
        balance = 0
        for item in history:
            tx_hash, confirmations, value, timestamp, balance = item
            if confirmations:
                if timestamp is not None:
                    try:
                        datenums.append(md.date2num(datetime.datetime.fromtimestamp(timestamp)))
                        balance_Val.append(1000.*balance/COIN)
                    except [RuntimeError, TypeError, NameError] as reason:
                        unknown_trans += 1
                        pass
                else:
                    unknown_trans += 1
            else:
                pending_trans += 1

            value_val.append(1000.*value/COIN)
            if tx_hash:
                label, is_default_label = wallet.get_label(tx_hash)
                label = label.encode('utf-8')
            else:
                label = ""


        f, axarr = plt.subplots(2, sharex=True)

        plt.subplots_adjust(bottom=0.2)
        plt.xticks( rotation=25 )
        ax=plt.gca()
        x=19
        test11="Unknown transactions =  "+str(unknown_trans)+" Pending transactions =  "+str(pending_trans)+" ."
        box1 = TextArea(" Test : Number of pending transactions", textprops=dict(color="k"))
        box1.set_text(test11)


        box = HPacker(children=[box1],
            align="center",
            pad=0.1, sep=15)

        anchored_box = AnchoredOffsetbox(loc=3,
            child=box, pad=0.5,
            frameon=True,
            bbox_to_anchor=(0.5, 1.02),
            bbox_transform=ax.transAxes,
            borderpad=0.5,
        )


        ax.add_artist(anchored_box)


        plt.ylabel('mBTC')
        plt.xlabel('Dates')
        xfmt = md.DateFormatter('%Y-%m-%d')
        ax.xaxis.set_major_formatter(xfmt)


        axarr[0].plot(datenums,balance_Val,marker='o',linestyle='-',color='blue',label='Balance')
        axarr[0].legend(loc='upper left')
        axarr[0].set_title('History Transactions')


        xfmt = md.DateFormatter('%Y-%m-%d')
        ax.xaxis.set_major_formatter(xfmt)
        axarr[1].plot(datenums,value_val,marker='o',linestyle='-',color='green',label='Value')


        axarr[1].legend(loc='upper left')
     #   plt.annotate('unknown transaction = %d \n pending transactions = %d' %(unknown_trans,pending_trans),xy=(0.7,0.05),xycoords='axes fraction',size=12)
        plt.show()
开发者ID:FuzzyHobbit,项目名称:electrum,代码行数:80,代码来源:plot.py

示例3: do_plot

# 需要导入模块: from matplotlib.offsetbox import TextArea [as 别名]
# 或者: from matplotlib.offsetbox.TextArea import set_text [as 别名]
    def do_plot(self, wallet):
        history = wallet.get_tx_history()
        balance_Val = []
        fee_val = []
        value_val = []
        datenums = []
        unknown_trans = 0
        pending_trans = 0
        counter_trans = 0
        for item in history:
            tx_hash, confirmations, is_mine, value, fee, balance, timestamp = item
            if confirmations:
                if timestamp is not None:
                    try:
                        datenums.append(md.date2num(datetime.datetime.fromtimestamp(timestamp)))
                        balance_string = format_satoshis(balance, False)
                        balance_Val.append(float((format_satoshis(balance, False))) * 1000.0)
                    except [RuntimeError, TypeError, NameError] as reason:
                        unknown_trans = unknown_trans + 1
                        pass
                else:
                    unknown_trans = unknown_trans + 1
            else:
                pending_trans = pending_trans + 1

            if value is not None:
                value_string = format_satoshis(value, True)
                value_val.append(float(value_string) * 1000.0)
            else:
                value_string = "--"

            if fee is not None:
                fee_string = format_satoshis(fee, True)
                fee_val.append(float(fee_string))
            else:
                fee_string = "0"

            if tx_hash:
                label, is_default_label = wallet.get_label(tx_hash)
                label = label.encode("utf-8")
            else:
                label = ""

        f, axarr = plt.subplots(2, sharex=True)

        plt.subplots_adjust(bottom=0.2)
        plt.xticks(rotation=25)
        ax = plt.gca()
        x = 19
        test11 = (
            "Unknown transactions =  " + str(unknown_trans) + " Pending transactions =  " + str(pending_trans) + " ."
        )
        box1 = TextArea(" Test : Number of pending transactions", textprops=dict(color="k"))
        box1.set_text(test11)

        box = HPacker(children=[box1], align="center", pad=0.1, sep=15)

        anchored_box = AnchoredOffsetbox(
            loc=3,
            child=box,
            pad=0.5,
            frameon=True,
            bbox_to_anchor=(0.5, 1.02),
            bbox_transform=ax.transAxes,
            borderpad=0.5,
        )

        ax.add_artist(anchored_box)

        plt.ylabel("mBTC")
        plt.xlabel("Dates")
        xfmt = md.DateFormatter("%Y-%m-%d")
        ax.xaxis.set_major_formatter(xfmt)

        axarr[0].plot(datenums, balance_Val, marker="o", linestyle="-", color="blue", label="Balance")
        axarr[0].legend(loc="upper left")
        axarr[0].set_title("History Transactions")

        xfmt = md.DateFormatter("%Y-%m-%d")
        ax.xaxis.set_major_formatter(xfmt)
        axarr[1].plot(datenums, fee_val, marker="o", linestyle="-", color="red", label="Fee")
        axarr[1].plot(datenums, value_val, marker="o", linestyle="-", color="green", label="Value")

        axarr[1].legend(loc="upper left")
        #   plt.annotate('unknown transaction = %d \n pending transactions = %d' %(unknown_trans,pending_trans),xy=(0.7,0.05),xycoords='axes fraction',size=12)
        plt.show()
开发者ID:jimmysong,项目名称:electrum,代码行数:88,代码来源:plot.py


注:本文中的matplotlib.offsetbox.TextArea.set_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。