0
如何在海寶中的FacetGrid
內定製蜱標籤的屬性?在下面的例子中我想僅改變x軸ticklabels的字體大小:通過axes
陣列FacetGrid
對象這似乎不必要的複雜的在seaborn中定製facetgrid xticks和標籤
import matplotlib.pylab as plt
import seaborn as sns
df1 = pandas.DataFrame({"x": np.random.rand(100),
"y": np.random.rand(100)})
df1["row"] = "A"
df1["col"] = "1"
df2 = pandas.DataFrame({"x": np.random.rand(100),
"y": np.random.rand(100) + 1})
df2["row"] = "A"
df2["col"] = "2"
df = pandas.concat([df1, df2])
g = sns.FacetGrid(df, row="row", col="col", hue="col")
g.map(plt.scatter, "x", "y")
print g.axes
row, col = g.axes.shape
for i in range(row):
for j in range(col):
ax = g.axes[i, j]
print "ax: ", ax.get_xticklabels()
ax.set_xticklabels(ax.get_xticklabels(), fontsize=6)
我的溶液進行迭代。我知道fontscale
可以在全局設置,但我只想更改x軸ticklabel字體。有一個更好的方法嗎?還有一種方法可以將標籤樣式自定義爲科學記數法?