Can ggplot2 Produce Flowcharts? - r

I would like to draw a simple flowchart in R. As shown in the example below, I would like to be able to determine:
the shape of the boxes
the color of the boxes
the position of the boxes
the text within the boxes
the direction of the arrows between the boxes
the text beside the boxes
There are several packages, that are able to draw such a flowchart (e.g. DiagrammeR). However, I am wondering if this is possible with ggplot2, since I would like to use the ggplot2 themes etc.

Related

glPolygonOffset equivalent in Javafx

I'm trying to plot two MeshView at exact same location, one rendered with FILL and the other with LINE in order to give it wireframe looks. But unfortunately the wireframe only appears on the backside of the mesh as shown below.
In Java3D I fixed this problem using glPolygonOffset. Is there an equivalent to that in javafx?

Labeling shape on plotly js

I've been trying to add different colored shapes to the background of plotly.js. However, I also want to be able to label them somewhere so the user knows what color has what meaning. How can I do that?
The first example on here is basically what I've got so far:
https://plot.ly/javascript/shapes/

Align and format text according to plots in R Shiny

I would like to add descriptive text to my plots in Shiny. I am outputting a dynamic number of plots in two columns and I would like to add a third column, like so:
However, I can't figure out how to align the text with the plots. Can I use CSS containers or div's? HTML codes are working, but hardcoding a bunch of <br/>'s does not seem smart. Here is a minimal example.
Any help is greatly appreciated.
Just change the htmlOutput line to
htmlOutput(plotname, style="height:400px;")
You can use the Inspect Element context menu of Firefox to find out the height for the plots.

Set width and height of graphic made using ggplot, grid, and gridExtra

If I have a graphic composed of several plots, say three plots arranged vertically. This is a gtable object and can be drawn to the page with:
grid::grid.newpage()
grid::grid.draw(plot)
However I see that the plot in my RStudio is 'smushed up' as in the screenshot below:
As you can see in the bottom right corner it is squashed and the titles overlap with other elements of the graphic.
If I hit zoom and view the plot it is a lot bigger:
Now I know, that if I were to export my gtable plot using pdf() or png() and such devices, I can set a width and a height, and so just make it big enough such that the plot is not squashed.
However, instead of one of those graphic devices, I would like to use export.grid, from the gridSVG package to save it to an SVG file. But if I do
gridSVG::export.grid(plot)
Then the SVG file exported looks squashed as it does in the RStudio plot window.
So my question is, how can I manipulate the dimensions of the graphic so it is drawn to SVG without it looking squashed? I draw the plot initially with grid.newpage and grid.draw, I wonder perhaps I have to specify some size of the page or drawing using grid.
Thanks,
Ben.

Formatting the border between lattice panels in R

When making a multi-panel plot in lattice, each panel is by default bordered by a black line. I would like to be able to adjust the color and width of these panel borders. Bonus points if you can show how to add a colored border around specific panel(s).
For instance, this code makes a plot with three panels, one for each unique value of df$gears. Each panel is bordered by a black line.
library(lattice)
xyplot(mpg~hp|factor(gear), mtcars, layout=c(3,1), between=list(x=c(1))
,par.settings=list(axis.line=list(col="lightgray")))
This code almost does what I want. It changes the borders (and tick marks) of all panels to light gray. Is there a way to change the color of components independently (e.g., left and right axes)? Is there a way to address the formatting for each sub-panel independently?
Thanks,
Bryan

Resources