Re: ! Package pgf Error: No shape named current axis is known.

#85109
Up
0
Down
::


Ok: sciocchezza n.3 della serata. 🙁 In effetti però una piccola tirata d’orecchi va pure a Tommaso 😉

Leggendo la documentazione, quello che ho proposto prima non va chiaramente bene. Infatti, alla voce [tt]trim axis left[/tt] c’è scritto:

A style with value trim left=(current axis.south west).
The style needs to be provided as argument to \begin{tikzpicture}[trim axis left]. It ex-
pects (at least) one pgfplots environment in the picture. The effect is to trim everything which
is left of the last axis’ anchor south west (i.e. everything left of the left axis boundary).

In parole povere si può usare solo come argomento di [tt]tikzpicture[/tt] perché la chiave cerca l’ambiente [tt]axis[/tt] di pgfplots. E non c’è nemmeno verso di fare i furbi e provare cose come:`
\tikzset{execute at begin picture={trim axis left}}
` oppure:`
\tikzset{every picture/.style={trim axis left}}
` Infatti, l’opzione deve proprio essere locale e, nota che se l’ambiente [tt]tikzpicture[/tt] non ha un’ambiente [tt]axis[/tt] riceverai di nuovo l’errore:`! Package pgf Error: No shape named current axis is known.` perché il valore di trim dato dalla coordinata [tt]current axis.south west[/tt] ha senso solo quando [tt]current axis[/tt] viene definito.

Come work around, puoi sempre dire nella guida a cosa serve l’opzione [tt]trim axis left[/tt]: non è bello, ma i lettori capiranno. Un secondo workaround, altrettanto non elegante, è quello di impostare in valore assoluto [tt]trim left[/tt] con: `\tikzset{trim left=0.5cm}` (codice che questa volta ho provato 😉 ).

Ciao
Claudio

Go to top