TransWikia.com

Smooth plot with mesh option and table data in pgfplots

TeX - LaTeX Asked by Old Nick on April 23, 2021

Is it possible to have the same smoothness of the black plot while using the mesh option?

documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.17}
begin{filecontents}{data-fake.dat}
xpos    y  date
1       0  09-01
2       1  09-02
3       2  09-03
4       3  09-04
5       5  09-05
6       7  09-06
7       8  09-07
8       9  09-08
9       9  09-09
10      10 09-10
11      13 09-11
12      15 09-12
13      15 09-13
14      17 09-14
15      19 09-15
16      18 09-16
17      17 09-17
18      19 09-18
19      18 09-19
20      19 09-20
21      21 09-21
22      22 09-22
23      24 09-23
24      25 09-24
25      24 09-25
26      24 09-26
27      25 09-27
28      25 09-28
29      24 09-29
30      25  09-30
end{filecontents}
begin{document}
begin{tikzpicture}   
begin{axis}[
width=32cm,
axis x line*=bottom,
axis y line*=left, 
xtick=data,
xticklabels from table={data-fake.dat}{date},
x tick label style={rotate=90} 
]
addplot[smooth,line width=3pt] table[x=xpos,y=y] {data-fake.dat};
addplot[smooth,line width=3pt, mesh, colormap={}{color(0)=(red!10) color(1)=(red!50)}] table[x=xpos,y=y] {data-fake.dat};
end{axis} 
end{tikzpicture} 
end{document}  

smooth vs non smooth plot

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP