Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following figure I want to add as legend in the figure

\ldots: st. 1

___: st. 2

Please help me.

\begin{figure*}[htp]
{\tiny
  \centering 
  \subfloat[$U(0.5)  $]{
  \begin{tikzpicture}[scale=0.70,transform shape]
    \draw (0,30*0.84) -- (5*1,30*0.84);
\draw (0,30*1.0) -- (5,30*1.0);
\draw (0,30*0.84)-- (0,30*1.0);
\draw (5,30*0.84)-- (5,30*1.0);
\draw (2.5,3*8.6-1.8)node{\large{$p\rightarrow$}};
\draw (-0.5-0.8,28.5)node{\large{$\uparrow$}};
\draw (-0.5-0.8,28)node{\large{$\delta$}};
\draw (0,26.8-2.0) node{0};
\draw (5*0.2,26.6-2) node{0.2};
\draw (5*0.2,26.8-1.8)--(5*0.2,26.8+0.4-1.8);
\draw (5*0.4,26.6-2) node{0.4};
\draw (5*0.4,26.8-1.8)--(5*0.4,26.8+0.4-1.8);
\draw (5*0.6,26.6-2) node{0.6};
\draw (5*0.6,26.8-1.8)--(5*0.6,26.8+0.4-1.8);
\draw (5*0.8,26.6-2) node{0.8};
\draw (5*0.8,26.8-1.8)--(5*0.8,26.8+0.4-1.8);
\draw (5*1.0,26.6-2) node{1.0};
%\draw (5*0.0-0.6,27.0-3) node{0.9};
%\draw (5*0.0-0.2,27.0)--(5*0.0+0.2,27.0);
%\draw (5*0.0-0.6,30*0.92-3) node{0.82};
%\draw (5*0.0-0.2,30*0.92-3)--(5*0.0+0.2,30*0.92-3);
\draw (5*0.0-0.6,30*0.94-3) node{0.84};
%\draw (5*0.0-0.2,30*0.94-3)--(5*0.0+0.2,30*0.94-3);
\draw (5*0.0-0.6,30*0.96-3) node{0.86};
\draw (5*0.0-0.2,30*0.96-3)--(5*0.0+0.2,30*0.96-3);
\draw (5*0.0-0.6,30*0.98-3) node{0.88};
\draw (5*0.0-0.2,30*0.98-3)--(5*0.0+0.2,30*0.98-3);
\draw (5*0.0-0.6,30*1.0-3) node{0.90};
\draw (5*0.0-0.2,30*1.00-3)--(5*0.0+0.2,30*1.00-3);
\draw (5*0.0-0.6,30*1.02 -3) node{0.92};
\draw (5*0.0-0.2,30*1.02-3)--(5*0.0+0.2,30*1.02-3);
\draw (5*0.0-0.6,30*1.04 -3) node{0.94};
\draw (5*0.0-0.2,30*1.04-3)--(5*0.0+0.2,30*1.04-3);
\draw (5*0.0-0.6,30*1.06 -3) node{0.96};
\draw (5*0.0-0.2,30*1.06-3)--(5*0.0+0.2,30*1.06-3);
\draw (5*0.0-0.6,30*1.08 -3) node{0.98};
\draw (5*0.0-0.2,30*1.08-3)--(5*0.0+0.2,30*1.08-3);
\draw (5*0.0-0.6,30*1.08+30*0.02 -3) node{1.00};
%\draw (5*0.0-0.2,30*1.08+30*0.02-3)--(5*0.0+0.2,30*1.08+30*0.02-3);

\draw[dotted](0.000000,27.213000)--(0.050000,27.271800)--(0.100000,27.403200)--(0.150000,27.286800)--(0.200000,27.270000)--(0.250000,27.396600)--(0.300000,27.445200)--(0.350000,27.395400)--(0.400000,27.491400)--(0.450000,27.558600)--(0.500000,27.593400)--(0.550000,27.642600)--(0.600000,27.593400)--(0.650000,27.645600)--(0.700000,27.601800)--(0.750000,27.756000)--(0.800000,27.772200)--(0.850000,27.815400)--(0.900000,27.832200)--(0.950000,27.785400)--(1.000000,27.897600)--(1.050000,28.033200)--(1.100000,28.022400)--(1.150000,27.937800)--(1.200000,28.015200)--(1.250000,28.065000)--(1.300000,28.057200)--(1.350000,28.114800)--(1.400000,28.057200)--(1.450000,28.150800)--(1.500000,28.200000)--(1.550000,28.152000)--(1.600000,28.206600)--(1.650000,28.246200)--(1.700000,28.246200)--(1.750000,28.264200)--(1.800000,28.393800)--(1.850000,28.347600)--(1.900000,28.317000)--(1.950000,28.417200)--(2.000000,28.447200)--(2.050000,28.464600)--(2.100000,28.440000)--(2.150000,28.483800)--(2.200000,28.481400)--(2.250000,28.524000)-
-(2.300000,28.584600)--(2.350000,28.576200)--(2.400000,28.572600)--(2.450000,28.646400)--(2.500000,28.604400)--(2.550000,28.718400)--(2.600000,28.684200)--(2.650000,28.727400)--(2.700000,28.774200)--(2.750000,28.805400)--(2.800000,28.812600)--(2.850000,28.783800)--(2.900000,28.809600)--(2.950000,28.875600)--(3.000000,28.821600)--(3.050000,28.910400)--(3.100000,28.905600)--(3.150000,28.886400)--(3.200000,28.953600)--(3.250000,29.024400)--(3.300000,29.046600)--(3.350000,29.072400)--(3.400000,29.064600)--(3.450000,29.053800)--(3.500000,29.062200)--(3.550000,29.098800)--(3.600000,29.151000)--(3.650000,29.130000)--(3.700000,29.157600)--(3.750000,29.173200)--(3.800000,29.223600)--(3.850000,29.190000)--(3.900000,29.168400)--(3.950000,29.278200)--(4.000000,29.243400)--(4.050000,29.319600)--(4.100000,29.318400)--(4.150000,29.319000)--(4.200000,29.350200)--(4.250000,29.377800)--(4.300000,29.402400)--(4.350000,29.380800)--(4.400000,29.385600)--(4.450000,29.393400)--(4.500000,29.410800)--(4.550000,29.469000)--(4.600000,
29.451600)--(4.650000,29.487000)--(4.700000,29.490600)--(4.750000,29.547600)--(4.800000,29.556000)--(4.850000,29.553000)--(4.900000,29.567400)--(4.950000,29.586000)--(5.000000,29.558400);

\draw[black](0.000000,27.258600)--(0.050000,27.285000)--(0.100000,27.309600)--(0.150000,27.370800)--(0.200000,27.468600)--(0.250000,27.417600)--(0.300000,27.533400)--(0.350000,27.564000)--(0.400000,27.643800)--(0.450000,27.719400)--(0.500000,27.699000)--(0.550000,27.803400)--(0.600000,27.756600)--(0.650000,27.845400)--(0.700000,27.796200)--(0.750000,27.867600)--(0.800000,27.967800)--(0.850000,27.989400)--(0.900000,28.036200)--(0.950000,28.023000)--(1.000000,28.137000)--(1.050000,28.153800)--(1.100000,28.159200)--(1.150000,28.160400)--(1.200000,28.254000)--(1.250000,28.348800)--(1.300000,28.344000)--(1.350000,28.408200)--(1.400000,28.384800)--(1.450000,28.336800)--(1.500000,28.423800)--(1.550000,28.405200)--(1.600000,28.572000)--(1.650000,28.556400)--(1.700000,28.540800)--(1.750000,28.571400)--(1.800000,28.649400)--(1.850000,28.629000)--(1.900000,28.648800)--(1.950000,28.671600)--(2.000000,28.682400)--(2.050000,28.703400)--(2.100000,28.755000)--(2.150000,28.761000)--(2.200000,28.789800)--(2.250000,28.803600)--
(2.300000,28.798200)--(2.350000,28.861800)--(2.400000,28.911000)--(2.450000,28.933800)--(2.500000,28.946400)--(2.550000,28.995000)--(2.600000,28.963800)--(2.650000,28.984200)--(2.700000,29.019000)--(2.750000,28.983000)--(2.800000,29.048400)--(2.850000,29.046000)--(2.900000,29.091000)--(2.950000,29.081400)--(3.000000,29.128800)--(3.050000,29.142000)--(3.100000,29.175600)--(3.150000,29.137200)--(3.200000,29.160000)--(3.250000,29.180400)--(3.300000,29.222400)--(3.350000,29.279400)--(3.400000,29.225400)--(3.450000,29.253000)--(3.500000,29.287800)--(3.550000,29.290200)--(3.600000,29.309400)--(3.650000,29.324400)--(3.700000,29.359200)--(3.750000,29.334600)--(3.800000,29.349000)--(3.850000,29.379000)--(3.900000,29.381400)--(3.950000,29.367000)--(4.000000,29.375400)--(4.050000,29.434200)--(4.100000,29.407800)--(4.150000,29.446800)--(4.200000,29.400000)--(4.250000,29.436000)--(4.300000,29.485800)--(4.350000,29.457600)--(4.400000,29.544000)--(4.450000,29.488800)--(4.500000,29.521800)--(4.550000,29.532000)--(4.600000,
29.498400)--(4.650000,29.520000)--(4.700000,29.560200)--(4.750000,29.545200)--(4.800000,29.543400)--(4.850000,29.589600)--(4.900000,29.593800)--(4.950000,29.587800)--(5.000000,29.572800);

\end{tikzpicture}
 \label{fig0}}
}
\end{figure*}
share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Use pgfplots package for such plots.

