2

ggplot2 と pgfsweave(+Lyx) を使用して問題が発生しました。R でコードを実行すると、色付き/影付きのタイルを含む素敵なプロットが表示されますが、pgfsweave を介して実行すると、これらのタイルが表示されません。ggplot2 を使用した他のグラフが機能していることに注意してください (geom_line を使用)

不足しているものはありますか?

再現可能な例を次に示します。

R コード (色付きの正方形になります):

library(ggplot2)
data(iris)

corr.Matrix <- cor(iris[1:4])

corr.Melted <- melt(corr.Matrix)
names(corr.Melted) <- c("Var1", "Var2", "Correlation")

corr.Plot <- ggplot(corr.Melted, aes(Var1, Var2, fill=Correlation)) + 
  geom_tile()

# view plot
corr.Plot

そして、これは pgfsweave/lyx チャンクにあります (四角が塗りつぶされていないグラフになります)

\begin{center}
<<CorrelationVis,fig=TRUE,echo=FALSE>>=
  library(ggplot2)
  data(iris)

  corr.Matrix <- cor(iris[1:4])

  corr.Melted <- melt(corr.Matrix)
  names(corr.Melted) <- c("Var1", "Var2", "Correlation")

  corr.Plot <- ggplot(corr.Melted, aes(Var1, Var2, fill=Correlation)) + 
    geom_tile()

  # view plot
  print(corr.Plot)
@
\end{center}

編集:私のセットアップの詳細を追加します。例は他の人にとっては問題なく動作するようです。- Lyx は 2.0 - pgfSweave は 1.2.1 - OS は Windows 7 - R は 2-13.1

4

0 に答える 0