I have the following code that draws a transition probability graph using the package heemod
(for the matrix) and the package diagram
(for drawing). The following code generates such a graph with data that I have generated:
library('heemod')
library('diagram')
mat_dim <- define_transition(
state_names = c('State_A', 'State_B', 'State_C'),
.18, .73, .09,
.12, .10, .78,
.58, .08, .33);
plot(mat_dim)
This creates the following plot:
My questions all originate from my poor understanding of the diagram
package and I can't figure out these seemingly simple adaptations...
How can I move the arrow at State_B around (e.g.90 degrees to one side) so that it does not overlap with other arrows? Is there a simple way to move the states closer together?
See ?plotmat
.
curve
, a matrix, to control the curvatures of the "non-self" transitionsself.shiftx
and self.shifty
to control the positions of the self-transitionsself.arrpos
to control the positions of the self-arrows This is really not easy. Here is what I obtained by a lot of trial-errors.
curves <- matrix(nrow = 3, ncol = 3, 0.05)
plot(mat_dim,
curve=curves,
self.shiftx = c(0.1,-0.1,0),
self.shifty = c(-0.1,-0.1,0.15),
self.arrpos = c(1,2.1,1))