Graphics, Figures & Tablesvertical chart

Information and discussion about graphics, figures & tables in LaTeX documents.
krislodz
Posts: 42
Joined: Sun Nov 08, 2009 1:13 pm

vertical chart

Post by krislodz »

Is it possible to create vertical or horizontal charts in Latex? Something like this:
BarChartExampleHorizontal.PNG
BarChartExampleHorizontal.PNG (4.68 KiB) Viewed 9590 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

fatra2
Posts: 126
Joined: Fri May 01, 2009 1:43 pm

Re: vertical chart

Post by fatra2 »

Just like that, let's say as easily as you would in Excel, NO!!!

You can always make a figure in LaTeX, but to do what you have in attachment would take you forever to make, and it would be static.

Therefore, you are better of in other software, and include it in your text document.

Cheers
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

vertical chart

Post by localghost »

fatra2 wrote:Therefore, you are better of in other software, and include it in your text document.
I sometimes wonder where you get your insights from.
krislodz wrote:Is it possible to create vertical or horizontal charts in Latex? Something like this […]
This can be done very easy with datatool, pgfplots (based on pgf/tikZ) or pstricks. You may take a look at example galleries [1,2]. I'm sure you will find what you need and get along with it.

[1] TikZ and PGF examples
[2] /PSTricks/Examples/Charts/chart


Best regards
Thorsten
yago
Posts: 29
Joined: Sat Dec 13, 2008 6:40 pm

Re: vertical chart

Post by yago »

See the attached file. This is the file graphs.dat:

,,,,,,,
5, 1, 9, 4, 8, 3, 2, 5
Attachments
graphs.tex
(811 Bytes) Downloaded 648 times
krislodz
Posts: 42
Joined: Sun Nov 08, 2009 1:13 pm

Re: vertical chart

Post by krislodz »

yago, very very nice. i cannot use pdflatex on it, so I guess I have to include eps generated to my document?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

vertical chart

Post by localghost »

krislodz wrote:[…] i cannot use pdflatex on it, so I guess I have to include eps generated to my document?
Include the (auto-)pst-pdf package. It lets you compile pstricks code with the pdflatex compiler engine. Pay special attention to the hints in the manual about shell escape (forum search).
krislodz
Posts: 42
Joined: Sun Nov 08, 2009 1:13 pm

Re: vertical chart

Post by krislodz »

It is compiling, however only the chart is included, without the surrounding text on the axes
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

vertical chart

Post by localghost »

By now you should know that without a minimal working example (MWE) it becomes very difficult to give further help.
krislodz
Posts: 42
Joined: Sun Nov 08, 2009 1:13 pm

vertical chart

Post by krislodz »

Example is the same code snippet that was considered only with auto-pstpdf package and -shell-escape latexpdf switch. graphs.dat stays the same :
,,,,,,,
5, 1, 9, 4, 8, 3, 2, 5

Current graphs.tex:

Code: Select all

\documentclass[spanish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}


\usepackage{ifplatform}
\usepackage{pst-pdf}
\usepackage{xkeyval}
\usepackage[crop=off]{auto-pst-pdf}

\deactivatetilden
\usepackage{pst-bar,pst-all,pstricks-add}
\begin{document}
\psset{xunit=1cm,yunit=1cm}%
\renewcommand*\psbarlabelsep{50pt}
\begin{pspicture}(0,0)(10,9)%
\psgrid[yunit=1cm,gridlabels=0,subgriddiv=0,griddots=30](0,0)(10,8.1)%
\psaxes[labels=all,ticks=x](0,0)(10,9)%
\readpsbardata{\graphs}{graphs.dat}%
\psbarchart[labelFontSize=2pt,shadow=true,barstyle=blue,barcolsep=0.3,orientation=horizontal]{\graphs}%
\rput(-1.4,7.5){Scatter Graphs}
\rput(-1.7,6.5){Frequency Polygon}
\rput(-1.25,5.5){Line Graphs}
\rput(-1.75,4.5){Comp. Pie Graphs}
\rput(-1.2,3.5){Pictograms}
\rput(-1.2,2.5){Histograms}
\rput(-1.2,1.5){Pie Graphs}
\rput(-1.2,0.5){Bar Charts}
\end{pspicture}
\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

vertical chart

Post by localghost »

It works for me without any option for auto-pst-pdf.
Post Reply