Graphics, Figures & Tables ⇒ Tweaking some parts of a chart
Re: Tweaking some parts of a chart
You look my question which send about X axis and 8 graph in one page
Best regards
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: Tweaking some parts of a chart
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Tweaking some parts of a chart
I just don't provide LaTeX support via email, as it costs much time and nobody pays it. Here in a public forum I post answers because public solutions may help further people and it extends the knowhow base of this Internet forum. I maintain this platform, so I feel responsible.
Even here, I'm not often these days: busy with work and family, and writing another LaTeX book, which means just sporadic posts by me. The chance to get something done is if a question is clear, focused, detailed, complete - answerable in one go. Unlike here.

Stefan
Re: Tweaking some parts of a chart
Dear Stefan I send you hand-draw x-axis.
- Attachments
-
- Untitled-1.jpg (164.33 KiB) Viewed 4454 times
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Tweaking some parts of a chart
The drawing showed me not much difference from what is already in the chart.
You go for a Ph.D.? Great. Take it as a challenge on the way to fine-tune a questions details and English wording for best legibility and readers will post a solution for anything. Should be easy for a Ph.D. candidate, and so you may get results.

Stefan
Tweaking some parts of a chart
Wen I do this operaion by latex code my X axis show very bad
You can see here
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}
% f1
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=168,
%xtick={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,48,72,168},
xtick={0,4,8,12,24,48,72,168}, %%%<------------- here
xlabel={$Time$},
ymin=0,
ymax=10,
ytick={0,1,2,3,4,5,6,7,8,9,10},
yticklabels={0,1,2,3,4,5,6,7,8,9,10},
ylabel=\ {log(Cfu/cm$^{2}$)},
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]{
0 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]{
0 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
% f2
\begin{axis}[
color=mycolor2,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5,6},
yticklabels={0,1,2,3,4,5,6},
axis x line*=none,
axis y line*=right,
ylabel=\ {RE},
ylabel style=black,
hide x axis,
tick align =outside,]
\addplot [
color=mycolor2,
solid,
line width=1.5pt,
mark size=2.5pt,
mark=*,
mark options={solid,fill=mycolor2}]
table[row sep=crcr]{
0 4.3\\
4 3.8\\
8 5.1\\
12 5.123\\
24 3.85\\};
\end{axis}
% f3
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=4000,
ytick={0,2000,4000},
yticklabels={0,2000,4000},
axis x line*=none,
axis y line*=right,
ylabel=\ {Enterotoxin production},
ylabel style=black,
hide x axis,
tick align =outside,]
\pgfplotsset{every outer y axis line/.style={xshift=1.5cm}, every tick/.style={xshift=1.5cm}, every y tick label/.style={xshift=1.5cm} }
\addplot [
color=orange,
solid,
line width=1.5pt,
mark size=2.5pt,
mark=0,
mark options={solid,fill=mycolor2}]
table[row sep=crcr]{
0 1.3\\
4 0.8\\
8 2.1\\
12 2.123\\
24 2.85\\};
\end{axis}
\end{tikzpicture}%
\end{document}
Re: Tweaking some parts of a chart
Also You dont answer how do that 8 charts in one page, which code I need to write?
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Tweaking some parts of a chart
Those are the positions, they cannot be changed if chart and font remain the same. So change the scaling of the whole axis if they are too close to each other.dasag wrote:X-axis time 0,4,8,12 near-close to each other
No matter if charts, numbers, images, ... could be minipages, parboxes, tabular... the latter seams the easiest. Look, the chart from here is just in a macro - repeated, just insert any chart you want:dasag wrote:Also You dont answer how do that 8 charts in one page, which code I need to write?
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}{cccc}
\sample & \sample & \sample & \sample \\
\sample & \sample & \sample & \sample
\end{tabular}
\end{document}
Tweaking some parts of a chart
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 5\\
4 5\\
8 9.8\\
12 6.8\\
24 6.162\\};
\end{axis}
\end{tikzpicture}%
\end{document}
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={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}
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}
% f1
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
%xtick={0,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=0,
ymax=10,
ytick={0,1,2,3,4,5,6,7,8,9,10},
yticklabels={0,1,2,3,4,5,6,7,8,9,10},
ylabel={$sik$},
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]{
0 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]{
0 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
% f2
\begin{axis}[
color=mycolor2,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5,6},
yticklabels={0,1,2,3,4,5,6},
axis x line*=none,
axis y line*=right,
ylabel={$dasag$},
ylabel style=black,
hide x axis,
tick align =outside,]
\addplot [
color=mycolor2,
solid,
line width=1.5pt,
mark size=2.5pt,
mark=*,
mark options={solid,fill=mycolor2}]
table[row sep=crcr]{
0 4.3\\
4 3.8\\
8 5.1\\
12 5.123\\
24 3.85\\};
\end{axis}
\end{tikzpicture}%
\end{document}
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}
% f1
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
%xtick={0,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={$Time$},
ymin=0,
ymax=10,
ytick={0,1,2,3,4,5,6,7,8,9,10},
yticklabels={0,1,2,3,4,5,6,7,8,9,10},
ylabel={$sik$},
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]{
0 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]{
0 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
% f2
\begin{axis}[
color=mycolor2,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5,6},
yticklabels={0,1,2,3,4,5,6},
axis x line*=none,
axis y line*=right,
ylabel={$dasag$},
ylabel style=black,
hide x axis,
tick align =outside,]
\addplot [
color=mycolor2,
solid,
line width=1.5pt,
mark size=2.5pt,
mark=*,
mark options={solid,fill=mycolor2}]
table[row sep=crcr]{
0 4.3\\
4 3.8\\
8 5.1\\
12 5.123\\
24 3.85\\};
\end{axis}
% f3
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5,6},
yticklabels={0,1,2,3,4,5,6,7,8},
axis x line*=none,
axis y line*=right,
ylabel={$production$},
ylabel style=black,
hide x axis,
tick align =outside,]
\pgfplotsset{every outer y axis line/.style={xshift=1.5cm}, every tick/.style={xshift=1.5cm}, every y tick label/.style={xshift=1.5cm} }
\addplot [
color=orange,
solid,
line width=1.5pt,
mark size=2.5pt,
mark=0,
mark options={solid,fill=mycolor2}]
table[row sep=crcr]{
0 1.3\\
4 0.8\\
8 2.1\\
12 2.123\\
24 2.85\\};
\end{axis}
\end{tikzpicture}%
\end{document}
Code: Select all
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\pgfplots@drawaxis@lines@preparediscont@for}{ticks,segment length=4pt, amplitude=8pt}%
{ticks,segment length=4pt, amplitude=5pt,transform={rotate=45}}{}{}
\makeatother
\begin{document}
\begin{tikzpicture}
% f1
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
%xtick={0,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=\ {Time},
ymin=0,
ymax=10,
ytick={0,1,2,3,4,5,6,7,8,9,10},% your code
yticklabels={0,1,2,3,4,5,6,7,8,9,10},% your code
ylabel=\ {log(Cfu/cm$^{2}$)},
y axis line style={black},
ytick style={black},
yticklabel style={black},
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=white}]
table[row sep=crcr]{
0 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=white}]
table[row sep=crcr]{
0 2\\
4 3\\
8 4.8\\
12 7.8\\
24 8.162\\};
\end{axis}
% f2
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=6,
ytick={0,1,2,3,4,5,6},
yticklabels={0,1,2,3,4,5,6},
axis x line*=none,
axis y line*=right,
ylabel=\ {RE},
ylabel style=black,
hide x axis,
tick align =outside,]
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark=*,
mark options={solid,fill=white}]
table[row sep=crcr]{
0 4.3\\
4 3.8\\
8 5.1\\
12 5.123\\
24 3.85\\};
\end{axis}
% f3
\begin{axis}[
color=black,
scale only axis,
xmin=0,
xmax=24,
ymin=0,
ymax=4000,
ytick={0,2000,4000},% your code
yticklabels={0E+0,2E+03,4E+03},% your code
axis y discontinuity=parallel,% new
axis x line*=none,
axis y line*=right,
ylabel=\ {Enterotoxin production},
ylabel style=black,
hide x axis,
tick align =outside,]
\pgfplotsset{every outer y axis line/.style={xshift=1.5cm}, every tick/.style={xshift=1.5cm}, every y tick label/.style={xshift=1.5cm} }
\addplot [
color=black,
solid,
line width=0.5pt,
mark size=2.5pt,
mark=triangle*,
mark options={solid,,fill=white}]
table[row sep=crcr]{
0 2300\\
4 3800\\
8 3200\\
12 3123\\
24 2385\\};
\end{axis}
\end{tikzpicture}%
\end{document}
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 1\\
4 2\\
8 2.8\\
12 3.8\\
24 1.162\\};
\end{axis}
\end{tikzpicture}%
\end{document}
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 1\\
4 2\\
8 2.8\\
12 4.8\\
24 8.162\\};
\end{axis}
\end{tikzpicture}%
\end{document}
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}%
\end{document}
Best regards
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Tweaking some parts of a chart
\begin{tikzpicture} ... \end{tikzpicture}
into a cell of such a tabular, just separated by & (column separator) or \\ (end of line).Here it's after midnight, I'm off for tonight.
See you,
Stefan