CyberPlayerOne
CyberPlayerOne

Reputation: 3180

How to customize values on x-axis in qplot()?

I am using qplot with the following code.

 qplot(topN, F1Score, data = evaluation.data, geom = c("point", "line"), color= Recommender, main = "F1 score...")

The x-axis is topN and y-axis is F1Score. The x-axis is supposed to only contain integer values. But there's decimals as shown in the Figure. How can I customize this to use only integer values? enter image description here

Upvotes: 0

Views: 241

Answers (1)

shadow
shadow

Reputation: 22333

You can use the breaks argument in scale_x_continuous.

qplot(topN, 
      F1Score, 
      data = evaluation.data, 
      geom = c("point", "line"), 
      color= Recommender, 
      main = "F1 score...") + 
  scale_x_continuous(breaks=c(5, 10, 15))

Also your color guide does not seem very useful. I would probably remove the legend.

+ scale_color_discrete(guide="none")

Upvotes: 2

Related Questions