\documentclass[10pt]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ylabel=$\delta$,xlabel=$p$,
x filter/.code={\pgfmathdivide{#1}{5.0}},
y filter/.code={\pgfmathdivide{#1}{29.593800}},
legend pos=south east]
\addplot[no marks,dotted] coordinates {(0.000000,27.213000) (0.050000,27.271800) (0.100000,27.403200) (0.150000,27.286800) (0.200000,27.270000) (0.250000,27.396600) (0.300000,27.445200) (0.350000,27.395400) (0.400000,27.491400) (0.450000,27.558600) (0.500000,27.593400) (0.550000,27.642600) (0.600000,27.593400) (0.650000,27.645600) (0.700000,27.601800) (0.750000,27.756000) (0.800000,27.772200) (0.850000,27.815400) (0.900000,27.832200) (0.950000,27.785400) (1.000000,27.897600) (1.050000,28.033200) (1.100000,28.022400) (1.150000,27.937800) (1.200000,28.015200) (1.250000,28.065000) (1.300000,28.057200) (1.350000,28.114800) (1.400000,28.057200) (1.450000,28.150800) (1.500000,28.200000) (1.550000,28.152000) (1.600000,28.206600) (1.650000,28.246200) (1.700000,28.246200) (1.750000,28.264200) (1.800000,28.393800) (1.850000,28.347600) (1.900000,28.317000) (1.950000,28.417200) (2.000000,28.447200) (2.050000,28.464600) (2.100000,28.440000) (2.150000,28.483800) (2.200000,28.481400) (2.250000,28.524000)
(2.300000,28.584600) (2.350000,28.576200) (2.400000,28.572600) (2.450000,28.646400) (2.500000,28.604400) (2.550000,28.718400) (2.600000,28.684200) (2.650000,28.727400) (2.700000,28.774200) (2.750000,28.805400) (2.800000,28.812600) (2.850000,28.783800) (2.900000,28.809600) (2.950000,28.875600) (3.000000,28.821600) (3.050000,28.910400) (3.100000,28.905600) (3.150000,28.886400) (3.200000,28.953600) (3.250000,29.024400) (3.300000,29.046600) (3.350000,29.072400) (3.400000,29.064600) (3.450000,29.053800) (3.500000,29.062200) (3.550000,29.098800) (3.600000,29.151000) (3.650000,29.130000) (3.700000,29.157600) (3.750000,29.173200) (3.800000,29.223600) (3.850000,29.190000) (3.900000,29.168400) (3.950000,29.278200) (4.000000,29.243400) (4.050000,29.319600) (4.100000,29.318400) (4.150000,29.319000) (4.200000,29.350200) (4.250000,29.377800) (4.300000,29.402400) (4.350000,29.380800) (4.400000,29.385600) (4.450000,29.393400) (4.500000,29.410800) (4.550000,29.469000) (4.600000,
29.451600) (4.650000,29.487000) (4.700000,29.490600) (4.750000,29.547600) (4.800000,29.556000) (4.850000,29.553000) (4.900000,29.567400) (4.950000,29.586000) (5.000000,29.558400)};

\addplot[no marks] coordinates {(0.000000,27.258600) (0.050000,27.285000) (0.100000,27.309600) (0.150000,27.370800) (0.200000,27.468600) (0.250000,27.417600) (0.300000,27.533400) (0.350000,27.564000) (0.400000,27.643800) (0.450000,27.719400) (0.500000,27.699000) (0.550000,27.803400) (0.600000,27.756600) (0.650000,27.845400) (0.700000,27.796200) (0.750000,27.867600) (0.800000,27.967800) (0.850000,27.989400) (0.900000,28.036200) (0.950000,28.023000) (1.000000,28.137000) (1.050000,28.153800) (1.100000,28.159200) (1.150000,28.160400) (1.200000,28.254000) (1.250000,28.348800) (1.300000,28.344000) (1.350000,28.408200) (1.400000,28.384800) (1.450000,28.336800) (1.500000,28.423800) (1.550000,28.405200) (1.600000,28.572000) (1.650000,28.556400) (1.700000,28.540800) (1.750000,28.571400) (1.800000,28.649400) (1.850000,28.629000) (1.900000,28.648800) (1.950000,28.671600) (2.000000,28.682400) (2.050000,28.703400) (2.100000,28.755000) (2.150000,28.761000) (2.200000,28.789800) (2.250000,28.803600) 
(2.300000,28.798200) (2.350000,28.861800) (2.400000,28.911000) (2.450000,28.933800) (2.500000,28.946400) (2.550000,28.995000) (2.600000,28.963800) (2.650000,28.984200) (2.700000,29.019000) (2.750000,28.983000) (2.800000,29.048400) (2.850000,29.046000) (2.900000,29.091000) (2.950000,29.081400) (3.000000,29.128800) (3.050000,29.142000) (3.100000,29.175600) (3.150000,29.137200) (3.200000,29.160000) (3.250000,29.180400) (3.300000,29.222400) (3.350000,29.279400) (3.400000,29.225400) (3.450000,29.253000) (3.500000,29.287800) (3.550000,29.290200) (3.600000,29.309400) (3.650000,29.324400) (3.700000,29.359200) (3.750000,29.334600) (3.800000,29.349000) (3.850000,29.379000) (3.900000,29.381400) (3.950000,29.367000) (4.000000,29.375400) (4.050000,29.434200) (4.100000,29.407800) (4.150000,29.446800) (4.200000,29.400000) (4.250000,29.436000) (4.300000,29.485800) (4.350000,29.457600) (4.400000,29.544000) (4.450000,29.488800) (4.500000,29.521800) (4.550000,29.532000) (4.600000,
29.498400) (4.650000,29.520000) (4.700000,29.560200) (4.750000,29.545200) (4.800000,29.543400) (4.850000,29.589600) (4.900000,29.593800) (4.950000,29.587800) (5.000000,29.572800)};
\addlegendentry{Style 1}
\addlegendentry{Style 2}
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Thanks for the help. However I multiply x- coordinate by 5 and y coordinate 33.5. So, I want numbers like 0.0, 0.2,0.4, 0.6,0.8 and 1.0 in the x axis instead of 0,1,2 etc. Similarly for y coordinate 0.80, 0.82 like that as my previous figure. –  user12290 Aug 23 '12 at 5:59
    
@user12290 Please see the edited answer. I've used 29.598300 for the y-axis normalization. –  percusse Aug 23 '12 at 8:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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