I have to plot a figure in my paper, but I find problems in doing it (see below), can you give me some tips?

Some code (either LaTeX or Matlab) will be helpful.

enter image description here

  • I don't see any of the problems below (or above). Please post the code that's giving you trouble. Jan 27, 2015 at 12:02
  • I do not know how to plot it.@PaulGessler
    – xiaojidan
    Jan 27, 2015 at 12:05
  • At least provide some data or code.
    – percusse
    Jan 27, 2015 at 12:07
  • I just know how to plot them, not some detailed data. Can you know how to plot them? @percusse
    – xiaojidan
    Jan 27, 2015 at 12:10
  • You could try the pgfplots package. It takes some work to learn all of the details of pgfplots, but it is very powerful. Try pgfplots.sourceforge.net/pgfplots.pdf Jan 27, 2015 at 12:17

2 Answers 2


This should get you started. The code is raw and not coloured, these are left as assignment if you like. (I gotta run now sorry)

\node[draw,circle,inner sep=0.5ex] (a) {};
\node[inner sep=0.5ex,above=2ex] (b)  {};
\draw (b.north west) -- (b.south east);
\draw (b.north east) -- (b.south west);
\draw[thick](a.center) -- (b.center);
every axis plot post/.append style={
\addplot[only marks] coordinates
{(1,2) (2,1) (3,1.5) (4,1) (5,2)};

enter image description here

  • Great! Thank you very much. A beautiful figure is coming~
    – xiaojidan
    Jan 28, 2015 at 0:43

I don't know if it has to be this difficult but here it goes. But seriously this plot is anything but beautiful.

\documentclass[a4paper, 10pt]{article}
\pgfplotsset{my error bars/.style={
/pgfplots/error bars/draw error bar/.code 2 args={%
    \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}%
    \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}%
    \definecolor{mapped mark color}{rgb}{\pgfmathresult}%
\draw[mapped mark color!80!black] ##1 -- ##2 node[pos=1,sloped,allow upside down] {%
                         draw=mapped mark color!80!black]{%

\addplot+[scatter,only marks,
mark options={scale=2,thick},mark=o,,my error bars,
error bars/.cd,y dir=plus,
y explicit,error mark=x,
error mark options={scale=2,thick},
error bar style={ultra thick},] table[y error plus=y2,y=y1,x=x] {
x y1 y2 % y2 is the error bar amount
1 0.18 0.04
2 0.14 0.02
3 0.13 0.02
4 0.12 0.025
5 0.13 0.04
6 0.15 0.08

enter image description here

  • Wa! Great! Thanks a lot. So beautiful figure. I like it. BTW, can you finish it using other code such as Matlab?
    – xiaojidan
    Jan 28, 2015 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .