Graphics, Figures & Tablespgfplots

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
woltan
Posts: 19
Joined: Mon Mar 09, 2009 2:08 pm

pgfplots

Post by woltan »

Hey folks,
I am using the pgfplots package and I realy like its features! However, I ran into two "problems":
1: On the right y axis there appears to be an artifact about half way up where the line is replaced by some sort of hexagon.
Here the manual: http://www.ctan.org/tex-archive/graphic ... fplots.pdf
2: I have set up cycle list, where all my preferences concering the line styles and markers are beeing set. On every new axis environment the plots get the styles I specifed. However, is there a way to tell the the plots inside a new axis environment to start with the 3. element in the cycle list?

simplified example:
cycle list = {*, +, o, #}

Code: Select all

\begin{tikzpicture}
\begin{axis}
\addplot coordinates{...}; %this has '*'-style
\addplot coordinates{...}; %this has '+'-style
\end{axis}
\begin{axis}%[set option so that the first plot has 'o'-style]
\addplot coordinates{...}; %this has '*'-style but I want it to have 'o'-style
\addplot coordinates{...}; %this has '+'-style but I want it to have '#'-style
\end{axis}
\end{tikzpicture}
I hope I could express myself for you to understand me.
Any help or advice, suggestion or opinion is appreciated!!
cherio Woltan

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

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: pgfplots

Post by josephwright »

Please post a complete example: snippets do not help.
Joseph Wright
woltan
Posts: 19
Joined: Mon Mar 09, 2009 2:08 pm

pgfplots

Post by woltan »

Ok here goes the complete plot I have so far:

Code: Select all

\pgfplotstableread{NatFlow.data} \table

\pgfplotsset{
every axis/.style={height = 7cm, width = \textwidth,
xtick = {1,...,7},
/pgfplots/clickable = {false}
},
every axis y label/.append style={
text width = 3cm, 
text centered}
};

\begin{axis}[xlabel = Some Label, ylabel = Some Label, axis y line = left, ymin = -0.7, ymax = -0.2]

\addplot table[x=Dist,y=cp1] from \table;
\addplot table[x=Dist,y=cp2] from \table;

\end{axis}

\begin{axis}[axis x line = none, axis y line = right, ylabel = Some Label, ymin = 0.3, ymax = 1.1, legend style={at={(0.5,1.05)}, anchor = south, legend columns = 4}]


\addplot coordinates{}; % *See remark
\addplot coordinates{}; % *See remark

\addplot table[x=Dist,y=cd1] from \table; 
\addplot table[x=Dist,y=cd2] from \table; 
\legend{$\overline{c}_{p,b1}$,$\overline{c}_{p,b2}$,$\overline{c}_{w,1}$,$\overline{c}_{w,2}$}
\end{axis}
Without the two empty addplot commands (marked with a comment) in the second axis environment the style of the not empty addplot commands would be the same as the ones in the first axis environment. pgfplots gives me two warnings for those empty plots but I need them in order to form a valid legend. I know I could explicitly tell how the plots should look like but I'd rather not want to do that because:
1: If I should decide to change my cycle list in the preamble it would not affect this plot
2: I would not be able to place a single legend since one can only place a legend for one axis environment.

So I hope this clears things up and I am anxiously waiting for your suggestions!!
cherio Woltan
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

pgfplots

Post by josephwright »

Please provide a full example, starting with \documentclass and ending with \end{document}. We don't know what else might be going in your document otherwise.
Joseph Wright
Post Reply