8

hi refered the pgfplots user manual but found no instructions as to how one can proceed with creating a black and white line graph. My graph is as follows

\begin{figure}[H]
\begin{tikzpicture}
\begin{axis}[
scaled y ticks=real:150,
ytick scale label code/.code={},
ymax = 150,
symbolic x coords={8 by 8, 16 by 16,32 by 32,64 by 64},
xtick=data,
height=9cm,
width=8cm,
grid=major,
xlabel={Dimensions},
ylabel={Force},
legend style={
cells={anchor=east},
legend pos=south east,
}
]

\addplot coordinates {
(8 by 8,38) (16 by 16, 50)  (32 by 32, 69)  (64 by 64, 99) 
};


\addplot coordinates {
(8 by 8,43)  (16 by 16, 66) (32 by 32, 92)  (64 by 64, 118)
};

\addplot coordinates {
(8 by 8,25)  (16 by 16, 81) (32 by 32, 91)  (64 by 64, 150)
};

\addplot coordinates {
(8 by 8,100)  (16 by 16, 145)   (32 by 32, 146) (64 by 64, 150)
};

\addplot coordinates {
(8 by 8, 12)  (16 by 16, 135)   (32 by 32,141)  (64 by 64, 149)
};

\addplot coordinates {
(8 by 8, 111)  (16 by 16, 138)  (32 by 32, 140) (64 by 64, 145)
};

\addplot coordinates {
(8 by 8, 76)  (16 by 16, 121)   (32 by 32, 140) (64 by 64, 147)
};


\legend{$AAAA$,$BBBB$,$CCCC$,$DDDD$,$EEEE$,$FFFF$,$GGGG$}
\end{axis}
\end{tikzpicture}
     \caption{Force as area increases}
     \label{fig:force}
\end{figure}




\end{document}

enter image description here

I have posted the resulting graph as well. Iam clueless on how to give each line a unique symbol. Could someone please help me out.

  • 1
    Option cycle list name=black white – Ulrike Fischer Aug 3 '12 at 16:14
  • The \addplot command takes lots of optional arguments, some of which concern the style. If you're doing a lot of these, you'll probably want to use the cycle list command that Ulrike mentions – cmhughes Aug 3 '12 at 16:21
13

You can either use black and white color cycle list or add

\selectcolormodel{gray}

inside the tikzpicture environment.

\begin{tikzpicture}
\selectcolormodel{gray}
\begin{axis}[
scaled y ticks=real:150,
ytick scale label code/.code={},
ymax = 150,
symbolic x coords={8 by 8, 16 by 16,32 by 32,64 by 64},
xtick=data,
height=9cm,
width=8cm,
grid=major,
xlabel={Dimensions},
ylabel={Force},
legend style={
cells={anchor=east},
legend pos=south east,
}
]
\addplot coordinates {(8 by 8,38) (16 by 16, 50)  (32 by 32, 69)  (64 by 64, 99)};
\addplot coordinates {(8 by 8,43)  (16 by 16, 66) (32 by 32, 92)  (64 by 64, 118)};
\addplot coordinates {(8 by 8,25)  (16 by 16, 81) (32 by 32, 91)  (64 by 64, 150)};
\addplot coordinates {(8 by 8,100)  (16 by 16, 145)   (32 by 32, 146) (64 by 64, 150)};
\addplot coordinates {(8 by 8, 12)  (16 by 16, 135)   (32 by 32,141)  (64 by 64, 149)};
\addplot coordinates {(8 by 8, 111)  (16 by 16, 138)  (32 by 32, 140) (64 by 64, 145)};
\addplot coordinates {(8 by 8, 76)  (16 by 16, 121)   (32 by 32, 140) (64 by 64, 147)};
\legend{$AAAA$,$BBBB$,$CCCC$,$DDDD$,$EEEE$,$FFFF$,$GGGG$}
\end{axis}
\end{tikzpicture}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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