Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the size of the arrowheads in a markov chain plot

I've plotted a markov chain in R, but I dislike the rather hugh arrowheads that the plot-function is plotting. Is there a way to make the heads smaller?

library( markovchain )

transition.matrix <- matrix( data = c( 0.5, 0, 0, 0.5, 0.2, 0, 0, 0.8, 1 ),
                         nrow = 3, ncol = 3,
                         dimnames = list( c( "A", "B", "C" ), c( "A", "B", "C" ) ) )

transition.matrix <- new( "markovchain", transitionMatrix = transition.matrix )

print( transition.matrix )

plot( transition.matrix  )
like image 751
JimBoy Avatar asked Oct 10 '15 14:10

JimBoy


Video Answer


1 Answers

markovchain uses the igraph package to plot transition matrices, so you can use parameters from that package to adjust the graph. For example, to set the arrowhead size:

plot(transition.matrix, edge.arrow.size=0.5)

For more information on customization, see the igraph manual.

enter image description here

like image 52
eipi10 Avatar answered Sep 28 '22 08:09

eipi10