## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Adjust the graphs

Information and discussion about graphics, figures & tables in LaTeX documents.
Reza7Emarloo
Posts: 2
Joined: Fri Feb 19, 2021 7:28 am

I'v been using the pstricks package for drawing my graph.The axis not only runs past the right and left side of the graph, but I can't fixed it. I want this shape to fit the page (left=3.5cm, right=3.5cm).I just want it to be small and come in the middle and be at the top of the page. I have to say the shape is drawn correctly, but only slightly larger!
Can you help a little more?

\documentclass[12pt]{article}\usepackage{pgf}\usepackage{tikz}\usetikzlibrary{arrows,automata}\usepackage{pgfplots}\usepackage{pstricks,pst-plot}\begin{document}\begin{figure}[htb]\begin{centering}\begin{pspicture}	\psaxes[ticks=none,xunit=.5cm]  (0,0)(0,10)(30,0)\psdots[dotstyle=Oplus,dotsize=10pt] (1,1)(2,2)(-1,3)(-3,5)\psline {->}(1,1)(13,1)\psline(15,0)(15,10)\psline {->}(2,2)(16,2)\psline{->}(-1,3)(8,3)\psline{->}(-3,5)(17,5)\end{pspicture}\end{centering}\caption{censoring observed}\end{figure}
Attachments
s2.PNG (25.27 KiB) Viewed 139 times
Last edited by Reza7Emarloo on Fri Feb 19, 2021 7:11 pm, edited 1 time in total.

Ijon Tichy
Posts: 415
Joined: Mon Dec 24, 2018 10:12 am
With
\psaxes[ticks=none,xunit=.5cm] (0,0)(0,10)(30,0)
you draw an x-axes from 0 up to 30*xunit=15, but with
\psline{->}(-3,5)(17,5)
you draw a line from (-3,5) to (17,5). So it should be expected, that the line starts -3=-6*xunit from the left of the x-axes and 2=4*xunit right from it.

Unfortunately I do not know, what you've expected. So I cannot give you a solution. But IMHO you either have to change the values of \psaxes or of the \psline commands.

BTW: \centering is a command, that works as a switch. You should not use it as an environment, but simple \begin{figure}\centering…\end{figure}. And after loading pgfplots you should always explicitly set option compat. See the manual for more information.

Alternatively you could use TikZ and pgfplots, which you are already loading (and do not need for a real minimal working example).

And please always mark code in postings. You can either select the code with the mouse and then click to the Code button in the toolbar or add the proper Tags around the code.