1

This question already has an answer here:

Is it possible to get a logarthmic colorbar?

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2,colorbar]
\addplot[
scatter,mark=square*,only marks,
point meta=\thisrow{myvalue}
]
table {
x y  myvalue
0.5  1 0.25
0.2  2 3
0.7  3 0.75
0.35  4 0.125
0.65  5 2
};
\end{axis}
\end{tikzpicture}

\end{document}

Solution?->

\documentclass{article}

\usepackage{tikz,pgfplots}

\begin{document}
\pgfmathdeclarefunction{lg10}{1}{ \pgfmathparse{ln(#1)/ln(10)}}
\begin{tikzpicture}

\begin{axis}[enlargelimits=0.2,colorbar, colorbar style={yticklabel=\pgfmathparse{10^\tick}\pgfmathprintnumber\pgfmathresult}]

\addplot[
scatter,mark=square*,only marks,
point meta=\thisrow{myvalue}
]
table {
x y  myvalue
0.5  100 554
0.2  2000 3546546
0.7  3745 0.755
0.35  74 0.125
0.65  775 2555
};
\end{axis}
\end{tikzpicture}

\end{document}

This is the solution? is this logaritmic? Looks linear

marked as duplicate by Steven B. Segletes tikz-pgf Jul 11 '17 at 12:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • i dont understand the solution... can somebody explain this to me with my example? thank you in advance – josef Jul 11 '17 at 12:54
  • Add this to your preamble: \pgfmathdeclarefunction{lg10}{1}{ \pgfmathparse{ln(#1)/ln(10)}} and then set your axis optional argument to [enlargelimits=0.2,colorbar, colorbar style={yticklabel=\pgfmathparse{10^\tick}\pgfmathprintnumber\pgfmathresult}] – Steven B. Segletes Jul 11 '17 at 12:59
  • \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \pgfmathdeclarefunction{lg10}{1}{ \pgfmathparse{ln(#1)/ln(10)}} \begin{tikzpicture} \begin{axis}[enlargelimits=0.2,colorbar, colorbar style={yticklabel=\pgfmathparse{10^\tick}\pgfmathprintnumber\pgfmathresult}] \addplot[ scatter,mark=square*,only marks, point meta=\thisrow{myvalue} ] table { x y myvalue 0.5 100 554 0.2 2000 3546546 0.7 3745 0.755 0.35 74 0.125 0.65 775 2555 }; \end{axis} \end{tikzpicture} \end{document} – josef Jul 11 '17 at 13:16
  • @steven can you look at my solution? for me it looks linear – josef Jul 11 '17 at 13:19

Browse other questions tagged or ask your own question.