Stylish and beautiful screenshots of R code - r

I found several screenshots of R code like I show below, on Twitter and sometimes on Facebook. I wonder how people do it, because it can use also in Powerpoint or Beamer presentations. The code in the following screenshots are irrelevant for this question, I'm only wandering how to prepare or stylised those.
Thanks.

These are usually generated via third-party services such as Carbon. It's pretty straight-forward and you can customize all kinds of things like background color and code highlighting.
Feel free to check out their About section and their GitHub.

Related

Is there a way to find the R code from a shinyapp.io link?

I recently saw a really well developed shinyapp and was wanting to know the code behind certain aspects of the app. Was wondering if there was a way to find out the code, or would I have to directly contact the author?
Thanks!
You have to contact the author. No other option. At max you can look CSS and JS files from source of the page.

Clone CSS styling for Google Docs

I am making a Google Apps Script for Google Docs with a side panel.
I would like to match the style of buttons, scroll bars, etc. that Google Docs has.
FYI, a lot of the CSS seems to have be minified/obfuscated.
scb-button-icon
jfk-star
Where might I find such a thing?
I would have thought Google Apps Script might have provided something like this, since consistency makes the UX better.
If the official source is not available, is an unofficial one available?
EDIT: Sidebar CSS is now freely available, see CSS Package for Add-ons.
For research only, of course:
View Source of the page you wish to research. Copy and...
Paste into a text editor. Remove everything up to and including the <style> tag, and from the </style> tag to the end. Copy and...
Paste into an HTML decoder, to remove the encoding. Now you have all the CSS, it's just badly formatted. Copy and...
Paste into a CSS Formatter, and tidy it up. Optionally, output as a file.
At this point, you've got a CSS file that can be experimentally built into your for-personal-use-only app. Browser inspectors are handy for determining the HTML others have used to produce the UI elements you want to learn from.
Here's my own little experiment, a sidebar in a Google Doc, with an assortment of elements:
Not sure if you'll be able to find the source code, so here is an alternative:
CSS Unminify
This tool will take minified CSS and expand it. This will allow you to at the very least read the CSS and hopefully figure out which rules you need.
If copyright infringement is not an issue then you could simply recreate the design that Google adopt for their buttons. It should be fairly simple with CSS. The font Google + uses is called Roboto and is free to download
I talked to some of the guys at Google and got a alpha version of the CSS.
It does not yet, however, completely support IE or Firefox, and has (very minor) differences, so I accepted Mogsdad's answer.

wysiwyg user help authoring tool to work with qthelp?

We need to compile to QtHelp (.qch and .qhc). I'm wondering what tool/toolchain would be easiest for this? We'd like a WYSIWYG help authoring tool as our starting point, then run the output from that through whatever we have to to get QtHelp.
We have used Help & Manual in the past, and that's the kind of WYSIWYG interface we're looking for in a help authoring tool. But we need the toolchain to produce simple html pages (one per help topic) that we can use with qhelpgenerator or qcollectiongenerator, as well as create the .qhp's (at least the table of contents and the keywords sections) and .qhcp to generate the .qch's and .qhc. I'm not seeing how Help & Manual can fit into this.
We've looked briefly at Sphynx, but it seems it has extremely limited options for text formatting. For example, it doesn't look like there's any way to change the font, font size, font color, etc. for a section of text. It appears to be actually impossible to have text that is both bold and italic. Looks great for developer documentation, but seems to be missing basic stuff for authoring a user help file. Please correct me if I somehow missed the basic text formatting features!
So, what WYSIWYG help authoring tool do you recommend, and what is the path from that tool to .qch's and a .qhc?
Looks like Help and Manual will work after all! Here's the sequence we're looking at now. If please comment if you see any problems or improvements that can be made.
In Help & Manual (tested with version 5.5.1 Build 1296 professional license), in the Project Explorer, in the Configuration section:
Go HTML Page Templates\Default. In the HTML Source Code tab, comment out the section.
Go to Publishing Options\Web Help.
In Layout, select No frames, no scripts.
In Navigation, we don't need anything checked - although if there is a way to control the format of the value of KEYWORD_INDEX so we could copy and paste directly into our .qhp, that would be great! I haven't found a way to do that, so we plan to maintain keywords directly in the .qhp.
Similarly, Table of Contents is also irrelevant, unless we can control the format we'll have to maintain the toc directly in the .qhp.
In Popup Topics, we are set to HTML encoded topics. Not sure if this is necessary.
That's all the settings we have to change. Create help content in H&M as normal, then to publish Webhelp. This creates a separate .htm file for each topic.
In the same folder as the .htm's, we create our .qhp and .qhcp files, and run qcollectiongenerator to produce our .qhc, which we then display with Qt Assistant. See http://doc.qt.nokia.com/4.7/qthelp-framework.html for help with the Qt side of this toolchain.
Again, it would be great if we could find a way to set up H&M to create the toc and the keywords in the format required for the .qhp and we could just paste them into the .qhp (or for that matter, maintain the .qhp in that template also). Another option would be to write a script to convert from what H&M creates for toc and keywords to what the .qhp requires. If you do that and don't mind sharing, please post the code!
Some benefits we find using H&M to solve this problem:
multiple documenters can work simultaneously, and source is stored as text files in Subversion, so it is versionable and you can compare changes.
easy WYSIWYG creation of help topics
can handle all kinds of text formatting and links. For example, in an end-to-end test of features to see what features of H&M would work in our end product (.qhc viewed in Qt Assistant), I was surprised to see Qt Assistant even handling hotspots in an image linking to other topics/anchors.
the .qhc is integrated into Qt so you have good control of your help from within your Qt app.
Again, if anyone has a better solution or improvements to this one, please post!
use Helpinator 3 Professional it's generat chm qt javahelp word pdf files easly ..
You might consider the HelpNDoc help authoring tool which has a WYSIWYG editor and can generate Qt Help files out of the box. Generated source files can optionally be kept for manual editing and manual compilation.

