I am trying to plot the vertical concentration profile of a pollutant. By convention, altitude is plotted on the vertical axis, and concentration is on the x (even though altitude is the independent variable). When plotting the concentrations for pollutants that do not fit a one-to-one function, R connects the points in a most annoying zig-zag pattern, instead of connecting them in order by altitude.
I tried changing the concentration values to factors, with levels based on altitude values:
concSummary$value <- factor(concSummary$value, levels =
concSummary$value[order(concSummary$altitude)])
But this didn't seem to work. Does anyone know how to get around this problem?