I am dealing with temperature data that are measured in different distances away from the forest edge (0m, 10m,30m,50m,80m) and I would like to find out whether the temperature will drop as the distance away from the edge increases. I tried to use geom_point to plot the temperature with respect to the distance, however, the x axis value are not labelled as 0m, 10m,30m,50m and 80m, may I ask how to change it?

Also I would like to ask is it appropriate to run correlation using temperature and distance from the edge to show that they are negatively correlated in this situation? I saw correlation should be based on two continuous variable, but the distances from the edge are discrete variable, so should I just present the result using boxplot? Or is computing regression appropriate in this case?enter image description here

enter image ddddasdfasf here


1 Answer 1


Your feature "Distance from the edge" is represented as a factor (), which means it is interpreted as a categorical variable. You need to make sure that it is interpreted as a numerical (either integer or double) and this should label it appropriately in your plot and also correctly display the distance between them (as they are not evenly spaced). This might help to get the type right.

Check this answer for a discussion on what correlation methods to use for continuous and discrete variables.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.