2

I made following codes. Please refer this, it is very easy to compile. Now my question is,

i want scaling of x-axis like {-10, -5, 0, 5, 10, 15, 20, 25,....55} it is already in mwe.

but i want to lable y-axis as {-3, 0, 3, 6, 9, ......24}

Please guide me.

\documentclass[12pt,a4paper]{report}
\usepackage[a4paper,bindingoffset=0.2in,left=0.7in,right=0.7in,top=0.7in,bottom=0.7in,footskip=.25in]{geometry}
\usepackage[centertags]{amsmath}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage{enumerate}
\usepackage{makeidx}
\usepackage{tikz}
\usetikzlibrary{backgrounds,intersections}
\setlength\columnsep{10pt} % This is the default columnsep for all pages
\begin{document}
    \begin{tikzpicture}
        \draw[thick,latex-latex] (-2,0) -- (12,0)node[right]{$x$};
        \draw[thick,latex-latex] (0,-2) -- (0,12)node[above]{$y$};
        \node at (-0.3,-0.3) {O};
        \foreach \x/\l in {-1/-5,1/5,2/10,3/15,4/20,5/25,6/30,7/35,8/40,9/45,10/50,11/55,11/60}{
            \node[fill,circle,inner sep=1pt,label=below:$\l$] at (\x,0) {};
            \node[fill,circle,inner sep=1pt,label=left:$\l$] at (0,\x) {};
        }
    \end{tikzpicture}
\end{document}
1

You could try something with pgfplots which offers a little convenience for producting such axis, e.g. you can just rescale everything by changing widthand height. You have to specify both the range xmin=,xmax=, which would also procude ticks automatically (less then yours in number) and your own xticks={} which can be given similar to TikZ. Then you do the same for y. The next two lines place the axis at 0. And taking the axis label placement from here we get

\documentclass[12pt,a4paper]{report}
\usepackage[a4paper,bindingoffset=0.2in,left=0.7in,right=0.7in,top=0.7in,bottom=0.7in,footskip=.25in]{geometry}
\usepackage[centertags]{amsmath}
\usepackage{latexsym}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{newlfont}
\usepackage{enumerate}
\usepackage{makeidx}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{backgrounds,intersections}
\setlength\columnsep{10pt} % This is the default columnsep for all pages
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
        width=12cm,height=12cm,
        xmin=-10,xmax=55,
        xtick = {-10,-5,...,50},
        ymin=-3,ymax=24,
        ytick = {-3,0,...,24},
        axis y line=middle,
        axis x line=middle,
        xlabel=$x$,ylabel=$y$,
        every axis x label/.style={
            at={(ticklabel* cs:1.025)},
            anchor=west,
        },
        every axis y label/.style={
            at={(ticklabel* cs:1.025)},
            anchor=south,
        },
        ]
        \end{axis}
    \end{tikzpicture}
\end{document}

which yields enter image description here

and you can just add plots inside the axis whithout having to think about the rescaling you used in your example.

  • A big thank, asking a small question if i want to put dot instead of tick on axis at every point for this what should i do? – snehal Dec 15 '15 at 6:45
  • one more question how can i get back same desire out put by making changes in my MWE.(given in question) – snehal Dec 15 '15 at 6:50
  • I just added something to your code, just copy the code from my answer. You basically need the pgfplots package I added in the preamble. About the circles - I have to look, what can be done there. – Ronny Dec 15 '15 at 6:59
  • I can't find anything on that, maybe it's a good idea to post that as a seperate question here: How to change the ticks of a pgfplot to circles. – Ronny Dec 16 '15 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.