0

I am trying to make a plot and my data looks like this:

diversity position
113 2098776
116 4598777
67 5626222
200 6423068
...

and I used this script:

qplot(position, diversity, data = FILE)

but when plot appears, in x axis I see values like 0e+00 1e+07 , but i want to convert these values begin from 0 to 60 instead.. any guide please?

1

2 Answers 2

2

you could rescale the data,

qplot(scales::rescale(position, c(0,60)), diversity, data = FILE)
Sign up to request clarification or add additional context in comments.

Comments

2

Make sure you load the scales package library(scales) and then Try this qplot(position, diversity, data = yourdataframe) + scale_x_continuous(labels = comma)

3 Comments

now units got realy huge like 10,000,000 40,000,000 how can I make it smaller?
This would really be reproducing the answer of @Jack Aidley, as mentioned by @Gopalaqplot(position, diversity, data = yourdataframe) + scale_x_continuous(labels=fancy_scientific). Please note that fancy_scientific is the name of a function used to format labels on x-axis. You can find it here
Another possibility is qplot(position, diversity, data = yourdataframe) + scale_x_continuous(breaks = trans_breaks("log10", function(x) 10^x), labels = trans_format("log10", math_format(10^.x)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.