Improve this TikZ picture












6















MWE



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
end{tikzpicture}
end{document}


Output:



enter image description here



I want to delete the- and add 1 in each edge.










share|improve this question

























  • Unfortunatly your MWE does not compile.

    – samcarter
    Dec 24 '18 at 18:42











  • @samcarter replace documentclasse

    – Hafid Boukhoulda
    Dec 24 '18 at 18:46
















6















MWE



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
end{tikzpicture}
end{document}


Output:



enter image description here



I want to delete the- and add 1 in each edge.










share|improve this question

























  • Unfortunatly your MWE does not compile.

    – samcarter
    Dec 24 '18 at 18:42











  • @samcarter replace documentclasse

    – Hafid Boukhoulda
    Dec 24 '18 at 18:46














6












6








6


1






MWE



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
end{tikzpicture}
end{document}


Output:



enter image description here



I want to delete the- and add 1 in each edge.










share|improve this question
















MWE



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-3,-2-1,1,2,3}
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-3,-2,-1,1,2,3}
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
end{tikzpicture}
end{document}


Output:



enter image description here



I want to delete the- and add 1 in each edge.







tikz-pgf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 24 '18 at 19:57









Sigur

24.7k356139




24.7k356139










asked Dec 24 '18 at 18:38









VrouvrouVrouvrou

29128




29128













  • Unfortunatly your MWE does not compile.

    – samcarter
    Dec 24 '18 at 18:42











  • @samcarter replace documentclasse

    – Hafid Boukhoulda
    Dec 24 '18 at 18:46



















  • Unfortunatly your MWE does not compile.

    – samcarter
    Dec 24 '18 at 18:42











  • @samcarter replace documentclasse

    – Hafid Boukhoulda
    Dec 24 '18 at 18:46

















Unfortunatly your MWE does not compile.

– samcarter
Dec 24 '18 at 18:42





Unfortunatly your MWE does not compile.

– samcarter
Dec 24 '18 at 18:42













@samcarter replace documentclasse

– Hafid Boukhoulda
Dec 24 '18 at 18:46





@samcarter replace documentclasse

– Hafid Boukhoulda
Dec 24 '18 at 18:46










2 Answers
2






active

oldest

votes


















4














I don't know if that what is wanted?



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
%foreach x in {-3,-2-1,1,2,3}
%raw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2);
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
node at (0,-2.25){$d_{infty}$}; % <---------------
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <----------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<-------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <---------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer


























  • please how to write under each graph ?

    – Vrouvrou
    Dec 24 '18 at 19:00











  • @Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

    – Hafid Boukhoulda
    Dec 24 '18 at 19:04











  • $d_{infty}$ that's all

    – Vrouvrou
    Dec 24 '18 at 19:06











  • The best way is to use an tikz node.

    – Hafid Boukhoulda
    Dec 24 '18 at 19:10











  • I don't know how to do it ?

    – Vrouvrou
    Dec 24 '18 at 19:11



















5














The little lines are drawn by the for loop in your code. If you don't want them outside of the axis, don't let the loop run from -3 to 3, but only from -2 to 2.



If you also want to remove the lines from the edges of your axis, restrict the loop further to -1 to 1 (or remove them completely, the remaining ticks are not really visible above the edge of the rectangle)



Furthermore there are missing ,, that is why some of the lines are missing. Also the syntax for syntax for drawing the rectangle (and other geometric shapes, see @marmot's comment below) can be simplified.



documentclass[12pt]{book}

usepackage{tikz}
usetikzlibrary{patterns}

begin{document}

begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-2,-1,1,2}{
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
}
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-2,-1,1,2}{
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt);
}
draw[pattern=north west lines] (-1,-1) rectangle (1,1);
end{tikzpicture}

end{document}


enter image description here






share|improve this answer





















  • 1





    @marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

    – samcarter
    Dec 24 '18 at 20:17











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%2f467218%2fimprove-this-tikz-picture%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














I don't know if that what is wanted?



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
%foreach x in {-3,-2-1,1,2,3}
%raw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2);
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
node at (0,-2.25){$d_{infty}$}; % <---------------
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <----------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<-------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <---------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer


























  • please how to write under each graph ?

    – Vrouvrou
    Dec 24 '18 at 19:00











  • @Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

    – Hafid Boukhoulda
    Dec 24 '18 at 19:04











  • $d_{infty}$ that's all

    – Vrouvrou
    Dec 24 '18 at 19:06











  • The best way is to use an tikz node.

    – Hafid Boukhoulda
    Dec 24 '18 at 19:10











  • I don't know how to do it ?

    – Vrouvrou
    Dec 24 '18 at 19:11
















