删除函数图中的节点连续性 - Tikz

删除函数图中的节点连续性 - Tikz

所以我有这个图表

情节示例

我想要的是删除连接节点的那些线。换句话说,我想让函数不连续。这是我的代码:

\documentclass[a4paper]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fullpage} % Package to use full page
\usepackage{parskip} % Package to tweak paragraph skipping
\usepackage{tikz} % Package for drawing
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{eucal}
\usepackage{algorithm}
\usepackage{float}
\usepackage{forest}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\usepackage[shortlabels]{enumitem}
\begin{document}

\pgfplotstableread[col sep=comma]{tiempos-ej3.csv}{\table}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[
  xlabel= $n$,
  ylabel=  $\frac{\text{Tiempo}}{n^2 log(n)}$ (ns), 
  ymax = 2*(10^4)]
\addplot+[thin,mark size=1pt] table[x = cant_ejes, y expr = {\thisrow{ns_rutas_vacias}/(\thisrow{cant_ejes}^2)*log2(\thisrow{cant_ejes})} , col sep=comma]{\table};
\addlegendentry{G vac\'{i}o}

`\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

编辑

我正在使用的数据(tiempos-ej3.csv):

cant_ejes, ns_rutas_completas, ns_rutas_vacias, ns_rutas_esparso_conexo, ns_rutas_esparso_disconexo, ns_rutas_denso_conexo, ns_rutas_denso_disconexo
3, 15109, 13161, 12260, 12340, 10934, 10745
4, 18513, 19096, 20259, 20242, 20091, 23546
5, 25926, 23830, 25166, 24425, 28358, 25901
6, 32842, 32804, 31192, 30337, 33519, 36024
7, 47523, 39249, 49199, 38813, 46590, 49289
8, 63149, 48312, 50708, 49158, 58302, 55832
9, 78487, 59447, 62883, 62028, 74124, 85009
10, 84284, 75011, 75005, 81518, 84359, 95588
11, 114197, 90523, 97204, 84448, 100826, 95811
12, 130247, 114882, 110839, 108813, 123487, 133510
13, 151885, 117559, 125032, 110552, 143293, 141648
14, 183447, 150974, 170673, 118187, 189117, 178468
15, 191086, 193268, 167568, 148669, 202532, 208375
16, 230066, 224609, 211090, 207802, 264420, 244803
17, 290928, 235203, 223133, 222825, 281324, 261841
18, 295962, 228604, 241625, 312163, 249293, 308734
19, 385266, 273003, 225277, 253495, 318229, 285187
20, 420176, 394646, 301843, 225683, 342848, 382659
21, 384356, 372527, 294318, 301941, 401165, 377724
22, 467103, 403543, 396645, 323385, 427804, 483534
23, 460606, 457728, 382173, 342659, 519994, 529115
24, 542626, 555261, 483915, 371078, 496230, 531801
25, 632575, 487439, 601581, 448299, 589256, 609845
26, 720005, 578490, 562307, 534066, 825475, 636652
27, 747257, 633856, 674922, 536209, 787483, 647211
28, 746051, 664636, 640455, 610362, 894280, 781946
29, 769671, 775363, 675715, 634716, 845139, 861882
30, 1088255, 782655, 890112, 653516, 921207, 916707
31, 1054147, 852580, 911578, 785632, 1087515, 881952
32, 971451, 836084, 862630, 770111, 959529, 1007144

答案1

您没有提供数据,所以我使用了随机点。如注释中所示,添加only marks到轴规范中。

\documentclass{article}
\usepackage{amsmath,pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    only marks,
    xlabel=$n$,
    ylabel=$\frac{\text{Tiempo}}{n^2 log(n)}$ (ns), 
    ymax = 2*(10^4)]
    \addplot+[thin,mark size=1pt,samples=300] {1.9e4*rnd};
    \addlegendentry{G vac\'{i}o}
  \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容