PGF Plot settings












4















I have this tikzpicture/pgfplot (see below). I have a few questions about it.




  1. How do you put the x-labels (101, 102 and so on) on top of the x-axis?

  2. How do you point the y-axis downwards (the arrow below)?

  3. How do you place an x-label at the green vertical (at 1591Hz)?

  4. How can you put extra ticks on the y-axis without a label (eg. every unit a tick, only every third unit a label)?

  5. With those extra ticks from former question, how do you place gridlines alongside of them?

  6. Is it posssible to put a dot or a cross on the intersection red-green?

  7. Can I also put an arrow pointing to that intersection point with a text label?

  8. When I start the domain at 10 instead of 1, or when I use xmin=10, I get a white region between the y-axis and the plot/grid. How can you avoid this. I would like this plot starting with 101 at the y-axis.


Thanks very much in advance!



documentclass{article}
usepackage{pgf,tikz}
usepackage{pgfplots}
begin{document}
usetikzlibrary{circuits.ee.IEC,graphs,patterns,calc,positioning,intersections,quotes,decorations.markings,angles,bending,arrows.meta,shapes}
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
pgfplotsset{width=14.5cm,height=6cm}
begin{tikzpicture}[scale=0.8]
begin{axis}[title=$Laagdoorlaatfilter-verzwakking$,
axis lines=middle,
ymin=dBmin,ymax=dBmax,
ylabel={$A_v(dB)$},
ylabel style={at={(ticklabel* cs:1)},anchor=east},
ytick={-21,-18,...,0},
xmode=log,
domain=1:100000,
xlabel={$f(Hz)$},
xlabel style={at={(ticklabel* cs:1)},anchor=south},
xtick style={above=1cm},
xminorticks=true,
xmajorticks=true,
xminorgrids,
xmajorgrids,
grid=both,
samples=100]
addplot[no marks, blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
% addplot+[no marks, green] {20*log10(1/sqrt(1+1/((2*pi*R*C*x)^2)))};
addplot+[no marks, red] {-3};
addplot+[no marks,green!50!black] coordinates{(Fc,dBmax) (Fc,dBmin)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question

























  • your code is not compileable

    – AndréC
    Mar 3 at 9:02











  • I changed the code a little, should compile.

    – Guido VDV
    Mar 3 at 9:11






  • 2





    Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

    – AndréC
    Mar 3 at 16:57
















4















I have this tikzpicture/pgfplot (see below). I have a few questions about it.




  1. How do you put the x-labels (101, 102 and so on) on top of the x-axis?

  2. How do you point the y-axis downwards (the arrow below)?

  3. How do you place an x-label at the green vertical (at 1591Hz)?

  4. How can you put extra ticks on the y-axis without a label (eg. every unit a tick, only every third unit a label)?

  5. With those extra ticks from former question, how do you place gridlines alongside of them?

  6. Is it posssible to put a dot or a cross on the intersection red-green?

  7. Can I also put an arrow pointing to that intersection point with a text label?

  8. When I start the domain at 10 instead of 1, or when I use xmin=10, I get a white region between the y-axis and the plot/grid. How can you avoid this. I would like this plot starting with 101 at the y-axis.


Thanks very much in advance!



documentclass{article}
usepackage{pgf,tikz}
usepackage{pgfplots}
begin{document}
usetikzlibrary{circuits.ee.IEC,graphs,patterns,calc,positioning,intersections,quotes,decorations.markings,angles,bending,arrows.meta,shapes}
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
pgfplotsset{width=14.5cm,height=6cm}
begin{tikzpicture}[scale=0.8]
begin{axis}[title=$Laagdoorlaatfilter-verzwakking$,
axis lines=middle,
ymin=dBmin,ymax=dBmax,
ylabel={$A_v(dB)$},
ylabel style={at={(ticklabel* cs:1)},anchor=east},
ytick={-21,-18,...,0},
xmode=log,
domain=1:100000,
xlabel={$f(Hz)$},
xlabel style={at={(ticklabel* cs:1)},anchor=south},
xtick style={above=1cm},
xminorticks=true,
xmajorticks=true,
xminorgrids,
xmajorgrids,
grid=both,
samples=100]
addplot[no marks, blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
% addplot+[no marks, green] {20*log10(1/sqrt(1+1/((2*pi*R*C*x)^2)))};
addplot+[no marks, red] {-3};
addplot+[no marks,green!50!black] coordinates{(Fc,dBmax) (Fc,dBmin)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question

























  • your code is not compileable

    – AndréC
    Mar 3 at 9:02











  • I changed the code a little, should compile.

    – Guido VDV
    Mar 3 at 9:11






  • 2





    Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

    – AndréC
    Mar 3 at 16:57














4












4








4


1






I have this tikzpicture/pgfplot (see below). I have a few questions about it.




  1. How do you put the x-labels (101, 102 and so on) on top of the x-axis?

  2. How do you point the y-axis downwards (the arrow below)?

  3. How do you place an x-label at the green vertical (at 1591Hz)?

  4. How can you put extra ticks on the y-axis without a label (eg. every unit a tick, only every third unit a label)?

  5. With those extra ticks from former question, how do you place gridlines alongside of them?

  6. Is it posssible to put a dot or a cross on the intersection red-green?

  7. Can I also put an arrow pointing to that intersection point with a text label?

  8. When I start the domain at 10 instead of 1, or when I use xmin=10, I get a white region between the y-axis and the plot/grid. How can you avoid this. I would like this plot starting with 101 at the y-axis.


Thanks very much in advance!



documentclass{article}
usepackage{pgf,tikz}
usepackage{pgfplots}
begin{document}
usetikzlibrary{circuits.ee.IEC,graphs,patterns,calc,positioning,intersections,quotes,decorations.markings,angles,bending,arrows.meta,shapes}
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
pgfplotsset{width=14.5cm,height=6cm}
begin{tikzpicture}[scale=0.8]
begin{axis}[title=$Laagdoorlaatfilter-verzwakking$,
axis lines=middle,
ymin=dBmin,ymax=dBmax,
ylabel={$A_v(dB)$},
ylabel style={at={(ticklabel* cs:1)},anchor=east},
ytick={-21,-18,...,0},
xmode=log,
domain=1:100000,
xlabel={$f(Hz)$},
xlabel style={at={(ticklabel* cs:1)},anchor=south},
xtick style={above=1cm},
xminorticks=true,
xmajorticks=true,
xminorgrids,
xmajorgrids,
grid=both,
samples=100]
addplot[no marks, blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
% addplot+[no marks, green] {20*log10(1/sqrt(1+1/((2*pi*R*C*x)^2)))};
addplot+[no marks, red] {-3};
addplot+[no marks,green!50!black] coordinates{(Fc,dBmax) (Fc,dBmin)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question
















I have this tikzpicture/pgfplot (see below). I have a few questions about it.




  1. How do you put the x-labels (101, 102 and so on) on top of the x-axis?

  2. How do you point the y-axis downwards (the arrow below)?

  3. How do you place an x-label at the green vertical (at 1591Hz)?

  4. How can you put extra ticks on the y-axis without a label (eg. every unit a tick, only every third unit a label)?

  5. With those extra ticks from former question, how do you place gridlines alongside of them?

  6. Is it posssible to put a dot or a cross on the intersection red-green?

  7. Can I also put an arrow pointing to that intersection point with a text label?

  8. When I start the domain at 10 instead of 1, or when I use xmin=10, I get a white region between the y-axis and the plot/grid. How can you avoid this. I would like this plot starting with 101 at the y-axis.


Thanks very much in advance!



documentclass{article}
usepackage{pgf,tikz}
usepackage{pgfplots}
begin{document}
usetikzlibrary{circuits.ee.IEC,graphs,patterns,calc,positioning,intersections,quotes,decorations.markings,angles,bending,arrows.meta,shapes}
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
pgfplotsset{width=14.5cm,height=6cm}
begin{tikzpicture}[scale=0.8]
begin{axis}[title=$Laagdoorlaatfilter-verzwakking$,
axis lines=middle,
ymin=dBmin,ymax=dBmax,
ylabel={$A_v(dB)$},
ylabel style={at={(ticklabel* cs:1)},anchor=east},
ytick={-21,-18,...,0},
xmode=log,
domain=1:100000,
xlabel={$f(Hz)$},
xlabel style={at={(ticklabel* cs:1)},anchor=south},
xtick style={above=1cm},
xminorticks=true,
xmajorticks=true,
xminorgrids,
xmajorgrids,
grid=both,
samples=100]
addplot[no marks, blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
% addplot+[no marks, green] {20*log10(1/sqrt(1+1/((2*pi*R*C*x)^2)))};
addplot+[no marks, red] {-3};
addplot+[no marks,green!50!black] coordinates{(Fc,dBmax) (Fc,dBmin)};
end{axis}
end{tikzpicture}
end{document}


enter image description here







tikz-pgf pgfplots






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 3 at 9:19









JouleV

10.9k22560




10.9k22560










asked Mar 3 at 8:59









Guido VDVGuido VDV

312




312













  • your code is not compileable

    – AndréC
    Mar 3 at 9:02











  • I changed the code a little, should compile.

    – Guido VDV
    Mar 3 at 9:11






  • 2





    Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

    – AndréC
    Mar 3 at 16:57



















  • your code is not compileable

    – AndréC
    Mar 3 at 9:02











  • I changed the code a little, should compile.

    – Guido VDV
    Mar 3 at 9:11






  • 2





    Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

    – AndréC
    Mar 3 at 16:57

















your code is not compileable

– AndréC
Mar 3 at 9:02





your code is not compileable

– AndréC
Mar 3 at 9:02













I changed the code a little, should compile.

– Guido VDV
Mar 3 at 9:11





I changed the code a little, should compile.

– Guido VDV
Mar 3 at 9:11




2




2





Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

– AndréC
Mar 3 at 16:57





Normally, each question should be one and only one problem and not several as you did because it makes it easier for people with the same problem to find it. Problem #2 has several answers on this site, old answers that no longer apply to the latest version of pgfplots. So ask a new question and clearly specify the solutions you have tried that have not solved this problem.

– AndréC
Mar 3 at 16:57










1 Answer
1






active

oldest

votes


















6














edit:
like this (solved almost all your questions ... )?



enter image description here



(red lines indicate text borders)



documentclass{article}
usepackage{siunitx}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usetikzlibrary{arrows.meta}

begin{document}
begin{tikzpicture}[pin edge={Latex-,black}]
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
begin{semilogxaxis}[ % <---
width=linewidth,height=6cm, % <---
title=Laagdoorlaatfilter-verzwakking,
title style = {at={(0.5,1.2)},font=itshape}, % <---
axis x line=top, % <---
axis y line=left, % <---
ymin=dBmin, ymax=dBmax,
ylabel={$A_v$ (si{decibel})}, % <---
ylabel style={at={(-0.07,0.5)}}, % <---
ytick={dBmin,dBmin+3,...,dBmax}, % <===
% ytick={dBmin,numexprdBmin+3relax,...,dBmax}, % alternatively,
xlabel={$f$ (si{hertz})},
xlabel style={at={(0.5,1.1)}},
%
extra x tick style={% changes for x extra ticks % <===
tick label style={font=footnotesize,text=green!50!black}, % <===
grid style={semithick,green}, % <===
},
extra x ticks={1591}, % <===
extra x tick labels={1591}, % <===
%
grid=both,
minor y tick num=2, % <===
domain=10:100000,
samples=100,
no marks]
addplot[blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
addplot[red] {-3};
node[circle,fill, inner sep=1pt,
pin=45:$f_c$] at (1591,-3) {}; % <===
end{semilogxaxis}
end{tikzpicture}
end{document}


note:





  • tikz libraries should always be loaded in document preamble


  • pgfplots load tikz, so it is not necessary to load it (/again)

  • better than scaling diagram is to prescribe its width, for example to be equal to text width






share|improve this answer


























  • +1: $f$ in Hz (Hz upright) would be even nicer :)

    – Dr. Manuel Kuehner
    Mar 3 at 10:01






  • 1





    @Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

    – Zarko
    Mar 3 at 10:03











  • Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

    – marmot
    Mar 3 at 16:55













  • @marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

    – Zarko
    Mar 3 at 17:00











  • @marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

    – Guido VDV
    Mar 3 at 18:09














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477519%2fpgf-plot-settings%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














edit:
like this (solved almost all your questions ... )?



enter image description here



(red lines indicate text borders)



documentclass{article}
usepackage{siunitx}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usetikzlibrary{arrows.meta}

begin{document}
begin{tikzpicture}[pin edge={Latex-,black}]
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
begin{semilogxaxis}[ % <---
width=linewidth,height=6cm, % <---
title=Laagdoorlaatfilter-verzwakking,
title style = {at={(0.5,1.2)},font=itshape}, % <---
axis x line=top, % <---
axis y line=left, % <---
ymin=dBmin, ymax=dBmax,
ylabel={$A_v$ (si{decibel})}, % <---
ylabel style={at={(-0.07,0.5)}}, % <---
ytick={dBmin,dBmin+3,...,dBmax}, % <===
% ytick={dBmin,numexprdBmin+3relax,...,dBmax}, % alternatively,
xlabel={$f$ (si{hertz})},
xlabel style={at={(0.5,1.1)}},
%
extra x tick style={% changes for x extra ticks % <===
tick label style={font=footnotesize,text=green!50!black}, % <===
grid style={semithick,green}, % <===
},
extra x ticks={1591}, % <===
extra x tick labels={1591}, % <===
%
grid=both,
minor y tick num=2, % <===
domain=10:100000,
samples=100,
no marks]
addplot[blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
addplot[red] {-3};
node[circle,fill, inner sep=1pt,
pin=45:$f_c$] at (1591,-3) {}; % <===
end{semilogxaxis}
end{tikzpicture}
end{document}


note:





  • tikz libraries should always be loaded in document preamble


  • pgfplots load tikz, so it is not necessary to load it (/again)

  • better than scaling diagram is to prescribe its width, for example to be equal to text width






share|improve this answer


























  • +1: $f$ in Hz (Hz upright) would be even nicer :)

    – Dr. Manuel Kuehner
    Mar 3 at 10:01






  • 1





    @Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

    – Zarko
    Mar 3 at 10:03











  • Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

    – marmot
    Mar 3 at 16:55













  • @marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

    – Zarko
    Mar 3 at 17:00











  • @marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

    – Guido VDV
    Mar 3 at 18:09


















6














edit:
like this (solved almost all your questions ... )?



enter image description here



(red lines indicate text borders)



documentclass{article}
usepackage{siunitx}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usetikzlibrary{arrows.meta}

begin{document}
begin{tikzpicture}[pin edge={Latex-,black}]
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
begin{semilogxaxis}[ % <---
width=linewidth,height=6cm, % <---
title=Laagdoorlaatfilter-verzwakking,
title style = {at={(0.5,1.2)},font=itshape}, % <---
axis x line=top, % <---
axis y line=left, % <---
ymin=dBmin, ymax=dBmax,
ylabel={$A_v$ (si{decibel})}, % <---
ylabel style={at={(-0.07,0.5)}}, % <---
ytick={dBmin,dBmin+3,...,dBmax}, % <===
% ytick={dBmin,numexprdBmin+3relax,...,dBmax}, % alternatively,
xlabel={$f$ (si{hertz})},
xlabel style={at={(0.5,1.1)}},
%
extra x tick style={% changes for x extra ticks % <===
tick label style={font=footnotesize,text=green!50!black}, % <===
grid style={semithick,green}, % <===
},
extra x ticks={1591}, % <===
extra x tick labels={1591}, % <===
%
grid=both,
minor y tick num=2, % <===
domain=10:100000,
samples=100,
no marks]
addplot[blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
addplot[red] {-3};
node[circle,fill, inner sep=1pt,
pin=45:$f_c$] at (1591,-3) {}; % <===
end{semilogxaxis}
end{tikzpicture}
end{document}


note:





  • tikz libraries should always be loaded in document preamble


  • pgfplots load tikz, so it is not necessary to load it (/again)

  • better than scaling diagram is to prescribe its width, for example to be equal to text width






share|improve this answer


























  • +1: $f$ in Hz (Hz upright) would be even nicer :)

    – Dr. Manuel Kuehner
    Mar 3 at 10:01






  • 1





    @Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

    – Zarko
    Mar 3 at 10:03











  • Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

    – marmot
    Mar 3 at 16:55













  • @marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

    – Zarko
    Mar 3 at 17:00











  • @marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

    – Guido VDV
    Mar 3 at 18:09
















6












6








6







edit:
like this (solved almost all your questions ... )?



enter image description here



(red lines indicate text borders)



documentclass{article}
usepackage{siunitx}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usetikzlibrary{arrows.meta}

begin{document}
begin{tikzpicture}[pin edge={Latex-,black}]
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
begin{semilogxaxis}[ % <---
width=linewidth,height=6cm, % <---
title=Laagdoorlaatfilter-verzwakking,
title style = {at={(0.5,1.2)},font=itshape}, % <---
axis x line=top, % <---
axis y line=left, % <---
ymin=dBmin, ymax=dBmax,
ylabel={$A_v$ (si{decibel})}, % <---
ylabel style={at={(-0.07,0.5)}}, % <---
ytick={dBmin,dBmin+3,...,dBmax}, % <===
% ytick={dBmin,numexprdBmin+3relax,...,dBmax}, % alternatively,
xlabel={$f$ (si{hertz})},
xlabel style={at={(0.5,1.1)}},
%
extra x tick style={% changes for x extra ticks % <===
tick label style={font=footnotesize,text=green!50!black}, % <===
grid style={semithick,green}, % <===
},
extra x ticks={1591}, % <===
extra x tick labels={1591}, % <===
%
grid=both,
minor y tick num=2, % <===
domain=10:100000,
samples=100,
no marks]
addplot[blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
addplot[red] {-3};
node[circle,fill, inner sep=1pt,
pin=45:$f_c$] at (1591,-3) {}; % <===
end{semilogxaxis}
end{tikzpicture}
end{document}


note:





  • tikz libraries should always be loaded in document preamble


  • pgfplots load tikz, so it is not necessary to load it (/again)

  • better than scaling diagram is to prescribe its width, for example to be equal to text width






share|improve this answer















edit:
like this (solved almost all your questions ... )?



enter image description here



(red lines indicate text borders)



documentclass{article}
usepackage{siunitx}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usetikzlibrary{arrows.meta}

begin{document}
begin{tikzpicture}[pin edge={Latex-,black}]
defdBmax{0}
defdBmin{-12}
defpi{3.14159}
defR{1000}
defC{0.0000001}
defFc{1/(2*pi*R*C)}
begin{semilogxaxis}[ % <---
width=linewidth,height=6cm, % <---
title=Laagdoorlaatfilter-verzwakking,
title style = {at={(0.5,1.2)},font=itshape}, % <---
axis x line=top, % <---
axis y line=left, % <---
ymin=dBmin, ymax=dBmax,
ylabel={$A_v$ (si{decibel})}, % <---
ylabel style={at={(-0.07,0.5)}}, % <---
ytick={dBmin,dBmin+3,...,dBmax}, % <===
% ytick={dBmin,numexprdBmin+3relax,...,dBmax}, % alternatively,
xlabel={$f$ (si{hertz})},
xlabel style={at={(0.5,1.1)}},
%
extra x tick style={% changes for x extra ticks % <===
tick label style={font=footnotesize,text=green!50!black}, % <===
grid style={semithick,green}, % <===
},
extra x ticks={1591}, % <===
extra x tick labels={1591}, % <===
%
grid=both,
minor y tick num=2, % <===
domain=10:100000,
samples=100,
no marks]
addplot[blue] {20*log10(1/sqrt(1+(2*pi*R*C*x)^2))};
addplot[red] {-3};
node[circle,fill, inner sep=1pt,
pin=45:$f_c$] at (1591,-3) {}; % <===
end{semilogxaxis}
end{tikzpicture}
end{document}


note:





  • tikz libraries should always be loaded in document preamble


  • pgfplots load tikz, so it is not necessary to load it (/again)

  • better than scaling diagram is to prescribe its width, for example to be equal to text width







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 4 at 13:37

























answered Mar 3 at 9:52









ZarkoZarko

129k868169




129k868169













  • +1: $f$ in Hz (Hz upright) would be even nicer :)

    – Dr. Manuel Kuehner
    Mar 3 at 10:01






  • 1





    @Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

    – Zarko
    Mar 3 at 10:03











  • Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

    – marmot
    Mar 3 at 16:55













  • @marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

    – Zarko
    Mar 3 at 17:00











  • @marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

    – Guido VDV
    Mar 3 at 18:09





















  • +1: $f$ in Hz (Hz upright) would be even nicer :)

    – Dr. Manuel Kuehner
    Mar 3 at 10:01






  • 1





    @Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

    – Zarko
    Mar 3 at 10:03











  • Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

    – marmot
    Mar 3 at 16:55













  • @marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

    – Zarko
    Mar 3 at 17:00











  • @marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

    – Guido VDV
    Mar 3 at 18:09



















+1: $f$ in Hz (Hz upright) would be even nicer :)

– Dr. Manuel Kuehner
Mar 3 at 10:01





+1: $f$ in Hz (Hz upright) would be even nicer :)

– Dr. Manuel Kuehner
Mar 3 at 10:01




1




1





@Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

– Zarko
Mar 3 at 10:03





@Dr.ManuelKuehner, you are right. i will correct asap (with some other small glitches ...).

– Zarko
Mar 3 at 10:03













Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

– marmot
Mar 3 at 16:55







Have you had a look at the libraries you are loading and checked which of those are really needed? And defpi{3.14159}, really?

– marmot
Mar 3 at 16:55















@marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

– Zarko
Mar 3 at 17:00





@marmoth, i my mwe i only use arrows.meta for pin edge, all other i left because op have them in his mwe. it might be better to erase them ... ok. i delete all not used. thank you for point me on this.

– Zarko
Mar 3 at 17:00













@marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

– Guido VDV
Mar 3 at 18:09







@marmoth I'm just learning to use tikz and pgfplots so I'm messing with all kind of settings. Pi is the least of them, so I just define it instead of searching for another solution (don't have much time). This picture is just a part of a larger document, so the other libraries I use in other parts, didn't filter them out.

– Guido VDV
Mar 3 at 18:09




















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477519%2fpgf-plot-settings%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!