8

When I create a plot in Jupyter using the ggplot2 R package, I get a link to the chart that says "View PDF" instead of the chart being presented inline.

I know that traditionally in IPython Notebook you were able to show the charts inline using the %matplotlib magic function. Does Jupyter have something similar for R and ggplot2?

What do I need to do to show the graph inline versus as a link to a PDF?

rmuc8
  • 2,869
  • 7
  • 27
  • 36
Ryan Wade
  • 81
  • 1
  • 2
  • 2
    It may help to offer some example code and the output you get- are you using the `python` or the `R` kernel? – cel Jun 18 '15 at 16:49

2 Answers2

5

You can show the graphs inline with this option.

options(jupyter.plot_mimetypes = 'image/png')

You can also produce pdf files as you would regularly in R, e.g.

pdf("test.pdf")
ggplot(data.frame(a=rnorm(100,1,10)),aes(a))+geom_histogram()
dev.off()
SlowLearner
  • 131
  • 1
  • 10
2

There are currently some issues with producing ggplot2 outputs using the IRkermel. There is an open issue on GitHub about it. The only workaround at the moment appears to be using PDF, jpg, png outputs for your plots.

scribbles
  • 4,089
  • 7
  • 22
  • 29