Browse Source

example plots

master
commit
f286ad0d29
7 changed files with 270 additions and 0 deletions
  1. +9
    -0
      data-in-python.py
  2. +100
    -0
      data.csv
  3. BIN
      fig3.pdf
  4. +134
    -0
      fig3.tex
  5. +3
    -0
      p1.gnuplot
  6. +10
    -0
      p2.gnuplot
  7. +14
    -0
      p3.gnuplot

+ 9
- 0
data-in-python.py View File

@ -0,0 +1,9 @@
import matplotlib.pyplot as plt
import numpy as np
noise = np.random.normal(0,1,100)
x = range(0,100)
a = x+noise
np.savetxt('data.csv', a, delimiter=',')
plt.plot(x+noise, 'xk')
plt.show()

+ 100
- 0
data.csv View File

@ -0,0 +1,100 @@
-4.035794257571698740e-01
4.954279772227595524e-01
3.294703672094940305e+00
3.087090796565902462e+00
4.497924691412018561e+00
4.991823115376259778e+00
5.329705108587300622e+00
7.570062253538949903e+00
6.565149959803880719e+00
6.738618304091108513e+00
9.083273499827992481e+00
1.227031863938819711e+01
1.276449001814393824e+01
1.245314585472500823e+01
1.404734137317954890e+01
1.531896777486009853e+01
1.660718004513220691e+01
1.849837420169273727e+01
1.776513955222461405e+01
2.022618692120867223e+01
2.022076152233771751e+01
2.128752057777267126e+01
1.996695399457195919e+01
2.281446531739764083e+01
2.408435471228040470e+01
2.563980192426149074e+01
2.637003232846664247e+01
2.648194044646583478e+01
2.988831767813797669e+01
2.884060959882990005e+01
2.884693923263881743e+01
3.083151876648907930e+01
3.220526048341476155e+01
3.412648167567294166e+01
3.299097386134408794e+01
3.516508200001117501e+01
3.721104934252107199e+01
3.720881812592332949e+01
3.756114675564960947e+01
4.018957770849826261e+01
3.853242816040543772e+01
3.967176922898734404e+01
4.298230076778855135e+01
4.437029700690798961e+01
4.415980373856913133e+01
4.448532793478842251e+01
4.538244858860200992e+01
4.611786315037348771e+01
4.746826153106437829e+01
4.791822147106827146e+01
4.960112279973886729e+01
5.155611288800272973e+01
5.429341411437066256e+01
5.332996436362757464e+01
5.595699353683751553e+01
5.500455155194153889e+01
5.470982631093520610e+01
5.560765966566147966e+01
5.827010156579365230e+01
5.840693141256489440e+01
6.028430462756355723e+01
6.218538167200703271e+01
6.264234069954607520e+01
6.338065274514883640e+01
6.318257402995760685e+01
6.582997386430214704e+01
6.702504210982088750e+01
6.577077081972819883e+01
6.687368262186602408e+01
7.009782875340314945e+01
7.161292266841421394e+01
7.121604951293900854e+01
7.192096251827882725e+01
7.256307605057244814e+01
7.399866417291369203e+01
7.418985839572083307e+01
7.625949567577205812e+01
7.541597054428203251e+01
7.572275591603829525e+01
7.952197775238012412e+01
7.983931800880115759e+01
8.084412100322661843e+01
8.234650235524019024e+01
8.261978439221279302e+01
8.435184100294934240e+01
8.495601416345485291e+01
8.583369616620410625e+01
8.767958614961749220e+01
8.957234203053734234e+01
9.118844641466320411e+01
8.807665279447952855e+01
9.154545140135778070e+01
9.282534429039020551e+01
9.283236703306641857e+01
9.349329250387202705e+01
9.452468374292206477e+01
9.652258842074824940e+01
9.717770441714452545e+01
9.809124957778544740e+01
9.904681072615765913e+01

BIN
fig3.pdf View File


+ 134
- 0
fig3.tex View File

@ -0,0 +1,134 @@
% GNUPLOT: LaTeX picture with Postscript
\begingroup
\makeatletter
\providecommand\color[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package color not loaded in conjunction with
terminal option `colourtext'%
}{See the gnuplot documentation for explanation.%
}{Either use 'blacktext' in gnuplot or load the package
color.sty in LaTeX.}%
\renewcommand\color[2][]{}%
}%
\providecommand\includegraphics[2][]{%
\GenericError{(gnuplot) \space\space\space\@spaces}{%
Package graphicx or graphics not loaded%
}{See the gnuplot documentation for explanation.%
}{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
\renewcommand\includegraphics[2][]{}%
}%
\providecommand\rotatebox[2]{#2}%
\@ifundefined{ifGPcolor}{%
\newif\ifGPcolor
\GPcolortrue
}{}%
\@ifundefined{ifGPblacktext}{%
\newif\ifGPblacktext
\GPblacktexttrue
}{}%
% define a \g@addto@macro without @ in the name:
\let\gplgaddtomacro\g@addto@macro
% define empty templates for all commands taking text:
\gdef\gplbacktext{}%
\gdef\gplfronttext{}%
\makeatother
\ifGPblacktext
% no textcolor at all
\def\colorrgb#1{}%
\def\colorgray#1{}%
\else
% gray or color?
\ifGPcolor
\def\colorrgb#1{\color[rgb]{#1}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
\expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
\expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
\expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
\expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
\expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
\expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
\expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
\expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
\else
% gray
\def\colorrgb#1{\color{black}}%
\def\colorgray#1{\color[gray]{#1}}%
\expandafter\def\csname LTw\endcsname{\color{white}}%
\expandafter\def\csname LTb\endcsname{\color{black}}%
\expandafter\def\csname LTa\endcsname{\color{black}}%
\expandafter\def\csname LT0\endcsname{\color{black}}%
\expandafter\def\csname LT1\endcsname{\color{black}}%
\expandafter\def\csname LT2\endcsname{\color{black}}%
\expandafter\def\csname LT3\endcsname{\color{black}}%
\expandafter\def\csname LT4\endcsname{\color{black}}%
\expandafter\def\csname LT5\endcsname{\color{black}}%
\expandafter\def\csname LT6\endcsname{\color{black}}%
\expandafter\def\csname LT7\endcsname{\color{black}}%
\expandafter\def\csname LT8\endcsname{\color{black}}%
\fi
\fi
\setlength{\unitlength}{0.0500bp}%
\ifx\gptboxheight\undefined%
\newlength{\gptboxheight}%
\newlength{\gptboxwidth}%
\newsavebox{\gptboxtext}%
\fi%
\setlength{\fboxrule}{0.5pt}%
\setlength{\fboxsep}{1pt}%
\definecolor{tbcol}{rgb}{1,1,1}%
\begin{picture}(7200.00,4320.00)%
\gplgaddtomacro\gplbacktext{%
\csname LTb\endcsname%%
\put(555,478){\makebox(0,0)[r]{\strut{}$0$}}%
\csname LTb\endcsname%%
\put(555,926){\makebox(0,0)[r]{\strut{}$0.05$}}%
\csname LTb\endcsname%%
\put(555,1374){\makebox(0,0)[r]{\strut{}$0.1$}}%
\csname LTb\endcsname%%
\put(555,1821){\makebox(0,0)[r]{\strut{}$0.15$}}%
\csname LTb\endcsname%%
\put(555,2269){\makebox(0,0)[r]{\strut{}$0.2$}}%
\csname LTb\endcsname%%
\put(555,2717){\makebox(0,0)[r]{\strut{}$0.25$}}%
\csname LTb\endcsname%%
\put(555,3165){\makebox(0,0)[r]{\strut{}$0.3$}}%
\csname LTb\endcsname%%
\put(555,3612){\makebox(0,0)[r]{\strut{}$0.35$}}%
\csname LTb\endcsname%%
\put(555,4060){\makebox(0,0)[r]{\strut{}$0.4$}}%
\csname LTb\endcsname%%
\put(656,239){\makebox(0,0){\strut{}$-4$}}%
\csname LTb\endcsname%%
\put(1434,239){\makebox(0,0){\strut{}$-3$}}%
\csname LTb\endcsname%%
\put(2211,239){\makebox(0,0){\strut{}$-2$}}%
\csname LTb\endcsname%%
\put(2989,239){\makebox(0,0){\strut{}$-1$}}%
\csname LTb\endcsname%%
\put(3766,239){\makebox(0,0){\strut{}$0$}}%
\csname LTb\endcsname%%
\put(4544,239){\makebox(0,0){\strut{}$1$}}%
\csname LTb\endcsname%%
\put(5321,239){\makebox(0,0){\strut{}$2$}}%
\csname LTb\endcsname%%
\put(6099,239){\makebox(0,0){\strut{}$3$}}%
\csname LTb\endcsname%%
\put(6876,239){\makebox(0,0){\strut{}$4$}}%
\csname LTb\endcsname%%
\put(1045,3523){\makebox(0,0)[l]{\strut{}\huge$\frac{1}{\sqrt{2\pi}\sigma}\,e^{-\frac{x^2}{2\sigma^2}}$}}%
\csname LTb\endcsname%%
\put(4505,3165){\makebox(0,0)[l]{\strut{}\Large$\sigma = 1$}}%
\csname LTb\endcsname%%
\put(5865,1374){\makebox(0,0)[l]{\strut{}\Large$\sigma = 2$}}%
}%
\gplgaddtomacro\gplfronttext{%
}%
\gplbacktext
\put(0,0){\includegraphics[width={360.00bp},height={216.00bp}]{fig3}}%
\gplfronttext
\end{picture}%
\endgroup

+ 3
- 0
p1.gnuplot View File

@ -0,0 +1,3 @@
set title 'A basic Sin plot'
set ylabel 'Amplitude'
plot sin(x) with lines

+ 10
- 0
p2.gnuplot View File

@ -0,0 +1,10 @@
set term cairolatex pdf
set out 'fig3.tex'
set samp 1000
set xrange [-4:4]
set key off
set label 1 '\huge$\frac{1}{\sqrt{2\pi}\sigma}\,e^{-\frac{x^2}{2\sigma^2}}$' at -3.5,.34
set label 2 '\Large$\sigma = 1$' at 0.95,.3
set label 3 '\Large$\sigma = 2$' at 2.7,.1
plot for [s=1:2] exp(-x**2/(2*s**2))/(s*sqrt(2*pi)) lw 3
set out

+ 14
- 0
p3.gnuplot View File

@ -0,0 +1,14 @@
set terminal qt
clear
set datafile separator ","
set style line 1 lc rgb "black" lt 3 lw 2 pt 2 ps 1 dt 3
set title "Figure Title"
set xlabel "time in $s$"
set ylabel "amp"
set label 1 "some text" at 20, 40
set key box left
f(x) = a + b*x
fit f(x) "data.csv" using 0:1 via a, b
plot "data.csv" u 0:1 w lp ls 1 title sprintf("y=a+b*x, a=%.3f; b=%.3f", a, b), f(x) with lp ls 1
#plot "data.csv" using 0:1 with lp ls 1

Loading…
Cancel
Save