问题描述:

I would be very appreciative if someone could kindly advise me as to how I can inform R to change data points to circles instead of what appears to be underscores. I am using a Mac computer, and package is 'Quartz.'

For example:

quartz("Quartz", width=8, height=4, pointsize=16)

plot(dframe1$Group, dframe1$Lambda.max,type="p")

Image:

网友答案:

I think this is more likely related to what you are plotting rather than the method of display. If you try, for example, plot(rnorm(10), rnorm(10), type="p"), you'll see that you get circles. I'm guessing that dframe1$Group is a factor.

Can you post a sample data set for reference?

So I'm using this as the dataset

dframe1 <- data.frame(Group=c("A1","A2", "B1", "B2"), Lambda.max=c(1,4,2,3))

which should be close enough.

This is a little tricky because R wants to do things a certain way for factors. The approach I would recommend would be to draw the axes manually.

plot.default(dframe1$Group, dframe1$Lambda.max, type="p", axes=F)
axis(side=2)
axis(side=1, at=seq_along(dframe1$Group), labels=dframe1$Group)

edit: As requested, if you want a box around the plot as is fairly standard for R plots, you also have to manually add it

box()

Now the plot should look like this

相关阅读:
Top