I am using plotly version 1.9.3, and using it to embed figures in jupyter notebook in offline mode using
init_notebook_mode()
When I enter TeX notation in labels, titles, etc., the Tex will not render (i.e. $\alpha$ will be displayed as source.
When I use the "save and edit in cloud" toolbar option, in the plotly website it renders correctly.
Can I configure it to render also in the offline mode?
I have both LaTex installation and a local installation of MathJax.
At the moment, it unfortunately does not seem possible to configure plotly to properly render TeX notations in the offline mode. There is an open issue on their github repo with several users describing this problem.
For future reference, support was added for rendering LaTeX in offline mode in plotly.py version 3.4.0.
From https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md#added:
Added LaTeX typesetting support for figures displayed in the Jupyter Notebook using plotly.offline.iplot and plotly.graph_objs.FigureWidget. Note: There are still outstanding issues with MathJax rendering in FireFox, but it is now working well in Chrome. (#1243)
Related
When I send or receive an R notebook, or even an R Project (from RStudio), the R notebook doesn't maintain any of the outputs; neither printed text or graphics show up, and the whole notebook has to be re-run to show the outputs. Is there some kind of setting I can turn on to make sure the outputs are embedded in the R Notebook so that I can send the notebook to someone else, like with Jupyter notebooks?
As per the official RStudio community blog here (and my own experience with RStudio), this is not possible.
The RStudio blog's Sustainer however brought up two good points (although it does not solve your problem):
If the purpose is to create a reproducible example, the reprex package is the way to go. This is great for short bits of r code and output.
You should also check our rmarkdown notebooks. Note that even with R's file >> save feature, you won't save plots etc. With rmarkdown or rmarkdown notebooks, you can intermix markdown formatted text, code, and code output (including tables and plots). You then also may knit that into html or pdf documents.
EDIT: if you are not tied up to RStudio, you can use JupyterLab instead (a powerful extension of Jupyter Notebooks - from the same project team). JupyterLab is language(kernel)-agnostic and does run nicely with R. All your work, included outputs, can then be fully saved - as you are familiar with in the Python world.
I used a cloud-based version of R JupyterLab hosted on GCP (Google Cloud Platform) but I am sure it can be deployed on your preferred environment as well (open source project, flexible, well supported by the Community).
Reference here
Kernel-backed documents enable code in any text file (Markdown, Python, R, LaTeX, etc.) to be run interactively in any Jupyter kernel.
I have a shiny app that run some statistical tests and export as .docx (word document) with RMarkdown. I found out that the best way to handle tables is with flextable and pander
When I was trying to make flextable work I realized that my RStudio were utilizng an older version from pander and I manually needed to install a new version from pander (and made it work).
So all my tables works fine when testing locally, but when I deploy my app in shinyapps.io my tables in the word document looks like raw code (image below)
MY GUESS is: probably the versions I'm using in my RStudio locally are newer and handle properly my tables, and the versions on shinyapps.io are older. Could be that?
On the future I'm gonna put my shiny app in a Digital Ocean Droplet, and there I'll install all the newest versions that I need. That would solve my problem?
If you guys agree with me I'm willing to start paying Digital Ocean just to test this, but would like some feedback that this could solve my problems.
Thanks!
Solved my problem, my guess was right!
To know the shinyapps.io pando version I've used pandoc_version() from package rmarkdown, and I got 2.3.1 (older than mine local that is 2.7.3)
So I downgraded my local pandoc version to 2.6 (just to test out a not so old version). This got me the same problem with shinyapps.io (raw xml)
To test out again, I upgraded my local pandoc to 2.7.3 again e tested again. Guess what? All is working fine.
My problem is the pandoc version from shinyapps.io, and this will be handled when I deploy my own Rstudio server (with the newest pandoc version).
Thanks all!
Notice that: to make these tests, I didn't change NOTHING in my RMarkdown file.
I am creating a R shiny web app, which I have to publish in Japanese. The application plots many graphs, mainly using ggplot2.
After I run my application on my local machine, the browser renders all Japanese fonts in & outside ggplot correctly. However, when I upload it in shiny-apps, ggplot does not render Japanese text in Japanese characters.
I have already tried few tricks on stack overflow without any luck.
I am using a Windows machine, and have changed my local RStudio settings to utf8.
Shinyapps is by default utf8
I found this great tutorial for slidify
How can I create a "standalone" presentation? I tried changing the mode to standalone but it does not work because of Rcharts and shiny. I would like to be able to create something that I can host in my website.
I tried to publish to dropbox but the interactive graphics do not work
publish_dropbox("slidify")
I have my resume online in an html page (www.mysite.com/resume.html). Every time I need a PDF version of it, I use Google Chrome's print dialog to save it as a PDF, which uses my print CSS stylesheet.
I want to be able to navigate to www.mysite.com/resume.pdf to always have an up to date PDF version without having to go through Google Chrome manually. Is there a way to programmatically and automatically create a resume.pdf from resume html? If I can write a script that runs once every 24 hours or something like that, that would be good.
PhantomJS is perfect for this. It invokes an instance of WebKit from the command line which can then be used to output to file such as PDF.
PhantomJS:
http://phantomjs.org/
Specific instructions for exporting screen output to a file:
http://phantomjs.org/screen-capture.html
e.g.:
phantomjs rasterize.js 'http://www.example.com/resume.html' resume.pdf
Chrome has started headless program.
With that, we can create a pdf. e.g. for windows navigate your commandline to
C:\Users\{{your_username}}\AppData\Local\Google\Chrome SxS\Application>
Then hit the command:
chrome --headless --print-to-pdf="d:\\{{path and file name}}.pdf" https://google.com
If you are looking to do this server-side via PHP might I recommend the Browsershot library which leverages the Puppeteer (NodeJS package) and Chrome / Chromium headless browser?
It works really well. Way easier to install and get going than wkhtmltopdf (which is another option that doesn't rely on a NodeJS package nor the Chrome/Chromium headless browser. Personally, I recommend Browsershot solution since wkhtmltopdf has some issues depending on the type of server (Linux distro and version) you're running. That is, the only reliable way to install wkhtmltopdf that I've found is to download and compile from source on the server that you're running and not through a package manager).
Also, if you happen to be needing a solution specifically while working on a Laravel project then there's a wrapper library for Browsershot available.
Check out this tutorial to get started.