tikzpicture über's Axenlimit hinaus

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: tikzpicture über's Axenlimit hinaus

von elmar.a » Mi 27. Jun 2012, 22:25

Nice, über die Option war ich bislang auch noch nicht gestolpert!

Danke, ich denke mit den Lösungsvorschlägen werde ich das Ganze ohne Probleme zusammenbasteln können!

von feuersaenger » Mi 27. Jun 2012, 21:18

Hi elmar.a,

Du kannst das "einfach frech ueber den Rand hinauszeichnen" auch dadurch erreichen, dass Du pgfplots den Rand wegnimmst.

Dazu brauchst Du

...
\begin{axis}[..., clip = false]
...

und schon wird alles, was ueber die limits hinausgeht, mit geplottet.

Mit liebem Gruss

Christian

von elmar.a » Di 26. Jun 2012, 18:42

Ah super, das sieht doch schon ganz gut aus!
Besten Dank soweit!!

von bloodworks » Di 26. Jun 2012, 16:20

äh nö aber man kann ja noch das Zeichenn etwas verzögern:
\documentclass{minimal} 
\usepackage{
    pgfplots 
    } 
\pgfplotsset{compat=newest} 

\begin{document} 

\begin{tikzpicture} 
    \begin{axis}[    xmin=0, xmax=16, 
          ymin=0, ymax=250, 
          axis on top, enlarge x limits=false, area style,%
    after end axis/.code={ \fill[red, opacity=.5] (axis cs:0,0) rectangle (axis cs:20,50); }%
          %
          ] %

       \addplot coordinates {(0,0)(16,50) };
\end{axis}

\end{tikzpicture} 


           
\end{document} 
  
Das steht sogar in der Doku... Das liegt natürlich über den plots

von elmar.a » Di 26. Jun 2012, 15:36

... in dem Fall kann ich aber keine exakten (achsenbasierten) Start-/Endkoordinaten für das Rechteck angeben, oder?!

von bloodworks » Di 26. Jun 2012, 15:18

Hi du kannst ganz frech außerhalb der Axis arbeiten:
\documentclass{minimal} 
\usepackage{
    pgfplots 
    } 
\pgfplotsset{compat=1.5.1} 

\begin{document} 

\begin{tikzpicture} 
    \begin{axis}[ 
          xmin=0, xmax=16, 
          ymin=0, ymax=250, 
          axis on top, enlarge x limits=false, area style,
          ] 

 \addplot coordinates
{(0,0) (0,100) (17,100) (17,0)}\closedcycle;
       \addplot coordinates
{(0,0)(16,50) };
    \end{axis} 
    \draw[fill=blue, opacity=.5] (0,0) rectangle (10,1);
\end{tikzpicture} 
           
\end{document} 
  

von elmar.a » Di 26. Jun 2012, 15:05

Sorry, das war mein erster Forenbeitrag zum Thema LaTeX überhaupt, dementsprechend bin ich die Gepflogenheiten hier noch nicht wirklich gewöhnt.
Ich hoffe das folgende Beispiel entspricht den allgemeinen Anforderungen eines Minimalbeispiels?!?
\documentclass{minimal}
\usepackage{
	tikz,
	pgfplots
	}
\pgfplotsset{compat=1.5.1}

\begin{document}

\begin{tikzpicture}
	\begin{axis}[
			xmin=0, xmax=16,
			ymin=0, ymax=250,
			axis on top,
			]
	\draw[fill=red]			% roter Balken soll über xmax hinausgehen!
			\pgfextra{\pgfpathrectangle{
					\pgfplotspointaxisxy{0}{15}}
					{\pgfplotspointaxisdirectionxy{20}{19}}
					};
	\end{axis}
\end{tikzpicture}
			
\end{document}
Wie gesagt -- der (jetzt rote) Balken soll über xmax=16 hinausgehen.

Gruß,
elmar.a

von bloodworks » Di 26. Jun 2012, 11:26

Hallo in diesem Fall wie auch in allen anderen wäre es hilfreich ein vollständiges und lauffähiges Minimalbeispiel [2] zu haben.

tikzpicture über's Axenlimit hinaus

von elmar.a » Mo 25. Jun 2012, 18:52

Hi,
seit längerem versuche ich einen Teil eines Plots farbig zu hinterlegen. Da in der endgültigen Grafik mehrere Plots nebeneinander gesetzt werden, soll der hinterlegte Abschnitt sich durch alle Plots durchziehen -- er soll also über xmax hinausgehen.

Mein Code sieht momentan wie folgt aus:
\documentclass{minimal}

\usepackage{tikz}														% graphic compiler
\usepackage{pgfplots}												% plotting of data (based on TikZ)

\pgfplotsset{compat=1.5.1}
\usetikzlibrary{calc}


\begin{document}


\begin{tikzpicture}
	\begin{axis}[
			name=plot1,
			height=.6\textheight, width=.23\textwidth,
			axis on top,
			% x axis
			xlabel={RC11-120},
			xlabel near ticks,
			xmin=0, xmax=16,
			xticklabel pos=right,
			% y axis
			ylabel={Age [ka]},
			y dir=reverse,
			ymin=0, ymax=250,
			ytick={0,50,...,250},
			minor y tick num=4,
			]
	\draw[
			draw=lightgray!30!white,
			fill=lightgray!30!white]
			\pgfextra{\pgfpathrectangle{
					\pgfplotspointaxisxy{0}{15}}
					{\pgfplotspointaxisdirectionxy{20}{19}}
					};
	\addplot+[
			no marks, color=black,
			] table[
			x=C. davisiana,
			y=Age,
			header=has colnames,
			col sep=semicolon,
			row sep=newline,
			] {rc11120_ageLR_depthCd.csv};
	\end{axis}
	\begin{axis}[
			name=plot2,
			at={($(plot1.east)+(.02\textwidth,0)$)},
			anchor=west,
			height=.6\textheight, width=.23\textwidth,
			axis on top,
			% x axis
			xlabel={PS2082-1},
			xlabel near ticks,
			xmin=0, xmax=25,
			xticklabel pos=right,
			% y axis
			y dir=reverse,
			ymin=0, ymax=250,
			ytick={0,50,...,250},
			minor y tick num=4,
			yticklabels=\empty,
			]
	\addplot+[
			no marks,
			color=black,
			] table[
			x=C. davisiana,
			y=Age,
			header=has colnames,
			col sep=semicolon,
			row sep=newline,
			] {ps20821_ageLR_depthCd.csv};
	\end{axis}
\end{tikzpicture}
			

\end{document}
Aussehen soll das Ganze später in etwa wie die Graphik im Anhang (erstellt mit Grapher 8)....

Ist dies möglich? Wenn ja, wie?


Gruß und besten Dank!
Dateianhänge
example.png
example.png (122.65 KiB) 2803 mal betrachtet

Nach oben