Graphics, Figures & Tables ⇒ vertical chart
Re: vertical chart
It works, there is graph, but there are no descriptions on axes, it is cut to just graph area.
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
vertical chart
Just omit the option for auto-pst-pdf. I get the complete chart.
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
vertical chart
When I use this code, the result is the same:
Maybe my package is out of date? What can be the problem.
Code: Select all
\documentclass[spanish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage{ifplatform}
\usepackage{pst-pdf}
\usepackage{xkeyval}
\usepackage{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}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
vertical chart
I did a mistake and reduced your example to the absolute minimum of code. Thus I didn't use the original. One more mistake was to overlook that you include the pst-pdf package. I wonder what for. Abandon this package and it will work. And answer yourself the question what you need ifplatform and xkeyval for.
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
Re: vertical chart
It is still not producing the valid pdf, the output goes to file graphs-autopp.pdf and when I try to build the original document with the graph, it is not there.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
vertical chart
I wonder about this file called »graphs-autopp.pdf«. Actually there should be a file with the name »graphs-pics.pdf«. You can try a very minimal example.krislodz wrote:It is still not producing the valid pdf, the output goes to file graphs-autopp.pdf and when I try to build the original document with the graph, it is not there.
Code: Select all
\listfiles
\documentclass{minimal}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\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}
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
Re: vertical chart
The last snippet does not even compile to pdf, I have all packages updated.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: vertical chart
I can't advice any further because it works fine for me.
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
vertical chart
Hi,
a different approach might be to use pgfplots. It is based on TikZ/PGF rather than pstricks.
Here is what I got so far:
The pgfplots package is a generic plotting solution which can do x bars. Axes are added using an axis environment inside of a tikzpicture environment. The xbar option configures pgfplots to draw (groups of) horizontal bar plots. The xmin=0 key tells pgfplots to start the axis (and the bar) at x=0. The ytick=data means to scan the data points of the FIRST plot and generate tick labels for every encountered y coordinate. The yticklabels key assigns the associated labels (from top to bottom).
Inside of the axis environment, it expects zero, one, or more
Alternatively, you got write the labels into the very same table and load the tick labels from the table:
This yields the same output if data.dat contains
note that I change the column separator to semicolon (the default would be "white space"...)
a different approach might be to use pgfplots. It is based on TikZ/PGF rather than pstricks.
Here is what I got so far:
Code: Select all
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
xmin=0,
xtick={0,...,10},
xmajorgrids,
ytick=data,
yticklabels={%
Scatter Graphs,%
Frequency Polygon,%
Line Graphs,%
Comp. Pie Graphs,%
Pictograms,%
Histograms,%
Pie Graphs,%
Bar Charts,%
},
]
\addplot table[
x=Value,
% \coordindex is 0...7,
% but I want it upwards such that it fits
% the yticklabels list (which is read from top to bottom).
y expr=-\coordindex,
]
{
Value
5
1
9
4
8
3
2
5
};
\end{axis}
\end{tikzpicture}
\end{document}
Inside of the axis environment, it expects zero, one, or more
\addplot
statements. In our case, we load data from an inline table and plot the "Value" column against -\coordindex
. The - sign is confusing, I admit it: it is because the list of tick labels starts at the top ... and indices start "at the bottom" (at y=0). You will understand my idea if you omit the yticklabels key.Alternatively, you got write the labels into the very same table and load the tick labels from the table:
Code: Select all
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xbar,
xmin=0,
xtick={0,...,10},
xmajorgrids,
ytick=data,
table/col sep=semicolon,
yticklabels from table={data.dat}{Label},
]
\addplot table[
x=Value,
y expr=-\coordindex,
]
{data.dat};
\end{axis}
\end{tikzpicture}
\end{document}
Code: Select all
Value;Label
5;Scatter Graphs
1;Frequency Polygon
9;Line Graphs
4;Comp. Pie Graphs
8;Pictograms
3;Histograms
2;Pie Graphs
5;Bar Charts