Bar charts in PDF

  • Follow


Can I use pdftricks to produce a bar-chart in pdflatex?
If so, can anyone provide, or point to, a simple example,
please.
0
Reply gayleard (150) 8/2/2010 11:45:24 AM

Timothy Murphy wrote:
> Can I use pdftricks to produce a bar-chart in pdflatex?
> If so, can anyone provide, or point to, a simple example,
> please.

have you considered using tikz? I think there are examples on the tikz 
examples gallery

also datatool has extra package for plotting csv data via tikz/pgf


-- 

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html
0
Reply daleif1329 (544) 8/2/2010 11:52:35 AM


Am 02.08.2010 13:45, schrieb Timothy Murphy:
> Can I use pdftricks to produce a bar-chart in pdflatex?
> If so, can anyone provide, or point to, a simple example,
> please.

sure, no problem

\usepackage{auto-pst-pf}

and then run
pdflatex -shell-escape <your file>

Herbert
0
Reply Herbert 8/2/2010 11:57:06 AM

Am 02.08.2010 13:45, schrieb Timothy Murphy:
> > Can I use pdftricks to produce a bar-chart in pdflatex?
> > If so, can anyone provide, or point to, a simple example,
> > please.
sure, no problem

\usepackage{auto-pst-pdf}

and then run
pdflatex -shell-escape <your file>

Herbert
0
Reply Herbert 8/2/2010 11:57:51 AM

Herbert Voss wrote:

> Am 02.08.2010 13:45, schrieb Timothy Murphy:
>> > Can I use pdftricks to produce a bar-chart in pdflatex?
>> > If so, can anyone provide, or point to, a simple example,
>> > please.

> \usepackage{auto-pst-pdf}
> 
> and then run
> pdflatex -shell-escape <your file>

Thanks, I'll try that.
I take it that is a recipe to run more or less any pstricks code
in pdflatex?

0
Reply Timothy 8/2/2010 12:20:12 PM

Lars Madsen wrote:

>> Can I use pdftricks to produce a bar-chart in pdflatex?
>> If so, can anyone provide, or point to, a simple example,
>> please.
> 
> have you considered using tikz? I think there are examples on the tikz
> examples gallery
> 
> also datatool has extra package for plotting csv data via tikz/pgf

Thanks for the suggestions.
I'll try them if the pdflatex solution suggested does not work.
But I'm familiar with pstricks, 
so would prefer a solution along those lines.
0
Reply Timothy 8/2/2010 12:21:39 PM

Am 02.08.2010 14:20, schrieb Timothy Murphy:
> Herbert Voss wrote:
> 
>> Am 02.08.2010 13:45, schrieb Timothy Murphy:
>>>> Can I use pdftricks to produce a bar-chart in pdflatex?
>>>> If so, can anyone provide, or point to, a simple example,
>>>> please.
> 
>> \usepackage{auto-pst-pdf}
>>
>> and then run
>> pdflatex -shell-escape <your file>
> 
> Thanks, I'll try that.
> I take it that is a recipe to run more or less any pstricks code
> in pdflatex?

yes, all Examples from http://PSTricks.tug.org can be
run with pdflatex and the -shell-escape option. There
is only one important fact, every PSTricks related
code must be inside the pspicture environment, alternative
you can use

\begin{postscript]
....
\end{postscript}

Inside this environment you can have any code, PSTricks
comamnds with or without the pspicture environment
See also:
http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput#autopstpdf

Herbert
0
Reply Herbert 8/2/2010 12:43:24 PM

On 02/08/10 13:21, Timothy Murphy wrote:
> Lars Madsen wrote:
> 
>>> Can I use pdftricks to produce a bar-chart in pdflatex?
>>> If so, can anyone provide, or point to, a simple example,
>>> please.
>>
>> have you considered using tikz? I think there are examples on the tikz
>> examples gallery
>>
>> also datatool has extra package for plotting csv data via tikz/pgf
> 
> Thanks for the suggestions.
> I'll try them if the pdflatex solution suggested does not work.
> But I'm familiar with pstricks, 
> so would prefer a solution along those lines.

I'm using the bardiag package because (a) all the other solutions only
seemed to do histograms and my y-axis data is discrete categories rather
than continuous or time-series; and (b) I did not want a low-level
programmatic interface.

The only bar chart example for TiKz is the rainfall one, which is a
time-series on the y-axis.

///Peter
0
Reply Peter 8/2/2010 2:10:40 PM

Peter Flynn wrote:
> On 02/08/10 13:21, Timothy Murphy wrote:
>> Lars Madsen wrote:
>>
>>>> Can I use pdftricks to produce a bar-chart in pdflatex?
>>>> If so, can anyone provide, or point to, a simple example,
>>>> please.
>>> have you considered using tikz? I think there are examples on the tikz
>>> examples gallery
>>>
>>> also datatool has extra package for plotting csv data via tikz/pgf
>> Thanks for the suggestions.
>> I'll try them if the pdflatex solution suggested does not work.
>> But I'm familiar with pstricks, 
>> so would prefer a solution along those lines.
> 
> I'm using the bardiag package because (a) all the other solutions only
> seemed to do histograms and my y-axis data is discrete categories rather
> than continuous or time-series; and (b) I did not want a low-level
> programmatic interface.
> 
> The only bar chart example for TiKz is the rainfall one, which is a
> time-series on the y-axis.
> 
> ///Peter

