# Rotate one plot and add legend tp another [closed]

I have one function and some data that I want to plot together.

I have two questions.

1. How can I have a legend for dataMC list plot?
2. How can I rotate the CMontkhab2 function plot a little to get it closer to the green points?

This is my code

Show[
Plot[CMontkhab2, {r, 0.2, 1.1},
PlotLegends -> {"\!$$\*SubscriptBox[\(C$$, $$PFC + RELK$$]\)(r)"},
PlotStyle -> {Thickness[0.006]}],
{ListPlot[{dataMC},
PlotStyle -> {{Green, PointSize[0.02]}}]},
LabelStyle -> {Bold, Gray, 20}, ImageSize -> Scaled[0.7],
Frame -> True, FrameLabel -> {"r", "C(r)"}, LabelStyle -> Bold]


and this is my plot

Here is the CMontkhab2 function I want to rotate a bit, so it gets closer to the green points:

CMontkhab2=
8 + 0.15 E^(-4.94941 r^2) (-104.167 + 219.33 r - 684.841 r^3) +
0.15 (-59.2126 + 68.9522 r - 14.5717 r^3) +
0.7 (-59.5597 + 60.1605 r - 12.6466 r^3)

• 1-How can i data plot put the label could you rephrase this? It is not clear what you are asking. 2-How can I rotate the function plot to match the green points? Is the function you have an expression? But If you want the function to match exactly the points, then why not just plot the points? Also, without showing the data or code for the function, it will make it hard to answer this fully. – Nasser Sep 11 '17 at 11:29
• 1-I want to put a legend for data plot @nasser – asal Sep 11 '17 at 11:32
• Can you fit a function to dataMC and plot that instead? – aardvark2012 Sep 11 '17 at 11:33
• For question 1 maybe this could help. – aardvark2012 Sep 11 '17 at 11:35
• In fact these green points is correct criterion and i should can Match the blue line on it.That's why I need to rotate blue line. and my function(Blue line function) have an expression.@nasser – asal Sep 11 '17 at 11:42

To answer your question about adding a legend to the data list plot, try adding the option PlotLegends -> {"Data"} to that plot.

Here the code.

f[r_] :=
8 + 0.15 E^(-4.94941 r^2) (-104.167 + 219.33 r - 684.841 r^3) +
0.15 (-59.2126 + 68.9522 r - 14.5717 r^3) +
0.7 (-59.5597 + 60.1605 r - 12.6466 r^3)


Some contrived data since you didn't give us a list of your data points.

data[u_, x0_] :=
Table[RotationTransform[u Degree, {x0, f[x0]}][{x, f[x]}], {x, .2, 1., .05}]
pts = data[-.25, .6];


The plot with legends for both curve and data points

Show[
Plot[f[r], {r, 0.2, 1.1},
PlotLegends -> {"\!$$\*SubscriptBox[\(C$$, $$PFC + RELK$$]\)(r)"},
PlotStyle -> {Thickness[0.006]}],
ListPlot[pts,
PlotLegends -> {"Data"},
PlotStyle -> {{Green, PointSize[0.02]}}],
LabelStyle -> {Bold, Gray, 12},
ImageSize -> Scaled[.8],
Frame -> True,
FrameLabel -> {"r", "C(r)"}]


Note: I made the contrived data by rotating your function about a certain point on it. Is that not ironic?