2

10^3 is repeated for every number of the Y-axis, how to remove 10^3 and add it once on the top of the Y-axis.

enter image description here

\documentclass{article}
\usepackage{pgfplots}


\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            symbolic x coords={X1, X2, X3, X4},
            xtick=data,
            ylabel style={font=\footnotesize},
            xticklabel style = {font=\footnotesize},
            enlargelimits=0.2,
            nodes near coords,
            y tick label style={/pgf/number format/sci}
          ]

      \addplot[mark=*, only marks,
        point meta=explicit symbolic] coordinates {
        (X1, 6000)
        (X2, 5000)
        (X3, 4000)
        (X4, 3000)
    };

    \end{axis}
\end{tikzpicture}


\end{document}
1

Here is one possibility. More details can be found in section 4.15.3 "Tick Scaling – Common Factors In Ticks" of the pgfplots manual.

\documentclass{article}
\usepackage{pgfplots}


\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            symbolic x coords={X1, X2, X3, X4},
            xtick=data,
            ylabel style={font=\footnotesize},
            xticklabel style = {font=\footnotesize},
            enlargelimits=0.2,
            nodes near coords,
             y tick label style={scaled ticks=base 10:-3},
          ]

      \addplot[mark=*, only marks,
        point meta=explicit symbolic] coordinates {
        (X1, 6000)
        (X2, 5000)
        (X3, 4000)
        (X4, 3000)
    };

    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1

Replace your option y tick label style={/pgf/number format/sci} with scaled ticks=base 10:-3 and don't forget the \pgfplotsset{compat=1.5.1} line in preamble.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5.1}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            scaled ticks=base 10:-3,
            symbolic x coords={X1, X2, X3, X4},
            xtick=data,
            ylabel style={font=\footnotesize},
            xticklabel style = {font=\footnotesize},
            enlargelimits=0.2,
            nodes near coords,
          ]    
      \addplot[mark=*, only marks,
        point meta=explicit symbolic] coordinates {
        (X1, 6000)
        (X2, 5000)
        (X3, 4000)
        (X4, 3000)
    };
    \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

  • Sorry, how is this different from what I did. This is now the second time in a very short time that you copy essentially the code from my earlier answer without acknowledging this. This time, the time difference is small, but in other occasions llike here it is not. Why are you doing this? How do you think the OP will benefit from this? If you think that you improved an existing answer, why not specifying what is better? – marmot Aug 23 '18 at 2:52
  • @marmot -- I don't copy anything from you and I needn't. Look at the 4.15.3 Tick Scaling – Common Factors In Ticks section, p. 345 in the manual and you now should know from where I copy. It's a coincidence and I'm still happy if you ask me to delete it. – AboAmmar Aug 23 '18 at 2:57
  • OK, and the fact that this contains the main point of my earlier answer is also a coincidence? (I will stop this discussion here, but would like to let you know that I would find it more appropriate if one acknowledge earlier answers, in particular when the newer answer repeats some key points of the older one.) – marmot Aug 23 '18 at 3:02
  • How is that answer copying your idea? You used a smooth cycle plot and I used a totally different idea, i.e., drawing bézier curves, don't you see a difference? Also notice how I cited other answers in my solution there, you should read before judging others. We here, on tex.se, constantly add any ideas small or large that we think may help the OP and the community and we do it for fun, that's what makes this site special. I joined tex.se years before you do and I never complained about some one adding another answer with minor improvements over mine. I wish you happy TeX-ing anyways. – AboAmmar Aug 23 '18 at 3:28
  • The question is on "How to draw two concentric simple closed curves using tikz". This can be achieved with double... I believe that this is the key point. Happy TeXing! – marmot Aug 23 '18 at 3:33
1

The easiest way to achieve what you want it to set scale ticks above exponent to a lower value (the default is 3).

% used PGFPlots v1.16
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        symbolic x coords={X1, X2, X3, X4},
        xtick=data,
        enlargelimits=0.2,
        only marks,
        scale ticks above exponent=2,   % <-- added (use this value or lower)
    ]
        \addplot coordinates {
            (X1, 6000)
            (X2, 5000)
            (X3, 4000)
            (X4, 3000)
        };
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

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.