4














I don't know if that what is wanted?



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
%foreach x in {-3,-2-1,1,2,3}
%raw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2);
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
node at (0,-2.25){$d_{infty}$}; % <---------------
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <----------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<-------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <---------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer


























  • please how to write under each graph ?

    – Vrouvrou
    Dec 24 '18 at 19:00











  • @Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

    – Hafid Boukhoulda
    Dec 24 '18 at 19:04











  • $d_{infty}$ that's all

    – Vrouvrou
    Dec 24 '18 at 19:06











  • The best way is to use an tikz node.

    – Hafid Boukhoulda
    Dec 24 '18 at 19:10











  • I don't know how to do it ?

    – Vrouvrou
    Dec 24 '18 at 19:11














4












4








4







I don't know if that what is wanted?



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
%foreach x in {-3,-2-1,1,2,3}
%raw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2);
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
node at (0,-2.25){$d_{infty}$}; % <---------------
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <----------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<-------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <---------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer















I don't know if that what is wanted?



documentclass[12pt]{book}
usepackage{tikz}
usetikzlibrary{patterns,shapes.geometric}
begin{document}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
%foreach x in {-3,-2-1,1,2,3}
%raw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2);
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (-1,1)--(1,1)--(1,-1)--(-1,-1)--(-1,1);
node at (0,-2.25){$d_{infty}$}; % <---------------
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <----------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<-------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,0) circle (1 cm);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=0.75,above right]{1}(2,0); % <---------- modified
%foreach x in {-3,-2-1,1,2,3}
%draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) ;
draw[line width=.8pt,->] (0.,-2) -- node[pos=0.75,above right]{1}(0,2); %<------- modified
%foreach t in {-3,-2,-1,1,2,3}
%draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt) ;
draw[pattern=north west lines] (0,1)--(1,0)--(0,-1)--(-1,0)--(0,1);
node at (0,-2.25){$d_{infty}$};
end{tikzpicture}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 24 '18 at 19:14

























answered Dec 24 '18 at 18:50









Hafid BoukhouldaHafid Boukhoulda

3,1571521




3,1571521













  • please how to write under each graph ?

    – Vrouvrou
    Dec 24 '18 at 19:00











  • @Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

    – Hafid Boukhoulda
    Dec 24 '18 at 19:04











  • $d_{infty}$ that's all

    – Vrouvrou
    Dec 24 '18 at 19:06











  • The best way is to use an tikz node.

    – Hafid Boukhoulda
    Dec 24 '18 at 19:10











  • I don't know how to do it ?

    – Vrouvrou
    Dec 24 '18 at 19:11



















  • please how to write under each graph ?

    – Vrouvrou
    Dec 24 '18 at 19:00











  • @Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

    – Hafid Boukhoulda
    Dec 24 '18 at 19:04











  • $d_{infty}$ that's all

    – Vrouvrou
    Dec 24 '18 at 19:06











  • The best way is to use an tikz node.

    – Hafid Boukhoulda
    Dec 24 '18 at 19:10











  • I don't know how to do it ?

    – Vrouvrou
    Dec 24 '18 at 19:11

















please how to write under each graph ?

– Vrouvrou
Dec 24 '18 at 19:00





please how to write under each graph ?

– Vrouvrou
Dec 24 '18 at 19:00













@Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

– Hafid Boukhoulda
Dec 24 '18 at 19:04





@Vrouvrou I think it depends of what is to be written? A caption? a pararagraph?

– Hafid Boukhoulda
Dec 24 '18 at 19:04













$d_{infty}$ that's all

– Vrouvrou
Dec 24 '18 at 19:06





$d_{infty}$ that's all

– Vrouvrou
Dec 24 '18 at 19:06













The best way is to use an tikz node.

– Hafid Boukhoulda
Dec 24 '18 at 19:10





The best way is to use an tikz node.

– Hafid Boukhoulda
Dec 24 '18 at 19:10













I don't know how to do it ?

– Vrouvrou
Dec 24 '18 at 19:11





I don't know how to do it ?

– Vrouvrou
Dec 24 '18 at 19:11











5














The little lines are drawn by the for loop in your code. If you don't want them outside of the axis, don't let the loop run from -3 to 3, but only from -2 to 2.



