# Using different colors to plotting

I have values of Irf and frequencies and I need to plot a graph, which I did. Code:

Irf = List[0.0897, 0.2692, 0.4487, 0.62831, 0.8078, 0.8078, 0.6283,
0.4487, 0.2692, 0.0897];
Freq = List[1.4814, 2.4691, 3.9506, 5.9259, 8.3950, 10.8641, 9.3827,
6.4197, 3.9506, 1.4814];
Both = Transpose[{Irf, Freq}]
ListPlot[Both, PlotRange -> {Full, Full}, Joined -> True,
Frame -> True, Frame -> True,
FrameLabel -> {Row[{Style["Irf (mA)", FontSlant -> Italic,
FontSize -> 15]}],
Row[{Style["Frequency (GHz)", FontSlant -> Italic,
FontSize -> 15]}]}, PlotRange -> Full(*{{0,0.045},{0,8}}*),
LabelStyle -> Blue
, FrameTicksStyle -> Directive[Orange, 15], ImageSize -> 900,
PlotStyle -> {Red}, Joined -> True, AspectRatio -> 0.5,
Epilog -> {PointSize[0.01], Point[Both]}]


I want to divide graph on two, using two different collors. For example first five points will be red, and the other five - green. How can i do it?

• ListPlot[{Both[[;; 5]], Both[[6 ;;]]}, PlotStyle -> {Red, Green}, <the rest of your options here>]. In general you want to look at Part Apr 17, 2017 at 22:00
• Small tunning of your code,just change your Point[Both] into Riffle[{Red, Green}, Point /@ Partition[Both, 5]]
– yode
Apr 17, 2017 at 22:01

ListPlot[{Both, Both[[;; 5]], Both[[6 ;;]]}, PlotRange -> Full,
Joined -> {True, False, False}, Frame -> True,
BaseStyle -> PointSize[Large], PlotStyle -> {Blue, Red, Green},
AspectRatio -> 0.5]


• Thank you. I have one more question: How can we change color of the line between points?
– John
Apr 17, 2017 at 22:28
• @John, the first color in the setting of PlotStyle is the color of the lines between points, that is PlotStyle -> {Blue, Red, Green} makes the lines blue.
– kglr
Apr 17, 2017 at 22:40