Change the size of the arrowheads in a markov chain plot
Asked Answered
I

1

8

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  )
Isaak answered 10/10, 2015 at 14:49 Comment(0)
G
11

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

Graz answered 10/10, 2015 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.