我确实想绘制包含日期的数据。当我尝试编译时,我总是收到错误
scrbook: \float@addtolists detected!(scrbook) Implementation of \float@addtolist became(scrbook) deprecated in KOMA-Script v3.01 2008/11/14 and(scrbook) has been replaced by several more flexible(scrbook) features of package `tocbasic`.
现在我绘制的表格有 679 行。到目前为止,我不太担心格式,只是想看看图表。
平均能量损失
\documentclass[a4paper,12pt,twoside,BCOR=10mm]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[icelandic]{babel}
% \usepackage{t1enc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
%\usepackage{graphicx,booktabs}
\usepackage[intoc]{nomencl}
\usepackage{enumerate,color}
\usepackage{url}
\usepackage{appendix}
\usepackage{float}
\usepackage{eso-pic}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{acronym}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,siunitx,varwidth}
\sisetup{detect-all,
%input-ignore={.},
group-separator = {.},
group-minimum-digits=4,
input-decimal-markers={,},
output-decimal-marker = {,},
table-alignment-mode=marker,
table-number-alignment=center,
}
% \usepackage{tablefootnote}
\usepackage{placeins}
\usepackage{tabularx,booktabs}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage{subcaption}
%\usepackage{subfig}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{external}
% Packages used for title page layout
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\pgfkeys{/pgf/number format/.cd,1000 sep={ }} % to remove the thousand separator
\begin{axis}[
width=.8\linewidth,
height=7cm,
date coordinates in=x,
xtick=data,
xticklabel=\month,
extra x tick style={xticklabel=\year},
date ZERO=2015-01-01,
title=Meðalaflflutningur yfir snið IIIb 2015 til 2023 ásamt spá til 2071,
xlabel={Dags},
ylabel={MW},
legend columns=-1, % to set one line legend
legend style={at={(0.5,-0.3)},anchor=center},
ymajorgrids
]
\addplot [blue, thick] table [x=Dags, y=Medal, col sep=space] {Flutningur.txt};
\legend[Flutningur]
\end{axis}
\end{tikzpicture}
\caption{Meðalaflflutningur yfir snið IIIb 2015 til 2023 ásamt spá til 2071 \label{fig:FlutningurIIIb}}
\end{figure}
\end{document}
部分表格Flutningur.txt
Dags Medal Spá Efri Neðri
2015-01-01 130.81
2015-02-01 104.22
2015-03-01 88.78
2015-04-01 95.19
2015-05-01 103.37
2015-06-01 101.86
2015-07-01 80.86
2015-08-01 69.89
2015-09-01 67.94
2015-10-01 59.42
2015-11-01 64.96
2015-12-01 74.37
2016-01-01 84.99
2016-02-01 100.06
2016-03-01 92.79
2016-04-01 51.86
2016-05-01 39.66
2016-06-01 66.47
2016-07-01 86.53
2016-08-01 117.66
2016-09-01 120.44
2016-10-01 99.99
2016-11-01 98.63
2016-12-01 96.58
2017-01-01 93.62
2017-02-01 97.40
2017-03-01 71.38
2017-04-01 81.51
2017-05-01 78.22
2017-06-01 51.15
2017-07-01 67.99
2017-08-01 73.78
2017-09-01 59.39
2017-10-01 53.74
2017-11-01 83.47
2017-12-01 111.59
2018-01-01 120.08
2018-02-01 93.40
2018-03-01 100.27
2018-04-01 137.26
2018-05-01 130.53
2018-06-01 117.22
2018-07-01 110.91
2018-08-01 83.87
2018-09-01 83.17
2018-10-01 113.41
2018-11-01 114.67
2018-12-01 119.75
2019-01-01 125.94
2019-02-01 122.90
2019-03-01 118.17
2019-04-01 102.84
2019-05-01 103.81
2019-06-01 113.13
2019-07-01 91.40
2019-08-01 75.00
2019-09-01 88.36
2019-10-01 98.94
2019-11-01 86.84
2019-12-01 79.53
2020-01-01 94.17
2020-02-01 89.50
2020-03-01 90.08
2020-04-01 89.27
2020-05-01 81.30
2020-06-01 83.41
2020-07-01 78.68
2020-08-01 86.41
2020-09-01 99.62
2020-10-01 97.22
2020-11-01 85.51
2020-12-01 80.43
2021-01-01 85.11
2021-02-01 95.75
2021-03-01 101.71
2021-04-01 110.12
2021-05-01 125.03
2021-06-01 128.04
2021-07-01 121.26
2021-08-01 116.81
2021-09-01 117.26
2021-10-01 130.68
2021-11-01 137.55
2021-12-01 143.18
2022-01-01 147.84
2022-02-01 110.29
2022-03-01 124.45
2022-04-01 100.54
2022-05-01 57.83
2022-06-01 104.35
2022-07-01 101.25
2022-08-01 114.69
2022-09-01 152.20
2022-10-01 147.37
2022-11-01 135.86
2022-12-01 142.90
2023-01-01 156.71
2023-02-01 163.38
2023-03-01 171.70
2023-04-01 175.14
2023-05-01 173.93 173.93 173.93 173.93
2023-06-01 129.15 129.15 129.15
2023-07-01 129.68 129.90 129.40
2023-08-01 130.22 130.65 129.65
2023-09-01 130.76 131.40 129.90
2023-10-01 131.29 132.15 130.15
在我的里面,.txt
列底部没有移动。
我很高兴看到这种格式(或任何有意义的格式)的 x 轴。
我对 pgfplot 不是很有经验,而且我也不是这方面最强的程序员,所以任何关于如何实现这一点的想法都会非常感激。pgfplots 和 excel plot 之间的质量差异很大,我更喜欢 pgfplots。