::
Ti ringrazio. Quello che vorrei ottenere è questo (attenzione che a livello di codice, ne sono consapevole, è una porcheria):
`
% !TEX TS-program = XeLaTeX
\documentclass{standalone}
\usepackage{mathspec}
\setprimaryfont[Numbers={Proportional},Scale=MatchLowercase]{Junicode}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.7}
%\pgfplotsset{xticklabel={\tick},scaled x ticks=false}
%\pgfplotsset{plot coordinates/math parser=false}
\usepackage{pgfplotstable}
\pgfplotstableset{col sep=comma}
\begin{filecontents*}{chart.csv}
a,b,c,d
1,119,47,x
0,119,45,y
0,120,44,x
0,120,44,y
0,121,42,x
0,121,44,y
0,122,44,x
0,122,44,y
0,123,44,x
0,123,44,y
0,124,44,x
0,124,44,y
0,125,44,x
0,125,43,y
0,126,45,x
0,126,44,y
2,127,43,x
0,127,43,y
0,128,43,x
0,128,43,y
0,129,42,x
0,129,44,y
0,130,43,x
0,130,43,y
0,131,43,x
0,131,43,y
0,132,44,x
0,132,45,y
0,133,43,x
0,133,44,y
0,134,43,x
0,134,43,y
4,135,47,x
0,135,47,y
0,136,47,x
0,136,47,y
5,137,45,x
0,137,45,y
0,138,45,x
0,138,45,y
0,139,45,x
0,139,45,y
0,140,45,x
0,140,45,y
0,141,45,x
0,141,45,y
0,142,45,x
0,142,45,y
0,143,45,x
0,143,45,y
0,144,45,x
0,144,45,y
6,145,46,x
0,145,46,y
0,146,46,x
0,146,46,y
0,147,46,x
0,147,46,y
0,148,46,x
0,148,46,y
0,149,46,x
0,149,46,y
0,150,46,x
0,150,46,y
0,151,46,x
0,151,46,y
0,152,46,x
0,152,46,y
7,153,48,x
0,153,48,y
0,154,48,x
0,154,48,y
0,155,48,x
0,155,48,y
0,156,48,x
0,156,48,y
0,157,48,x
0,157,48,y
0,158,48,x
0,158,48,y
0,159,48,x
0,159,50,y
0,160,48,x
0,160,47,y
8,161,47,x
0,161,47,y
0,162,47,x
0,162,47,y
0,163,47,x
0,163,47,y
0,164,47,x
0,164,47,y
0,165,47,x
0,165,47,y
0,166,47,x
0,166,47,y
0,167,47,x
0,167,47,y
0,168,47,x
0,168,47,y
9,169,46,x
0,169,46,y
0,170,46,x
0,170,46,y
0,171,46,x
0,171,46,y
0,172,46,x
0,172,46,y
0,173,46,x
0,173,46,y
0,174,46,x
0,174,46,y
0,175,46,x
0,175,46,y
0,176,46,x
0,176,46,y
10,177,48,x
0,177,48,y
0,178,48,x
0,178,48,y
0,179,48,x
0,179,48,y
0,180,48,x
0,180,48,y
0,181,48,x
0,181,48,y
0,182,48,x
0,182,48,y
0,183,48,x
0,183,47,y
0,184,48,x
0,184,48,y
11,185,49,x
0,185,49,y
0,186,49,x
0,186,49,y
0,187,49,x
0,187,49,y
0,188,41,r
0,188,51,y
0,189,30,r
0,189,0,y
\end{filecontents*}
\pgfplotstableread{chart.csv}\loadedtable
% riscrive la colonna b cancellando le righe dispari
\pgfplotstablemodifyeachcolumnelement{b}\of\loadedtable\as\cell{%
\edef\cell{\ifodd\pgfplotstablerow \else\cell\fi}}
\begin{document}
\begin{tikzpicture}[quire/.style ={font=\LARGE,yshift=-2cm},]
\begin{axis} [
xlabel style = {yshift=-2cm,font=\bfseries},
% xlabel=Pages and quires,
x post scale=10,
y post scale=2,
ybar,
ybar interval, % <-- non accetta valori
% bar width=2mm,
xmin=0,
ymin=20,
ymax=52, % <-- era 50
xtick pos=left,
xticklabels from table={\loadedtable}{b},
x tick label style={rotate=90,anchor=east},
xticklabel style={font=\LARGE,yshift=-2.225mm},
grid=none,
xtick align=center,
axis x line*=bottom,
axis y line=left
]
\addplot+ [fill=gray!50,draw=gray]
table [x expr=\coordindex, y expr=\thisrow{c}, col sep=semicolon]{\loadedtable};
%\addplot+ [fill=gray,draw=black]
% table [x expr=\coordindex, y expr=\thisrow{a}, col sep=semicolon]{\loadedtable};
\end{axis}
\foreach \x in {71.20mm,142.40mm,160.2mm,231.4mm,302.6mm,373.8mm,445mm,516.2mm,587.4mm} \draw[draw=gray] (\x,-2) -- (\x,0);
\foreach \x in {71.20mm,142.40mm,160.2mm,231.4mm,302.6mm,373.8mm,445mm,516.2mm,587.4mm} \draw[draw=gray,line width=3pt] (\x,-2mm) -- (\x,3mm);
\foreach \z in {2.225mm,11.125mm,20.025mm,28.925mm,37.825mm,46.725mm,55.625mm,64.525mm,73.425mm,82.325mm,91.225mm,100.125mm,109.025mm,117.925mm,126.825mm,135.725mm,144.625mm,153.525mm,162.425mm,171.325mm,180.225mm,189.125mm,198.025mm,206.925mm,215.825mm,224.725mm,233.625mm,242.525mm,251.425mm,260.325mm,269.225mm,278.125mm,287.025mm,295.925mm,304.825mm,313.725mm,322.625mm,331.525mm,340.425mm,349.325mm,358.225mm,367.125mm,376.025mm,384.925mm,393.825mm,402.725mm,411.625mm,420.525mm,429.425mm,438.325mm,447.225mm,456.125mm,465.025mm,473.925mm,482.825mm,491.725mm,500.625mm,509.525mm,518.425mm,527.325mm,536.225mm,545.125mm,554.025mm,562.925mm,571.825mm,580.725mm,589.625mm,598.525mm,607.425mm,616.325mm,625.225mm}
\node[] at (\z,2mm) {{\LARGE x}};
\foreach \w in {6.675mm,15.575mm,24.475mm,33.375mm,42.275mm,51.175mm,60.075mm,68.975mm,77.875mm,86.775mm,95.675mm,104.575mm,113.475mm,122.375mm,131.275mm,140.175mm,149.075mm,157.975mm,166.875mm,175.775mm,184.675mm,193.575mm,202.475mm,211.375mm,220.275mm,229.175mm,238.075mm,246.975mm,255.875mm,264.775mm,273.675mm,282.575mm,291.475mm,300.375mm,309.275mm,318.175mm,327.075mm,335.975mm,344.875mm,353.775mm,362.675mm,371.575mm,380.475mm,389.375mm,398.275mm,407.175mm,416.075mm,424.975mm,433.875mm,442.775mm,451.675mm,460.575mm,469.475mm,478.375mm,487.275mm,496.175mm,505.075mm,513.975mm,522.875mm,531.775mm,540.675mm,549.575mm,558.475mm,567.375mm,576.275mm,585.175mm,594.075mm,602.975mm,611.875mm,620.775mm}
\node[] at (\w,2mm) {{\LARGE y}};
\node[quire] at (35.6mm,0) {1};
\node[quire] at (106.80mm,0) {2};
\node[quire] at (151.3mm,0) {4};
\node[quire] at (195.8mm,0) {5};
\node[quire] at (267mm,0) {6};
\node[quire] at (338.2mm,0) {7};
\node[quire] at (409mm,0) {8};
\node[quire] at (480.6mm,0) {9};
\node[quire] at (551.8mm,0) {10};
\node[quire] at (605.2mm,0) {11};
\end{tikzpicture}
\end{document}`
Il grafico dovrà andare (in verticale) in una gabbia alta (circa 150 mm). Non è fondamentale la lettura di ogni singola barra. Piuttosto serve vedere l'andamento complessivo.
Così com'è fa quello che deve fare, ma il risultato è dovuto a pura fortuna. Se elimino ybar interval si sfasa tutto. E poi non riesco a togliere l'ultima parte dell'asse orizzontale, che va oltre le barre. Insomma, sono riuscito a mettere le varie etichette al posto giusto per pura fortuna.
Tra l'altro non riesco a capire come mai se non metto l'ultima riga della tabella, l'ultima barra non viene disegnata.
Come vedi ho modificato la tabella dei dati. In questo modo posso mettere un numero ogni due barre e quindi comporre l'etichetta in corpo maggiore e mettere l'indicatore x, y all'interno della barra.
Ho provato anche a creare un altro codice più razionale (credo) non riesco ad andare oltre a questo
`% !TEX TS-program = XeLaTeX
\documentclass{standalone}
\usepackage{mathspec}
\setprimaryfont[Numbers={Proportional},Scale=MatchLowercase]{Junicode}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.7}
%\pgfplotsset{xticklabel={\tick},scaled x ticks=false}
%\pgfplotsset{plot coordinates/math parser=false}
\usepackage{pgfplotstable}
\pgfplotstableset{col sep=comma}
\pgfplotstableread{chart.csv}\loadedtable
% riscrive la colonna b cancellando le righe dispari
\pgfplotstablemodifyeachcolumnelement{b}\of\loadedtable\as\cell{%
\edef\cell{\ifodd\pgfplotstablerow \else\cell\fi}}
\begin{document}
\begin{tikzpicture}[quire/.style ={font=\Large,yshift=-1.5cm},]
\begin{axis} [
ybar,
width=60cm,
height=10cm,
% xlabel style = {yshift=-2cm,font=\bfseries},
% xlabel=Pages and quires,
% x post scale=10,
% y post scale=2,
% ybar interval, % <-- non accetta valori
bar width=10pt,
xmin=-1,
% ymin=20,
% ymax=52, % <-- era 50
% xtick pos=left,
xticklabels from table={\loadedtable}{b},
xtick=data,
x tick label style={rotate=90,anchor=east,yshift=-6pt},
% xticklabel style={font=\large,yshift=-2.225mm},
% grid=none,
% xtick align=center,
axis x line*=bottom,
axis y line*=left
]
\addplot+ [fill=gray!50,draw=gray]
table [x expr=\coordindex, y expr=\thisrow{c}, col sep=semicolon]{\loadedtable};
%\addplot+ [fill=gray,draw=black]
% table [x expr=\coordindex, y expr=\thisrow{a}, col sep=semicolon]{\loadedtable};
\end{axis}
\end{tikzpicture}
\end{document}
`
Non so in realtà se sia più razionale. Diciamo che sono andato un po' meno per tentativi. Ma ancora non ci siamo.
Ciao
Ivan