If you also want to remove the lines from the edges of your axis, restrict the loop further to -1 to 1 (or remove them completely, the remaining ticks are not really visible above the edge of the rectangle)



Furthermore there are missing ,, that is why some of the lines are missing. Also the syntax for syntax for drawing the rectangle (and other geometric shapes, see @marmot's comment below) can be simplified.



documentclass[12pt]{book}

usepackage{tikz}
usetikzlibrary{patterns}

begin{document}

begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-2,-1,1,2}{
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
}
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-2,-1,1,2}{
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt);
}
draw[pattern=north west lines] (-1,-1) rectangle (1,1);
end{tikzpicture}

end{document}


enter image description here






share|improve this answer





















  • 1





    @marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

    – samcarter
    Dec 24 '18 at 20:17
















5














The little lines are drawn by the for loop in your code. If you don't want them outside of the axis, don't let the loop run from -3 to 3, but only from -2 to 2.



If you also want to remove the lines from the edges of your axis, restrict the loop further to -1 to 1 (or remove them completely, the remaining ticks are not really visible above the edge of the rectangle)



Furthermore there are missing ,, that is why some of the lines are missing. Also the syntax for syntax for drawing the rectangle (and other geometric shapes, see @marmot's comment below) can be simplified.



documentclass[12pt]{book}

usepackage{tikz}
usetikzlibrary{patterns}

begin{document}

begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-2,-1,1,2}{
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
}
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-2,-1,1,2}{
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt);
}
draw[pattern=north west lines] (-1,-1) rectangle (1,1);
end{tikzpicture}

end{document}


enter image description here






share|improve this answer





















  • 1





    @marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

    – samcarter
    Dec 24 '18 at 20:17














5












5








5







The little lines are drawn by the for loop in your code. If you don't want them outside of the axis, don't let the loop run from -3 to 3, but only from -2 to 2.



If you also want to remove the lines from the edges of your axis, restrict the loop further to -1 to 1 (or remove them completely, the remaining ticks are not really visible above the edge of the rectangle)



Furthermore there are missing ,, that is why some of the lines are missing. Also the syntax for syntax for drawing the rectangle (and other geometric shapes, see @marmot's comment below) can be simplified.



documentclass[12pt]{book}

usepackage{tikz}
usetikzlibrary{patterns}

begin{document}

begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-2,-1,1,2}{
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
}
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-2,-1,1,2}{
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt);
}
draw[pattern=north west lines] (-1,-1) rectangle (1,1);
end{tikzpicture}

end{document}


enter image description here






share|improve this answer















The little lines are drawn by the for loop in your code. If you don't want them outside of the axis, don't let the loop run from -3 to 3, but only from -2 to 2.



If you also want to remove the lines from the edges of your axis, restrict the loop further to -1 to 1 (or remove them completely, the remaining ticks are not really visible above the edge of the rectangle)



Furthermore there are missing ,, that is why some of the lines are missing. Also the syntax for syntax for drawing the rectangle (and other geometric shapes, see @marmot's comment below) can be simplified.



documentclass[12pt]{book}

usepackage{tikz}
usetikzlibrary{patterns}

begin{document}

begin{tikzpicture}
draw[line width=.8pt,->] (-2,0.) -- node[pos=1,right]{}(2,0);
foreach x in {-2,-1,1,2}{
draw[shift={(x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
}
draw[line width=.8pt,->] (0.,-2) -- node[pos=1,above]{}(0,2);
foreach t in {-2,-1,1,2}{
draw[shift={(0,t)},color=black] (2pt,0pt) -- (-2pt,0pt);
}
draw[pattern=north west lines] (-1,-1) rectangle (1,1);
end{tikzpicture}

end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 24 '18 at 20:15

























answered Dec 24 '18 at 18:47









samcartersamcarter

1




1








  • 1





    @marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

    – samcarter
    Dec 24 '18 at 20:17














  • 1





    @marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

    – samcarter
    Dec 24 '18 at 20:17








1




1





@marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

– samcarter
Dec 24 '18 at 20:17





@marmot Thanks for your comment! I removed shapes.geometric and replaced the custom path with a rectangle. I'll leave the second and third variation of the same code as an exercise for the OP :)

– samcarter
Dec 24 '18 at 20:17


















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%2f467218%2fimprove-this-tikz-picture%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

Bressuire

Cabo Verde

Gyllenstierna