Different scale in bar plot

I am creating a bar plot for a situation, however the scale of each bar is different and should be represented in the scale of 10. My code is:

\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}

\pgfplotscreateplotcyclelist{gray}{ % define a new cycle list
{fill=black!20},
{fill=black!40},
{fill=black!60}
}

\begin{tikzpicture}
\begin{axis}[
ymin = 0, ymax = 25,
ybar,
enlarge x limits=0.3,
legend  style={at={(0.7 ,1)},
anchor=north,legend  columns =-1},
ylabel ={Gas Cost and Price in ETH},
xlabel ={Sources Quantity},
symbolic x coords ={7,14,21},
xtick=data,
nodes  near  coords ,
nodes  near  coords  align ={vertical},
nodes near coords style={font=\tiny}, % reduce font size of nodes near coords
cycle list name=gray, % use the new cycle list
]

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


My values are:

%7:   0.11449906 ETH - 5 724 953 Gas
%14: 0.153421 ETH     - 7 671 050 Gas
%21: 0.1962195 ETH -  9 810 975 Gas

• How could I represent the value shown above the bars on a scale of ten (i.e., 5.75 * 10⁶)
• Not quite, you also need ylabel ={Gas Cost \& Price in ETH},, i.e. a \& instead of &. Note that your MWE produces an interesting effect. When one fixes the & the code runs through but it no longer does so once one adds \pgfplotsset{compat=1.16}. – user121799 May 20 at 2:00
• Changed it for "and" – Mutante May 20 at 2:03
• You also need something like bar width=17pt if you use a more recent version. That is, you need to add units to the bar width. – user121799 May 20 at 2:07
• With my edit the MVE is complete. – Mutante May 20 at 2:09
• – Mutante May 20 at 2:13

Another option would be to read the values into a table, and do some scaling here and there with visualization depends on and y expr.

\documentclass[border=5mm]{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}

\pgfplotscreateplotcyclelist{gray}{ % define a new cycle list
{fill=black!20},
{fill=black!40},
{fill=black!60}
}

\begin{tikzpicture}
p  ETH  gas
7  0.11449906 5724953
14 0.153421   7671050
21 0.1962195  9810975
}\DataTable
\begin{axis}[
ymin = 0, ymax = 25,
ybar,
enlarge x limits=0.3,
legend  style={at={(0.7 ,1)},
anchor=north,legend  columns =-1},
ylabel ={Gas Cost and Price in ETH},
xlabel ={Sources Quantity},
xtick=data,
xticklabels from table={\DataTable}{p}, % instead of symbolic coords
nodes  near  coords  align ={vertical},
nodes near coords style={font=\tiny}, % reduce font size of nodes near coords
cycle list name=gray, % use the new cycle list
]

visualization depends on=y*1e-2\as\RawY,
nodes near coords={\pgfmathprintnumber{\RawY}}
]
table[x expr=\coordindex, y expr=\thisrow{ETH}*1e2] {\DataTable};
visualization depends on=y*1e6\as\RawY,
nodes near coords={\pgfmathprintnumber{\RawY}},
node near coords style={anchor=south west,rotate=45}]
table[x expr=\coordindex, y expr=\thisrow{gas}*1e-6] {\DataTable};

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


Here is a proposal. Note that I had to add dimensions to the bar width in order to be able to compile it with the most recent version of pgfplots.

\documentclass[border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}

\pgfplotscreateplotcyclelist{gray}{ % define a new cycle list
{fill=black!20},
{fill=black!40},
{fill=black!60}
}

\begin{tikzpicture}
\begin{axis}[
ymin = 0, ymax = 25,
ybar,
enlarge x limits=0.3,
legend  style={at={(0.7 ,1)},
anchor=north,legend  columns =-1},
ylabel ={Gas Cost and Price in ETH},
xlabel ={Sources Quantity},
symbolic x coords ={7,14,21},
xtick=data,
nodes  near  coords  align ={vertical},
nodes near coords style={font=\tiny}, % reduce font size of nodes near coords
cycle list name=gray, % use the new cycle list
]
%7:   0.11449906 ETH - 5 724 953 Gas
%14: 0.153421 ETH     - 7 671 050 Gas
%21: 0.1962195 ETH -  9 810 975 Gas
\edef\myLstA{0.11449906,0.153421,0.1962195}