2

theme_bwテーマの使用中に Rpy2 のすべてのグリッドをオフにする正しい方法は何ですか? 私は次のようにオンにできることを知ってtheme_bwいます:

ggplot2.theme_set(ggplot2.theme_bw(12))

しかし、グリッドをオフにする方法がわかりません。ありがとう。

4

1 に答える 1

3

これは基本的に、R から ggplot2 を使用する場合と同じ方法で行われます。

X 軸と交差するグリッドをオフにする例を次に示します。プロットを「テーマ化」するその他の方法は、ggplot2 のドキュメントとチュートリアルにあります。

from rpy2.robjects.lib.ggplot2 import ggplot, \
                               aes_string, \
                               geom_histogram, \
                               element_blank, \
                               theme_bw, \
                               theme
from rpy2.robjects import r

nogrid_x_theme = theme(**{'panel.grid.major.x': element_blank(),
                         'panel.grid.minor.x': element_blank()})
iris = r('iris')
p = ggplot(iris) + geom_histogram(aes_string(x = 'Sepal.Width'))
p += theme_bw() + nogrid_x_theme
p.plot()
于 2013-02-17T08:03:49.467 に答える