TransWikia.com

How to draw a picture

TeX - LaTeX Asked by the_fox on May 16, 2021

I’d like to draw the following picture, but currently have no clue how to go about it:enter image description here

Any ideas/suggestions?

One Answer

enter image description here

With a few foreach loops this is fairly quick to draw:

documentclass[tikz, border=20]{standalone}

begin{document}
    pgfmathsetmacro{r}{0.05}
    begin{tikzpicture}
        tikzset{axis/.style={->, >=latex, thick}}
        tikzset{other lines/.style={thick}}
        draw[axis] (-1, 0) -- (10, 0);
        draw[axis] (0, -1) -- (0, 6);
        foreach x in {0, 0.5, 1, 6.5} {
            draw[fill=black] (x, 0) circle[radius=r];
        }
        foreach x in {0, 0.5, ..., 7.5} {
            draw[fill=black] (x, 0.5) circle[radius=r];
            draw[fill=black] (x, 1) circle[radius=r];
        }
        foreach x in {5, 5.5, ..., 7.5} {
            draw[fill=black] (x, 1.5) circle[radius=r];
        }
        foreach y in {2, 2.5, ..., 3.5} {
            draw[fill=black] (6.5, y) circle[radius=r];
        }
        draw[fill=black] (0, 4) circle[radius=r];
        
        draw[other lines] (0, 0) -- (10, 5) node[pos=0.7, above] {(D)};
        draw[other lines] (9, 0) -- (9, 4.5);
        draw[other lines] (0, 4.5) -- (9, 4.5);
        node[below left] at (0, 0) {((0, 0))};
        node[below] at (6.5, 0) {((k, 0))};
        node[below] at (9, 0) {((p/2, 0))};
        node[left] at (0, 4) {((0, f))};
        node[left] at (0, 4.5) {((0, q/2))};
        node[below right] at (9, 4.5) {((p/2, q/2))};
        node[right] at (6.5, 3) {((k, kq/p))};
        node at (8, 2) {(T_1)};
        node at (2, 4) {(T_2)};
    end{tikzpicture}
end{document}

Edit: Added missing coordinate label, thanks @Kim Jong Un for pointing this out.

Correct answer by Willoughby on May 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP