Hello R-list,

I am plotting a weighted linear regression in R. The points on my chart are
also scaled to sample size, so some points are large, some are small. I have
figured out everything I need using the plot() function: how to plot the
points, scale them by sample size, weight the linear regression by sample
size, plot that line, and plot the labels for the points. However, although
the pointLabel() function assures that the labels do not overlap with each
other, they still overlap with the larger points, and sometimes run off the
side of the chart too. I have tried saving the plot as EPS, PDF, SVG and
opening them in GIMP to try to move the text around, but GIMP does not
recognize the text as text, so I cannot select the labels and move them off
the points. I have tried various "offsets" too but that does not work
either. So I need to either (a) print the labels on the plot so that they do
not overlap the points or (b) be able to move the text around in the
resulting image file. Any advice? Here is the code I am using. BTW, I have
also tried ggplot2 but it has no function (that I am aware of) like
pointLabels() to avoid label overlap. Please feel free to email me directly.

postscript(file="fig_a.eps");
plot(x, y, xlab="X-axis", ylab="Y-axis", cex=0.02*sample_size, pch=21);
abline(lm(y~x, weight=sample_size))
pointLabel(x, y, labels=Category, cex=1, doPlot=TRUE, offset=2.5);
dev.off()

Thank you,

-craig.star...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to