En la gráfica base R, mueva la etiqueta del eje más cerca del eje
He eliminado las etiquetas en el eje y porque solo la cantidad relativa es realmente importante.
w <- c(34170,24911,20323,14290,9605,7803,7113,6031,5140,4469)
plot(1:length(w), w, type="b", xlab="Number of clusters",
ylab="Within-cluster variance",
main="K=5 eliminates most of the within-cluster variance",
cex.main=1.5,
cex.lab=1.2,
font.main=20,
yaxt='n',lab=c(length(w),5,7), # no ticks on y axis, all ticks on x
family="Calibri Light")
Sin embargo, la supresión de esas etiquetas de marca deja mucho espacio en blanco entre la etiqueta del eje y ("Varianza dentro del clúster") y el eje y. ¿Hay alguna manera de empujarlo hacia atrás? Si de alguna manera establezco las etiquetas de tick (invisibles) para ir dentro de el eje, ¿la etiqueta del eje se asentaría a lo largo del eje?
25
2 answers
Intente configurar ylab=""
en su llamada plot
y use title
para establecer la etiqueta del eje y manualmente. Usando line
puede ajustar la posición de la etiqueta, por ejemplo:
plot(1:length(w), w, type="b", xlab="Number of clusters", ylab="",
main="K=5 eliminates most of the within-cluster variance",
cex.main=1.5,
cex.lab=1.2,
font.main=20,
yaxt='n',lab=c(length(w),5,7), # no ticks on y axis, all ticks on x
family="Calibri Light")
title(ylab="Within-cluster variance", line=0, cex.lab=1.2, family="Calibri Light")
Por favor lea ?title
para más detalles.
33
Author: sgibb,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-15 18:03:31
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-15 18:03:31
Ajuste mgp
, véase ?par
title(ylab="Within-cluster variance", mgp=c(1,1,0), family="Calibri Light",cex.lab=1.2)
19
Author: xb.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-15 18:11:21
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-15 18:11:21