I am going to plot a bar histogram using the following command:

 bar width=0.2cm,‎
 legend style={at={(0.5,-0.21)},‎
 enlarge x limits={upper,value=0.25},‎
 anchor=north,legend columns=-1},‎
 ylabel={\ Data size}, ‎x‎label={\ Computation time(sec)},‎
 symbolic y coords={1024 by 1024‎,512 by 512,256 by 256},‎
  nodes near coords,‎
  nodes near coords align=horizontal,‎
  \addplot coordinates {(108.3,1024 by 1024) (14.22,512 by 512) (1.7,256 by 256)‎
  \addplot coordinates {(3.5,1024 by 1024) (0.85,512 by 512) (0.21,256 by 256)‎
  \legend{Conventional method,Butterfly-based method}‎

but my histogram is not at the center of my page, my table is like this:

enter image description here

How can I put it at the middle relative to the left and right of my page? How can I reduce the space between columns?

  • 1
    you want to centre the picture so \centering should be before \begin{tikzpicture} – David Carlisle Jul 4 '15 at 19:46

\centering after \begin{tikzpicture} does nothing: use a center environment, but also use a relative width, because 13cm is most likely too big for the text width.


 width=.8\textwidth, % <------- relative width
 bar width=0.2cm,
 legend style={at={(0.5,-0.21)},
 enlarge x limits={upper,value=0.25},
 anchor=north,legend columns=-1},
 ylabel={\ Data size},
 xlabel={\ Computation time(sec)},
 symbolic y coords={1024 by 1024,512 by 512,256 by 256},
 nodes near coords,
 nodes near coords align=horizontal,
  \addplot coordinates {(108.3,1024 by 1024) (14.22,512 by 512) (1.7,256 by 256)
  \addplot coordinates {(3.5,1024 by 1024) (0.85,512 by 512) (0.21,256 by 256)
  \legend{Conventional method,Butterfly-based method}

If you have a figure environment around the plot, then you should type



\caption{The caption}\label{thelabel}


For producing the picture I used the showframe package, so the boundaries of the text block are shown.

enter image description here

  • how can I reduce the space between bars? – user3482383 Jul 4 '15 at 20:01
  • @user3482383 That is a completely different question and in this site we like to keep, if possible, one question per post. If, after searching for similar questions in this site you don't find an answer for this new requirement, please feel free to open a fresh new question. – Gonzalo Medina Jul 4 '15 at 20:04

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.