【发布时间】:2017-03-11 09:19:38
【问题描述】:
我目前面临以下问题。我有几个 Python 脚本,它们使用 Python 模块 Pandas 绘制一些有用的信息,该模块使用 Matplotlib。
据我所知,matplotlib 让我们按照this question 接受的答案中的描述设置其后端。
我想从 Pandas 设置 matplotlib 后端:
- 有可能吗?
- 我该怎么做?
编辑 1: 顺便说一句,我的代码看起来像:
import pandas as pd
from pandas import DataFrame, Series
class MyPlotter():
def plot_from_file(self, stats_file_name, f_name_out, names,
title='TITLE', x_label='x label', y_label='y label'):
df = pd.read_table(stats_file_name, index_col=0, parse_dates=True,
names= names)
plot = df.plot(lw=2,colormap='jet',marker='.',markersize=10,title=title,figsize=(20, 15))
plot.set_xlabel(x_label)
plot.set_ylabel(y_label)
fig = plot.get_figure()
fig.savefig(f_name_out)
plot.cla()
【问题讨论】:
-
我认为您之所以被否决,是因为您的问题需要更具体:您想要完成什么,到目前为止您尝试了什么,它是如何失败的?
-
我认为标题已经足够具体了,无论如何我都会完成这篇文章。
-
fwiw,我经常使用 pandas 和 matplotlib,这个问题对我来说很有意义。在没有任何其他证据的情况下,我必须假设反对者是对这些软件包没有太多经验的人——可能会在审查队列中触发快乐的高代表用户(我在世界上最不喜欢的人)。
标签: python pandas matplotlib