我试图区分图表中的每条线。然后我尝试使用marks
,但它看起来很乱。有没有办法让它看起来更整洁?我愿意接受任何可行的建议。
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{axis}[
height=5cm,
width=6.5cm,
legend style={at={(0.1,0.8)},anchor=south west},
legend style={draw=none},
ymax=0.3,
ymin=0,
xmin=0,
xmax=22,
%xtick={0,10,20,...,50},
scaled ticks=false,
log ticks with fixed point={100 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
%ylabel = Running Time (ms),
ylabel absolute, ylabel style={yshift=-1em},
cycle list={
solid, every mark/.append style={solid, fill=gray}, mark=*\\%
dotted, every mark/.append style={solid, fill=gray}, mark=square*\\%
densely dotted, every mark/.append style={solid, fill=gray}, mark=otimes*\\%
loosely dotted, every mark/.append style={solid, fill=gray}, mark=triangle*\\%
dashed, every mark/.append style={solid, fill=gray},mark=diamond*\\%
loosely dashed, every mark/.append style={solid, fill=gray},mark=*\\%
densely dashed, every mark/.append style={solid, fill=gray},mark=square*\\%
dashdotted, every mark/.append style={solid, fill=gray},mark=otimes*\\%
dasdotdotted, every mark/.append style={solid},mark=star\\%
densely dashdotted,every mark/.append style={solid, fill=gray},mark=diamond*\\%
},
% xlabel = Running Times,
every axis legend/.append style={xshift=-10pt}
]
%manman
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0015651992964593937)(3,0.0030988763762588773)(4,0.032934323792241704)(5,0.03399373479411252)(6,0.03622332542632692)(7,0.057469079020024946)(8,0.06627391748189068)(9,0.07106705789484939)(10,0.07894309314065544)(11,0.09197345168051993)(12,0.10654068360886636)(13,0.13413684124904685)(14,0.1527338469029859)(15,0.17159261921625063)(16,0.19431517763871017)(17,0.19639465198039688)(18,0.19639465198039688)(19,0.19639465198039688)(20,0.19639465198039688)};
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032877231106123415)(5,0.03382884935312223)(6,0.035001563986903496)(7,0.054584245107939314)(8,0.06257975616793889)(9,0.06625804615601999)(10,0.07309693434319058)(11,0.08132103658274499)(12,0.09154503609955154)(13,0.10666765421583298)(14,0.12565108256770935)(15,0.14483455575607923)(16,0.1584806996962177)(17,0.18033617672544683)(18,0.18572647577429077)(19,0.19105505300030318)(20,0.19105505300030318)};
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447582631743577)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766471515488973)(10,0.06591879656553327)(11,0.07373762890768036)(12,0.08316001625047448)(13,0.09712501953605977)(14,0.11206048826811583)(15,0.12499132036866743)(16,0.14437461795845064)(17,0.16503930467721312)(18,0.1707730415830927)(19,0.17847438202677843)(20,0.17847438202677843)};
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0031169520529449797)(4,0.03284196149307736)(5,0.0338112145465992)(6,0.03478895435076025)(7,0.04207290096755568)(8,0.06264544582223713)(9,0.06684550564831827)(10,0.07456437068098794)(11,0.08315825276982208)(12,0.09351892203718212)(13,0.11011470780338097)(14,0.13140862646239548)(15,0.15269978968288966)(16,0.17061774506814978)(17,0.19426139147881435)(18,0.19926791305070107)(19,0.19926791305070107)(20,0.19926791305070107)};
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447637740513962)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766493558997127)(10,0.06591879656553327)(11,0.07373829021292498)(12,0.08316056733817832)(13,0.09712358670802979)(14,0.11206037805057506)(15,0.12499043862834129)(16,0.14437627122156213)(17,0.16525665366760944)(18,0.17077645832685656)(19,0.1754691905601742)(20,0.1754691905601742)};
\addplot coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0030988763762588773)(4,0.032006732969130494)(5,0.03623699240138231)(6,0.03623699240138231)(7,0.04371679558812409)(8,0.05024575205065243)(9,0.05024575205065243)(10,0.07627274256290603)(11,0.08896241868425381)(12,0.09930743706082437)(13,0.1180184076519188)(14,0.12863742683484083)(15,0.13810853033065443)(16,0.1553294699880939)(17,0.1708594521350565)(18,0.17639138072378913)(19,0.18634259182719162)(20,0.18855884613697294)};
\legend{1,2,3,4,5,6,7}
\end{axis}
\end{tikzpicture}
\end{document}
它看起来如下所示:
答案1
一个解决方案是使用y post scale
和x post scale
缩放轴,使线条稍微分开一点。另外,您可以稍微减小标记大小。
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{axis}[
height=5cm,
width=6.5cm,
y post scale=2,
x post scale=2,
legend style={legend pos=outer north east,},
legend style={draw=none},
ymax=0.2,
ymin=0,
xmin=0,
xmax=22,
%xtick={0,10,20,...,50},
scaled ticks=false,
log ticks with fixed point={100 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
%ylabel = Running Time (ms),
ylabel absolute, ylabel style={yshift=-1em},
cycle list={
solid, every mark/.append style={solid, fill=gray}, mark=*\\%
dotted, every mark/.append style={solid, fill=gray}, mark=square*\\%
densely dotted, every mark/.append style={solid, fill=gray}, mark=otimes*\\%
loosely dotted, every mark/.append style={solid, fill=gray}, mark=triangle*\\%
dashed, every mark/.append style={solid, fill=gray},mark=diamond*\\%
loosely dashed, every mark/.append style={solid, fill=gray},mark=*\\%
densely dashed, every mark/.append style={solid, fill=gray},mark=square*\\%
dashdotted, every mark/.append style={solid, fill=gray},mark=otimes*\\%
dasdotdotted, every mark/.append style={solid},mark=star\\%
densely dashdotted,every mark/.append style={solid, fill=gray},mark=diamond*\\%
},
% xlabel = Running Times,
every axis legend/.append style={xshift=-10pt}
]
%manman
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0015651992964593937)(3,0.0030988763762588773)(4,0.032934323792241704)(5,0.03399373479411252)(6,0.03622332542632692)(7,0.057469079020024946)(8,0.06627391748189068)(9,0.07106705789484939)(10,0.07894309314065544)(11,0.09197345168051993)(12,0.10654068360886636)(13,0.13413684124904685)(14,0.1527338469029859)(15,0.17159261921625063)(16,0.19431517763871017)(17,0.19639465198039688)(18,0.19639465198039688)(19,0.19639465198039688)(20,0.19639465198039688)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032877231106123415)(5,0.03382884935312223)(6,0.035001563986903496)(7,0.054584245107939314)(8,0.06257975616793889)(9,0.06625804615601999)(10,0.07309693434319058)(11,0.08132103658274499)(12,0.09154503609955154)(13,0.10666765421583298)(14,0.12565108256770935)(15,0.14483455575607923)(16,0.1584806996962177)(17,0.18033617672544683)(18,0.18572647577429077)(19,0.19105505300030318)(20,0.19105505300030318)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447582631743577)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766471515488973)(10,0.06591879656553327)(11,0.07373762890768036)(12,0.08316001625047448)(13,0.09712501953605977)(14,0.11206048826811583)(15,0.12499132036866743)(16,0.14437461795845064)(17,0.16503930467721312)(18,0.1707730415830927)(19,0.17847438202677843)(20,0.17847438202677843)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0031169520529449797)(4,0.03284196149307736)(5,0.0338112145465992)(6,0.03478895435076025)(7,0.04207290096755568)(8,0.06264544582223713)(9,0.06684550564831827)(10,0.07456437068098794)(11,0.08315825276982208)(12,0.09351892203718212)(13,0.11011470780338097)(14,0.13140862646239548)(15,0.15269978968288966)(16,0.17061774506814978)(17,0.19426139147881435)(18,0.19926791305070107)(19,0.19926791305070107)(20,0.19926791305070107)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447637740513962)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766493558997127)(10,0.06591879656553327)(11,0.07373829021292498)(12,0.08316056733817832)(13,0.09712358670802979)(14,0.11206037805057506)(15,0.12499043862834129)(16,0.14437627122156213)(17,0.16525665366760944)(18,0.17077645832685656)(19,0.1754691905601742)(20,0.1754691905601742)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0030988763762588773)(4,0.032006732969130494)(5,0.03623699240138231)(6,0.03623699240138231)(7,0.04371679558812409)(8,0.05024575205065243)(9,0.05024575205065243)(10,0.07627274256290603)(11,0.08896241868425381)(12,0.09930743706082437)(13,0.1180184076519188)(14,0.12863742683484083)(15,0.13810853033065443)(16,0.1553294699880939)(17,0.1708594521350565)(18,0.17639138072378913)(19,0.18634259182719162)(20,0.18855884613697294)};
\legend{1,2,3,4,5,6,7}
\end{axis}
\end{tikzpicture}
\end{document}
使用内置black white
循环列表,您可以获得以下内容:
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\begin{axis}[
height=5cm,
width=6.5cm,
y post scale=2,
x post scale=2,
legend style={legend pos=outer north east,},
legend style={draw=none},
ymax=0.2,
ymin=0,
xmin=0,
xmax=22,
%xtick={0,10,20,...,50},
scaled ticks=false,
log ticks with fixed point={100 sep=},
axis x line=bottom,
axis y line=left,
axis line style=-,
minor tick style={draw=none},
%ylabel = Running Time (ms),
ylabel absolute, ylabel style={yshift=-1em},
cycle list name=black white,
% xlabel = Running Times,
every axis legend/.append style={xshift=-10pt}
]
%manman
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0015651992964593937)(3,0.0030988763762588773)(4,0.032934323792241704)(5,0.03399373479411252)(6,0.03622332542632692)(7,0.057469079020024946)(8,0.06627391748189068)(9,0.07106705789484939)(10,0.07894309314065544)(11,0.09197345168051993)(12,0.10654068360886636)(13,0.13413684124904685)(14,0.1527338469029859)(15,0.17159261921625063)(16,0.19431517763871017)(17,0.19639465198039688)(18,0.19639465198039688)(19,0.19639465198039688)(20,0.19639465198039688)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032877231106123415)(5,0.03382884935312223)(6,0.035001563986903496)(7,0.054584245107939314)(8,0.06257975616793889)(9,0.06625804615601999)(10,0.07309693434319058)(11,0.08132103658274499)(12,0.09154503609955154)(13,0.10666765421583298)(14,0.12565108256770935)(15,0.14483455575607923)(16,0.1584806996962177)(17,0.18033617672544683)(18,0.18572647577429077)(19,0.19105505300030318)(20,0.19105505300030318)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447582631743577)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766471515488973)(10,0.06591879656553327)(11,0.07373762890768036)(12,0.08316001625047448)(13,0.09712501953605977)(14,0.11206048826811583)(15,0.12499132036866743)(16,0.14437461795845064)(17,0.16503930467721312)(18,0.1707730415830927)(19,0.17847438202677843)(20,0.17847438202677843)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0031169520529449797)(4,0.03284196149307736)(5,0.0338112145465992)(6,0.03478895435076025)(7,0.04207290096755568)(8,0.06264544582223713)(9,0.06684550564831827)(10,0.07456437068098794)(11,0.08315825276982208)(12,0.09351892203718212)(13,0.11011470780338097)(14,0.13140862646239548)(15,0.15269978968288966)(16,0.17061774506814978)(17,0.19426139147881435)(18,0.19926791305070107)(19,0.19926791305070107)(20,0.19926791305070107)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.032006732969130494)(4,0.032802393395941314)(5,0.033871172888777494)(6,0.03447637740513962)(7,0.035163583771833797)(8,0.04123249221919268)(9,0.05766493558997127)(10,0.06591879656553327)(11,0.07373829021292498)(12,0.08316056733817832)(13,0.09712358670802979)(14,0.11206037805057506)(15,0.12499043862834129)(16,0.14437627122156213)(17,0.16525665366760944)(18,0.17077645832685656)(19,0.1754691905601742)(20,0.1754691905601742)};
\addplot+[thick,mark size=1.5pt] coordinates { (0,0.0)(1,0.0007370246951217496)(2,0.0017544428139596247)(3,0.0030988763762588773)(4,0.032006732969130494)(5,0.03623699240138231)(6,0.03623699240138231)(7,0.04371679558812409)(8,0.05024575205065243)(9,0.05024575205065243)(10,0.07627274256290603)(11,0.08896241868425381)(12,0.09930743706082437)(13,0.1180184076519188)(14,0.12863742683484083)(15,0.13810853033065443)(16,0.1553294699880939)(17,0.1708594521350565)(18,0.17639138072378913)(19,0.18634259182719162)(20,0.18855884613697294)};
\legend{1,2,3,4,5,6,7}
\end{axis}
\end{tikzpicture}
\end{document}