how to show code snippet on ASP.NET page with color formatting

I want to show code in asp.net page , how to show code snippet that it will look in same colors as it looks in visual studio , best examlple i can give is this stackoverflow.com itself we can put code fragment in our question which looks well colored giving better user exprience
i have just no clue ? also how to store code snippets when user enters them ?
You probably want to start with Google Prettify which is the same code coloring tool used here on Stack Overflow.
StackOverflow uses Prettify for syntax highlighting.
What do you mean by how to store code snippets? You might want to post that as a separate question with a little more detail.
The solution you're looking for is called syntax highlighting.
Prettify is a popular one, but I've used SyntaxHighlighter before and it is quite nice.
SyntaxHighlighter helps developers to
display code on their website.
Also, Syntax Highlighter recently added a hosted syntax highlighter "service."
About Syntax Highlighter
Hosted Version of Syntax Highlighter
Extra: Shanselman Speaks on Syntax Highlighting

Information Dashboards in R with ggplot2

I'm looking to create a static dashboard viewable in a web browser. And I'd like to create something like what Stephen Few does in his book Information Dashboard Design. (see example at bottom)
Ggplot2: Shouldn't be any issue producing the graphs below, right?
Dashboard Layout: Is grid suitable? Or should I lay things out in html/css?
If grid can do this easily enough, do you know of any good resources for learning how to us it? I've read the manual but I'm not finding it too helpful. I've seen the LearnR blog's ggplot2 sales dashboard (it uses grid) and I'm having trouble understanding the grid and layout part of things.
dasboard sample http://img251.imageshack.us/img251/1029/fewciodashboard800.png
See http://learnr.wordpress.com/2009/04/09/ggplot2-sales-dashboard/ for an example with code.
I think your html/css-direction might be a really smart move.
It might be easier to get an awesome layout using using Open Office draw and just link to the images, checking off the link box when insterting them for the first time. Open Office supports export to pdf making it usefull for reporting.
Even if it was straight forward to programaticly create a stunning document layout in R, I'm not sure it would be worth the time and effort.
Regards
I would suggest also having a look at the brew package, as in this example on the learnr blog.
A few years later, there are options available for dashboards and layouts with R.
For making grids in R, ggplot2's facet_wrap and facet_grid are excellent.
Shiny allows you to make web apps and dashboards with R. Shiny handles the HTML, CSS, and JavaScript for you. It's on CRAN.
To use ggplot2 to make an interactive Shiny dashboard with d3.js, you can connect to Plotly's ggplot2 figure converter. Here is a tutorial with code examples. Your published apps let you zoom, toggle, filter, pan, and see data on the hover, e.g.:
Disclaimer: I'm on the Plotly team.

Resources