Graphics, Figures & Tables ⇒ Tweaking some parts of a chart
Re: Tweaking some parts of a chart
Thank you dear Stefan
Last edited by dasag on Fri Dec 12, 2014 8:40 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Tweaking some parts of a chart
As Stefan told and showed you in a code example, the snippet has to go after
For further reference
\pgfplotsset{compat=newest}
.For further reference
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Tweaking some parts of a chart
Thank you dear Stefan and dear Johannes_B. You togother help me very much. The end I want to ask: How do that across mark and number 0 was be near near number 2000 as picture which I send you (also send again)
Code: Select all
Code, edit and compile here:
\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}, %%%<------------- herexlabel=\ {Time},ymin=0,ymax=10,ytick={0,1,2,3,4,5,6,7,8,9,10},% your codeyticklabels={0,1,2,3,4,5,6,7,8,9,10},% your codeylabel=\ {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\\
- Attachments
-
- OtKRX.jpg (10.7 KiB) Viewed 4130 times
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Tweaking some parts of a chart
Well such a discontinuity marker is meaningful if 0 would actually not be on the axis. But here, it seems, that 0 is on the axis, if I see 0, 2000 and 4000. I don't see a real discontinuity. We can work it out somehow, I just see the discontinuity would not be at this position, i.e. not right at 0 but above. The thing below 0 is not relevant, not part of the axis anyway, so no need to discontinue.
Should not the scaling be different then, i.e. the third axis starts with 0, short discontinuity then it jumps to 1000 or so (that's why the gap!) and continues to 2000, 4000, ... The discontinuity should cover which range? From 0 to 0 or from 0 to 2000 - because it symbolizes a gap. Much words, I just want to understand and want to be clear.
What do you think? Is the current position undesirable? Is that discontinuity exactly at 0 definitely required?
Stefan
Should not the scaling be different then, i.e. the third axis starts with 0, short discontinuity then it jumps to 1000 or so (that's why the gap!) and continues to 2000, 4000, ... The discontinuity should cover which range? From 0 to 0 or from 0 to 2000 - because it symbolizes a gap. Much words, I just want to understand and want to be clear.
What do you think? Is the current position undesirable? Is that discontinuity exactly at 0 definitely required?
Stefan
LaTeX.org admin
Re: Tweaking some parts of a chart
But discontinuity marker may be in center?0,2000,4000 number and center for example 1ooo discontinuity marker?
Best regards
Best regards
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Tweaking some parts of a chart
Where is the discontinuity? Where's this break? The interval between 0, 2000 and 4000 is continuous. That's because 2000 is in the middle. And below zero, there's nothing in this chart. That's why the marker doesn't make sense in my eyes.
Feel free to post a hand-drawing showing where a discontinuity, gap, jump, anything - until now it's a normal axis, continuous, where there should be a sign without reason, I think.
Stefan
Feel free to post a hand-drawing showing where a discontinuity, gap, jump, anything - until now it's a normal axis, continuous, where there should be a sign without reason, I think.
Stefan
LaTeX.org admin
Tweaking some parts of a chart
Dear Stefan I send you hand drawing image.
Also I want to ask how do 8 graph in one page:4 graph above, 4 graph below , but in one page.
I need my X axis show -168 hours, but when I write 0,4,8,12 hours very similar, how do all number far between.
Also I want to ask how do 8 graph in one page:4 graph above, 4 graph below , but in one page.
I need my X axis show -168 hours, but when I write 0,4,8,12 hours very similar, how do all number far between.
Code: Select all
Code, edit and compile here:
\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=55}}{}{}\makeatother\begin{document}\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}, %%%<------------- herexlabel=\ {Time},ymin=0,ymax=10,ytick={0,1,2,3,4,5,6,7,8,9,10},% your codeyticklabels={0,1,2,3,4,5,6,7,8,9,10},% your codeylabel=\ {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\\
- Attachments
-
- DasagPlot.jpg (56.9 KiB) Viewed 4103 times
Last edited by Johannes_B on Sat Dec 13, 2014 12:45 pm, edited 1 time in total.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Tweaking some parts of a chart
Ok, so just this symbol at the value 2000. No problem, no matter what it means, I can draw it (but tomorrow). I am still curious what the real meaning of this gap is.
Those 8 graphs could be arranged using the subfig package, minipages, par boxes, or tabular. I guess the last one would be a nice way. Or do you need captions? Numbering? Referencing)
regarding the x-axis issue you could perhaps hand-draw how the axis should finally look like, so we can understand and try.
Stefan
Those 8 graphs could be arranged using the subfig package, minipages, par boxes, or tabular. I guess the last one would be a nice way. Or do you need captions? Numbering? Referencing)
regarding the x-axis issue you could perhaps hand-draw how the axis should finally look like, so we can understand and try.
Stefan
LaTeX.org admin
Tweaking some parts of a chart
Dear Stefan I send you hand-draw x-axis.
Also You can wriyte code which in page 8 graphs for examle this graph-8x
Thank you
Also You can wriyte code which in page 8 graphs for examle this graph-8x
Thank you
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Tweaking some parts of a chart
As you can draw anything on a chart, you can draw lines and gap on your own.
Here's a way.
Complete Code, my older code commented out:
For the other, new problem with the x axis and the 8 graphs on a page, you can open a new topic for each. Otherwise people hardly find it here at the end of thread which originally dealt with another issue. And we sort by topics, not by "somebody's collected various things".
I may deal with it later, as I am busy right now. (If you keep posting the same at StackExchange, I may leave it to them and stop here).
Stefan
Here's a way.
- Load the
calc
library in the preamble afterpgfplots
:\usetikzlibrary{calc}
- Define a coordinate within the axis, so you can later refer to it:
\coordinate (pos) at (axis cs:198,2000);
- Draw after the axis has ended, before ending the TikZ picture:
Code: Select all
Code, edit and compile here:\newcommand*{\len}{0.2}\draw[double distance=2.2,double=white,draw=red,thick]($(pos)-(\len,\len)$) -- ($(pos)+(\len,\len)$);\renewcommand*{\len}{0.21}\draw[double distance=2.2,double=white,draw=white,thin]($(pos)-(\len,\len)$) -- ($(pos)+(\len,\len)$);
\len
for adjusting the length of the lines. Simply one double line would suffice, I just draw the second line for better cleaning between in white. Complete Code, my older code commented out:
Code: Select all
Code, edit and compile here:
\documentclass[border=5mm]{standalone}\usepackage{pgfplots}\pgfplotsset{compat=newest}\usetikzlibrary{calc}%\usepackage{etoolbox}%\makeatletter%\patchcmd{\pgfplots@drawaxis@lines@preparediscont@for}{ticks,segment length=4pt, amplitude=8pt}%% {ticks,segment length=4pt, amplitude=5pt,transform={rotate=55}}{}{}%\makeatother\begin{document}\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}, %%%<------------- herexlabel=\ {Time},ymin=0,ymax=10,ytick={0,1,2,3,4,5,6,7,8,9,10},% your codeyticklabels={0,1,2,3,4,5,6,7,8,9,10},% your codeylabel=\ {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]{

I may deal with it later, as I am busy right now. (If you keep posting the same at StackExchange, I may leave it to them and stop here).
Stefan
LaTeX.org admin