LaTeX forum ⇒ Graphics, Figures & TablesAdjust the graphs

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

Adjust the graphs

Postby Reza7Emarloo » Fri Feb 19, 2021 10:32 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?




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

User avatar
Ijon Tichy
Posts: 415
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Fri Feb 19, 2021 11:38 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 Infominimal 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.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests