Graphics, Figures & TablesTweaking some parts of a chart

Information and discussion about graphics, figures & tables in LaTeX documents.
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Re: Tweaking some parts of a chart

Post by dasag »

Good night Dear Stefan

Thank you for all

Best regards

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Tweaking some parts of a chart

Post by dasag »

I am sorry in my case I dont create for example 4 graph in one page:2 above and 2 below-symetric

Only says I have any problem in code

Code: Select all

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\definecolor{mycolor1}{rgb}{1,0,1}
\definecolor{mycolor2}{rgb}{0,0.498039215803146,0}

\begin{tikzpicture}

\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={black},
ytick style={yellow},
yticklabel style={red},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{table}
\begin{tabular}{ll}
1 & 2 \\
3 & 4
\end{tabular}
\end{table}
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Tweaking some parts of a chart

Post by Stefan Kottwitz »

dasag wrote:Only says I have any problem in code
LaTeX complains about the table environment. The standalone class (in your first line) doesn't have it. A normal class, such as book, report, article, scrbook, etc. provides it.

Stefan
LaTeX.org admin
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Tweaking some parts of a chart

Post by dasag »

But you try my code in latex writer?

Code: Select all

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\definecolor{mycolor1}{rgb}{1,0,1}
\definecolor{mycolor2}{rgb}{0,0.498039215803146,0}

\begin{tikzpicture}

\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={black},
ytick style={yellow},
yticklabel style={red},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{table}
\begin{tabular}{ll}
1 & 2 \\
3 & 4
\end{tabular}
\end{table}
\end{document}

I want to separate two graph in above two in below. Bust, says I have some mistake of code
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Re: Tweaking some parts of a chart

Post by Stefan Kottwitz »

Yes. Did you read my answer?

Stefan
LaTeX.org admin
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Tweaking some parts of a chart

Post by dasag »

Of course Dear Stefan, I read your answer. When I changed standalone to book or article my 4 graph situated in 2 pages and below to each other.

Code: Select all

\documentclass[border=5mm]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\definecolor{mycolor1}{rgb}{1,0,1}
\definecolor{mycolor2}{rgb}{0,0.498039215803146,0}

\begin{tikzpicture}

\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={black},
ytick style={yellow},
yticklabel style={red},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%
\end{document}
But I want that my 4 graph -2 below and 2 above in one page , for example wich you sendme:

Code: Select all

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\newcommand*{\sample}{%
  \begin{tikzpicture}
        \begin{polaraxis}
        \addplot+[mark=none,domain=0:720,samples=600] 
                {sin(2*x)*cos(2*x)}; 
        \end{polaraxis}
  \end{tikzpicture}}
\begin{document}
\begin{tabular}{cc}
  \sample & \sample  \\
  \sample & \sample 
\end{tabular}
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Tweaking some parts of a chart

Post by Stefan Kottwitz »

I used tabular in my example for arranging the plots. You did not use it in your last code.

Previously, you used tabular just for printing 1, 2, 3, 4, instead of charts. And you added a table environment around, which caused the error with the standalone class.

Read my tabular example again, and use tabular for containing your plots.

Stefan
LaTeX.org admin
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Tweaking some parts of a chart

Post by dasag »

I have all the time this problem,I read again your example.

Code: Select all

\documentclass{table}
\usepackage{pgfplots}
\usepgfplotslibrary{axis}
\newcommand*{\sample}{%

\begin{document}
\definecolor{mycolor1}{rgb}{1,0,1}
\definecolor{mycolor2}{rgb}{0,0.498039215803146,0}

\begin{tikzpicture}

\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 4\\
4 6\\
8 8.8\\
12 2.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={blue},
ytick style={blue},
yticklabel style={blue},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=blue,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[
color=black,
scale only axis,
xmin=1,
xmax=24,
%xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24},
xtick={0,4,8,12,24},   %%%<------------- here
xlabel={$y$},
ymin=1,
ymax=10,
ytick={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
yticklabels={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0},
y axis line style={black},
ytick style={yellow},
yticklabel style={red},
axis x line*=bottom,
axis y line*=left,    
tick align = outside,]
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark size=2.5pt,
mark=square*,
mark options={solid,,rotate=180,fill=blue}]
table[row sep=crcr]{
1 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%
\begin{document}
\begin{tabular}{cc}
  \sample & \sample  \\
  \sample & \sample 
\end{tabular}
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Tweaking some parts of a chart

Post by Stefan Kottwitz »

You need to learn basic LaTeX first, if you would like to use it for your Ph.D. work. That's part of the challenge of writing a thesis. Otherwise you need somebody who writes all for you. You would run into a problem with any changes. For example, now you used a document class "table" which probably is an error. There's no axis library of pgfplots. You don't understand the meaning of \sample which was just a macro created for containing a picture's code. A macro for containing code is one of the most basic things. You can ask simple things here, no problem, but don't skip learning LaTeX and thinking about code.

I don't write your thesis or parts of it for the purpose of saving your time so you don't need to learn LaTeX at all. I know you don't want advice, which is what you can get here. You want ready-made code, so perhaps ask a TeX consultant.

You can return any time later here to get advice or small code solutions.

Stefan
LaTeX.org admin
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Re: Tweaking some parts of a chart

Post by dasag »

Thank you dear Stefan

Best regards
Post Reply