how about the databar package, see examples in the datatool manual

-- 

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html
0
Reply daleif1329 (544) 8/2/2010 2:46:28 PM

On Aug 2, 12:45=A0pm, Timothy Murphy <gayle...@eircom.net> wrote:
> Can I use pdftricks to produce a bar-chart in pdflatex?
> If so, can anyone provide, or point to, a simple example,
> please.

The pgfplots package does a nice job at this. The package is based on
pgf/tikz
but does not use pstricks though. The (impressive) manual has lots of
examples.
The following is a (relatively) small example:

\documentclass[11pt]{article}

\usepackage{pgfplots}

\pgfplotsset{width=3D7cm,compat=3Dnewest,tick align=3Doutside,legend
pos=3Dsouth east}

\begin{document}

\begin{figure}
\begin{tikzpicture}
\begin{axis}[xbar,tick align=3Doutside,
             width=3D11cm,
             height=3D8cm,
             bar width=3D{10pt},
             enlargelimits=3D0.13,
             legend pos=3Dsouth east,
             nodes near coords,
             nodes near coords align=3Dhorizontal,
             point meta=3Dx * 1, % The displayed number.
             xlabel=3D\textbf{Frequency of Winning the Final},
             xtick=3D{0,5,...,35},
             ytick=3D{1,...,13},
=20
yticklabels=3D{Kerry,Laois,London,Waterford,Clare,Offaly,Galway,Wexford,Dub=
lin,Limerick,Tipperary,Cork,Kilkenny}
            ]
\addplot
[draw=3Dblue,fill=3Dblue!15]
coordinates
{(1,1) (1,2) (1,3) (2,4) (3,5) (4,6) (4,7) (6,8) (6,9) (7,10) (25,11)
(30,12) (32,13)};
\end{axis}
\end{tikzpicture}
\caption[Bar graph.]
        {All-Ireland hurling champions
          and the number of times they've won the title
          before 2010.}
\end{figure}

\end{document}

Regards,


Marc van Dongen
0
Reply dongen (455) 8/3/2010 5:17:46 AM

On Aug 3, 1:17=A0am, Marc van Dongen <don...@cs.ucc.ie> wrote:
> On Aug 2, 12:45=A0pm, Timothy Murphy <gayle...@eircom.net> wrote:
>
> > Can I use pdftricks to produce a bar-chart in pdflatex?
> > If so, can anyone provide, or point to, a simple example,
> > please.
>
> The pgfplots package does a nice job at this. The package is based on
> pgf/tikz
> but does not use pstricks though. The (impressive) manual has lots of
> examples.
> The following is a (relatively) small example:
>
> \documentclass[11pt]{article}
>
> \usepackage{pgfplots}
>
> \pgfplotsset{width=3D7cm,compat=3Dnewest,tick align=3Doutside,legend
> pos=3Dsouth east}
>
> \begin{document}
>
> \begin{figure}
> \begin{tikzpicture}
> \begin{axis}[xbar,tick align=3Doutside,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0width=3D11cm,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0height=3D8cm,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0bar width=3D{10pt},
> =A0 =A0 =A0 =A0 =A0 =A0 =A0enlargelimits=3D0.13,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0legend pos=3Dsouth east,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0nodes near coords,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0nodes near coords align=3Dhorizontal,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0point meta=3Dx * 1, % The displayed number.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0xlabel=3D\textbf{Frequency of Winning the Fina=
l},
> =A0 =A0 =A0 =A0 =A0 =A0 =A0xtick=3D{0,5,...,35},
> =A0 =A0 =A0 =A0 =A0 =A0 =A0ytick=3D{1,...,13},
>
> yticklabels=3D{Kerry,Laois,London,Waterford,Clare,Offaly,Galway,Wexford,D=
ubli n,Limerick,Tipperary,Cork,Kilkenny}
> =A0 =A0 =A0 =A0 =A0 =A0 ]
> \addplot
> [draw=3Dblue,fill=3Dblue!15]
> coordinates
> {(1,1) (1,2) (1,3) (2,4) (3,5) (4,6) (4,7) (6,8) (6,9) (7,10) (25,11)
> (30,12) (32,13)};
> \end{axis}
> \end{tikzpicture}
> \caption[Bar graph.]
> =A0 =A0 =A0 =A0 {All-Ireland hurling champions
> =A0 =A0 =A0 =A0 =A0 and the number of times they've won the title
> =A0 =A0 =A0 =A0 =A0 before 2010.}
> \end{figure}
>
> \end{document}
>
> Regards,
>
> Marc van Dongen

I second the vote for pgfplots.
0
Reply pinkse (338) 8/3/2010 5:21:12 AM

On Aug 2, 6:45=A0am, Timothy Murphy <gayle...@eircom.net> wrote:
> Can I use pdftricks to produce a bar-chart in pdflatex?
> If so, can anyone provide, or point to, a simple example,
> please.

This may be a little off the normal method here, but I would use
Sweave (part of the opensource R stats package).  You would write the
R code within the pseudo latex file and preprocess the file with R.  R
would generate the output (the Barchart, statistics, etc) and output a
latex file for further processing.

Take a look at www.r-project.org.

G'day

Shawn Way
0
Reply Shawn 8/3/2010 10:38:55 PM

11 Replies
721 Views

(page loaded in 0.136 seconds)

Similiar Articles:













7/20/2012 3:02:58 AM


Reply: