Graphics, Figures & Tables ⇒ Statistics and Histograms
Statistics and Histograms
Which package can be of more use? For now I just draw everything manually in tikZ, results are pretty but it is very tedious task.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Statistics and Histograms
Plotting can be done easier by special packages.white_owl wrote:[…] Which package can be of more use? […]
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 34
- Joined: Sun Oct 16, 2011 5:56 pm
Re: Statistics and Histograms
Hi,
pgfplots kann compute and draw histograms.
The current "unstable" of pgfplots comes with a "statistics" library which supports boxplots. It can compute the statistics given some sample. It can also take precomputed statistics and visualize them. The unstable will be released eventually, but it can be installed from http://pgfplots.sourceforge.net/ . If you want to see if its features are what you need, you can inspect the online manual from http://pgfplots.sourceforge.net/pgfplots_unstable.pdf (section statistics library).
Kind regards
Christian
-
- Posts: 1
- Joined: Thu Dec 19, 2013 7:45 am
Statistics and Histograms
Statistics and Histograms
As it can be a little complicated to find documentation for gnuplot at first, here is an example to help you get started:
Lets say this is a file called "plotter"
Code: Select all
# Sets the separator of each column,
# which means that every line of the input file should be in the format x:y
set datafile sep ':'
# writes the chart to a png with 1024 pixels of width and 768 of height
set terminal png size 1024,768
# where should the file be written
set output 'plot.png'
# distance between each tic in the x axis
set xtics 5
# names of the axes
set xlabel 'X'
set ylabel 'Y (in units)'
# where the legend should be placed
set key outside top
# what should be plotted
files = "file1 file2 file3"
titles = "A B C"
# plots every file, diving y by 1 million. Files are under the data folder
plot for[i=1:words(files)] 'data/'.word(files,i) u 1:($2/1e6) w lines lw 5 title word(titles,i)
# in case you want to plot only one file:
# plot "data/file1" with lines lw 5 title "A"
Code: Select all
1:200000
2:3000000
3:1050053
4:6543281
14:9879521
Code: Select all
0:12346578
1.5:1000000
3:2365478
8:654975
Code: Select all
1:1000000
2:2000000
3:3000000
Then you would run on a command line:
Code: Select all
gnuplot plotter
You can also use gnuplot in a interactive way, in case you want to just test stuff, by just calling the program with no arguments.
I never used any plotting package for LaTeX, but I doubt any of the available ones is better than gnuplot.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Statistics and Histograms
The statistics data, that Gnuplot can calc, but pgfplots can't can be written to a text file and fed to pgfplots, in order to print it.
Documentation for Gnuplot isn't really hard to find, it might be hard to find the right keyword.