TeX - LaTeX Asked on June 22, 2021
I am experiencing some issues while trying to have a common y axis scale as well as ticks. I tried some solutions like every plot/.style
to ensure the range of the axes over the groupplot is the same but the position of the ticks seem to vary for each plot thereby leading to some misinterpretation of data. Besides, the tick marks on both x and y axes are interfering with the curves in the plot. Could you please help me fix this issue with the ticks? Here is the code.
begin{tikzpicture}[every mark/.append style={mark size=.7pt}]
begin{groupplot}[scale=0.36, group style={
group name=relcost, group size = 3 by 1, horizontal sep=1cm, %group size=3 by 4
xlabels at=edge bottom, ylabels at=edge left, yticklabels at=edge left, every plot/.style={
ymin=0,
ymax=750000,
enlargelimits=true
}},
xmin=0,xmax=15,
%ymin=0,
ymode = log,
%log ticks with fixed point,
%scaled y ticks=real:1e3,
%ytick={1, 1e+3},
xlabel={Capacity factor},
%ytick={0, 10, 100},
%xticklabels=$pgfmathprintnumber{tick}$,
%yticklabel=$pgfmathprintnumber{tick}$,
y post scale=0.36,
ylabel={System costs},legend columns=-1,
legend style={font=small},
% x tick scale label style={
%at={(0.95,0)},yshift=-1.5em,anchor=north,inner sep=0pt
% },
%y tick scale label style={
% at={(-0.05,0.99)},anchor=east,inner sep=0pt,
% },
%scale ticks above exponent={2},
%scaled y ticks=false
]
nextgroupplot[title=textsc{C-RAN}, legend to name=unnamed]
% Low-load scenarios
addplot+ [black, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 750007.1040631207)
(3.0, 120007.1040631207)
(6.0, 20007.104063120714)
(9.0, 7.104063120713099)
(12.0, 7.104063120713099)
(15.0, 7.104063120713099)
};
addplot+ [cyan, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
(0.0, 750173.6040631207)
(3.0, 120173.6040631207)
(6.0, 20173.604063120714)
(9.0, 173.6040631207131)
(12.0, 173.6040631207131)
(15.0, 173.6040631207131)
};
% High load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 750340.1040631207)
(3.0, 120340.1040631207)
(6.0, 20340.104063120714)
(9.0, 340.10406312071314)
(12.0, 340.10406312071314)
(15.0, 340.10406312071314)
};
% addplot+ [thin, saffron, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
% (0, 3.8633)
% (10, 3.6740000000000004)
% (20, 3.6188)
% (30, 3.5742999999999996)
% (40, 3.5340999999999996)
% (50, 3.4966)
% };
nextgroupplot[title=textsc{D-RAN}, legend to name=unnamed]
% Low-load scenarios
addplot+ [black, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 723699.4500521545)
(3.0, 3699.4500521545033)
(6.0, 3699.4500521545033)
(9.0, 3699.4500521545033)
(12.0, 3699.4500521545033)
(15.0, 3699.4500521545033)
};
addplot+ [cyan, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
(0.0, 723745.9702908196)
(3.0, 3745.3708261968736)
(6.0, 3745.3708261968736)
(9.0, 3745.3708261968736)
(12.0, 3745.3708261968736)
(15.0, 3745.3708261968736)
};
% High load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 723792.4905294848)
(3.0, 3791.291600239243)
(6.0, 3791.291600239243)
(9.0, 3791.291600239243)
(12.0, 3791.291600239243)
(15.0, 3791.291600239243)
};
% addplot+ [thin, saffron, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
% (0, 1.5581)
% (10, 1.4588999999999999)
% (20, 1.4384)
% (30, 1.4215)
% (40, 1.4069)
% (50, 1.3936)
% };
nextgroupplot[title=textsc{f-RAN}, legend to name=unnamed]
% High load
addplot+ [black, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 720009.7601891027)
(3.0, 27.482156029028516)
(6.0, 8.98111126865991)
(9.0, 7.092207390984598)
(12.0, 7.092207390984598)
(15.0, 7.092207390984598)
}; addlegendentry{Cost factor (0)}
addplot+ [cyan, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
(0.0, 720135.5307859082)
(3.0, 143.61324740819705)
(6.0, 135.5307859083099)
(9.0, 135.5307859083099)
(12.0, 135.5307859083099)
(15.0, 135.5307859083099)
}; addlegendentry{Cost factor (0.6)}
% Low-load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=grenadier!30}] coordinates {
(0.0, 720227.3887317348)
(3.0, 232.75047401100414)
(6.0, 227.38873173479826)
(9.0, 227.38873173479826)
(12.0, 227.38873173479826)
(15.0, 227.38873173479826)
}; addlegendentry{Cost factor (1.2)}
% addplot+ [thin, dashed, saffron, mark=square, mark options={scale=.3, fill=saffron!30}] coordinates {
% (0, 0.5511)
% (10, 0.41609999999999997)
% (20, 0.3845)
% (30, 0.3554)
% (40, 0.333)
% (50, 0.3139)
% };
end{groupplot}
node at (relcost c2r1.south) [inner sep=0pt, anchor=north, yshift=-7ex] {ref{unnamed}};
end{tikzpicture}
Axis limits are not plot options, so they don't belong in every plot
. And neither every plot
nor axis limits should be inside the group style
I think.
But you already have xmin
and xmax
in the right place, so just add ymin
and ymax
right after those. Of course, ymin=0
doesn't work for a logarithmic axis, but ymin=1
seems fine. You can use ytickten={0,2,4,6}
to get ticks at 1e0, 1e2, 1e4 and 1e6.
In this example I used red and blue instead of your custom colours.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{groupplots}
begin{document}
begin{tikzpicture}[every mark/.append style={mark size=.7pt}]
begin{groupplot}[
scale=0.36,
group style={
group name=relcost,
group size = 3 by 1,
horizontal sep=1cm, %group size=3 by 4
xlabels at=edge bottom,
ylabels at=edge left,
yticklabels at=edge left
},
ymode = log,
xmin=0,xmax=15,
ymin=1,
ymax=1e7,
ytickten={0,2,4,6},
xlabel={Capacity factor},
y post scale=0.36,
ylabel={System costs},legend columns=-1,
legend style={font=small},
]
nextgroupplot[title=textsc{C-RAN}, legend to name=unnamed]
% Low-load scenarios
addplot+ [black, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 750007.1040631207)
(3.0, 120007.1040631207)
(6.0, 20007.104063120714)
(9.0, 7.104063120713099)
(12.0, 7.104063120713099)
(15.0, 7.104063120713099)
};
addplot+ [cyan, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
(0.0, 750173.6040631207)
(3.0, 120173.6040631207)
(6.0, 20173.604063120714)
(9.0, 173.6040631207131)
(12.0, 173.6040631207131)
(15.0, 173.6040631207131)
};
% High load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 750340.1040631207)
(3.0, 120340.1040631207)
(6.0, 20340.104063120714)
(9.0, 340.10406312071314)
(12.0, 340.10406312071314)
(15.0, 340.10406312071314)
};
% addplot+ [thin, red, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
% (0, 3.8633)
% (10, 3.6740000000000004)
% (20, 3.6188)
% (30, 3.5742999999999996)
% (40, 3.5340999999999996)
% (50, 3.4966)
% };
nextgroupplot[title=textsc{D-RAN}, legend to name=unnamed]
% Low-load scenarios
addplot+ [black, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 723699.4500521545)
(3.0, 3699.4500521545033)
(6.0, 3699.4500521545033)
(9.0, 3699.4500521545033)
(12.0, 3699.4500521545033)
(15.0, 3699.4500521545033)
};
addplot+ [cyan, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
(0.0, 723745.9702908196)
(3.0, 3745.3708261968736)
(6.0, 3745.3708261968736)
(9.0, 3745.3708261968736)
(12.0, 3745.3708261968736)
(15.0, 3745.3708261968736)
};
% High load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 723792.4905294848)
(3.0, 3791.291600239243)
(6.0, 3791.291600239243)
(9.0, 3791.291600239243)
(12.0, 3791.291600239243)
(15.0, 3791.291600239243)
};
% addplot+ [thin, red, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
% (0, 1.5581)
% (10, 1.4588999999999999)
% (20, 1.4384)
% (30, 1.4215)
% (40, 1.4069)
% (50, 1.3936)
% };
nextgroupplot[title=textsc{f-RAN}, legend to name=unnamed]
% High load
addplot+ [black, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 720009.7601891027)
(3.0, 27.482156029028516)
(6.0, 8.98111126865991)
(9.0, 7.092207390984598)
(12.0, 7.092207390984598)
(15.0, 7.092207390984598)
}; addlegendentry{Cost factor (0)}
addplot+ [cyan, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
(0.0, 720135.5307859082)
(3.0, 143.61324740819705)
(6.0, 135.5307859083099)
(9.0, 135.5307859083099)
(12.0, 135.5307859083099)
(15.0, 135.5307859083099)
}; addlegendentry{Cost factor (0.6)}
% Low-load
addplot+ [magenta, mark=square, mark options={scale=.3, fill=blue!30}] coordinates {
(0.0, 720227.3887317348)
(3.0, 232.75047401100414)
(6.0, 227.38873173479826)
(9.0, 227.38873173479826)
(12.0, 227.38873173479826)
(15.0, 227.38873173479826)
}; addlegendentry{Cost factor (1.2)}
% addplot+ [thin, dashed, red, mark=square, mark options={scale=.3, fill=red!30}] coordinates {
% (0, 0.5511)
% (10, 0.41609999999999997)
% (20, 0.3845)
% (30, 0.3554)
% (40, 0.333)
% (50, 0.3139)
% };
end{groupplot}
node at (relcost c2r1.south) [inner sep=0pt, anchor=north, yshift=-7ex] {ref{unnamed}};
end{tikzpicture}
end{document}
Correct answer by Torbjørn T. on June 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP