Graphics, Figures & Tables ⇒ Statistics and Histograms
Statistics and Histograms
I need to draw several statistical charts. With histograms and boxplots (those two are the must!).
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.
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.

- 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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
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
[EDIT: here a translated variant: sorry, my initial answer was accidentally in german]
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
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
You can use the jqchart library jqPlot which is one of the plugin with nice features for doing creating various charts like bar char, pie chart or custom charts.
Statistics and Histograms
I generally use gnuplot to generate plots and charts, creating a png image.
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"
where file1 is:
file2:
and file3:
and file1,file2,file3 are under the data folder.
Then you would run on a command line:
and the plot would be written to "plot.png" .
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.
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:yset datafile sep ':'# writes the chart to a png with 1024 pixels of width and 768 of heightset terminal png size 1024,768# where should the file be writtenset output 'plot.png'# distance between each tic in the x axisset xtics 5# names of the axesset xlabel 'X'set ylabel 'Y (in units)'# where the legend should be placedset key outside top# what should be plottedfiles = "file1 file2 file3"titles = "A B C"# plots every file, diving y by 1 million. Files are under the data folderplot 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:2000002:30000003:10500534:654328114:9879521
Code: Select all
0:123465781.5:10000003:23654788:654975
Code: Select all
1:10000002:20000003: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
pgfplots is very powerful and when you want to plot some data to show in your document it is your first choice. Gnuplot can do some simple calculations (well, in fact pgfplots can calculate some stuff as well), but higher mathematics can't be done with both of them.
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.
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.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.