xlab=”Year”,ylab=”Expenditures/GDP (%)”) # adds titles to the axes lines(year,defense,col=”red”,lwd=2.5) # adds a line for defense expenditures lines(year,health,col=”blue”,lwd=2.5) # adds a line for health expenditures legend(2000,9.5, # places a legend at the appropriate ...
library(ggplot2) # lookup all nodes nodes_df <- lookup_users(nodes_cc$id) @@ -183,6 +193,20 @@ plot(f1, vertex.label= V(f1)$name, vertex.size = V(f1)$Popularity*.003, vertex.label.size=.1) legend("topleft",legend=c("Otros distritos", "Distrito más seguido"), pch=1,col...
Below you will find an R function that draws a label in one of the three regions — figure (default), plot or device. You specify the position of the label using the labels also used bylegend: “topleft”, “bottomright” etc. fig_label <- function(text, region="figur...
theme(plot.title = element_text(hjust = 0.5), legend.position="none") + labs(title = "Words disappearing from #SOTEU speeches:\n{closest_state}") ``` ## License This document, the graphs, and the code are distributed under a [Creative Commons license (BY)](https://creativecommons.or...
Let’s first set up a basic plot to experiment with: library(legendry)#> Loading required package: ggplot2base<-ggplot(mpg, aes(displ,hwy,colour=cty))+geom_point()+labs(x="Engine displacement",y="Highway miles per gallon",col="City miles\nper gallon")+theme(axis.line=element_line()...