# Adding a trend line to a series of box plots

#### deangelr

##### New Member
If this is so obvious everyone should know I apologize for the inconvenience. I would like to add a color coded trend line to a series of box plots (graph attached)..

Any help is much appreciated..

The code I have used for the graph is as follows:
Code:
boxplot(total1$y~total1$x)
The data looks like this but its probably not necessary..

Code:
$x [1] -13.0000000 -12.6530612 -12.3061224 -11.9591837 -11.6122449 -11.2653061 -10.9183673 [8] -10.5714286 -10.2244898 -9.8775510 -9.5306122 -9.1836735 -8.8367347 -8.4897959 [15] -8.1428571 -7.7959184 -7.4489796 -7.1020408 -6.7551020 -6.4081633 -6.0612245 [22] -5.7142857 -5.3673469 -5.0204082 -4.6734694 -4.3265306 -3.9795918 -3.6326531 [29] -3.2857143 -2.9387755 -2.5918367 -2.2448980 -1.8979592 -1.5510204 -1.2040816 [36] -0.8571429 -0.5102041 -0.1632653 0.1836735 0.5306122 0.8775510 1.2244898 [43] 1.5714286 1.9183673 2.2653061 2.6122449 2.9591837 3.3061224 3.6530612 [50] 4.0000000$y
[1] 0.16425213 0.16446394 0.16483380 0.16452690 0.16452727 0.16545171 0.16683403 0.16820805
[9] 0.16910761 0.16906651 0.16761859 0.16429766 0.16005747 0.16069792 0.15871489 0.14826989
[17] 0.13951012 0.13193516 0.12348524 0.11484289 0.10889779 0.10604680 0.10335454 0.10178520
[25] 0.10062285 0.09830493 0.09527004 0.09173088 0.08774875 0.08346114 0.07805828 0.07153300
[33] 0.06456116 0.05845316 0.05288977 0.04751710 0.04490921 0.04311034 0.04032817 0.04014305
[41] 0.04028394 0.03872037 0.03788178 0.03785863 0.03843549 0.03939690 0.04052744 0.04161167
[49] 0.04243414 0.04277942

#### deangelr

##### New Member
I would also like to change the X-axis values to whole numbers.. Again, thanks for your help !

#### bugman

##### Super Moderator
What are these data?

Boxplots are more suited to data that are arranged by catergory. Your plot is showing points (a new "boxplot") for each xy pair and are essentially meaningless.

#### deangelr

##### New Member
OK.. I see what you mean, this data has been averaged out so there is no range.. I am still a work in progress understanding stats..

I should just plot the data with a different function and can see the same pattern. Back to work..