pstricks: Das Bild geht ueber den text hinaus Thema ist als GELÖST markiert

Tabellen und Grafiken erstellen und anordnen


stefa

pstricks: Das Bild geht ueber den text hinaus

Beitrag von stefa »

Gruss Gott,

ich habe das unterstehende Dokument gefasst. Aber Text und Bild decken
sich...was sollte ich tun? ich bin ein Anfaenger. danke!
\begin{document}

\section{figura}

This should be the picture

\begin{figure}[!hbtp]
\psset{xunit=0.4mm,yunit=1.5mm}
\savedata{\questi}[{0,0},{100,25},{200,40},{300,50},{400,60}]
\dataplot[plotstyle=curve,showpoints=true]{\questi}
\psaxes[Dx=100,Dy=10]{->}(0,0)(0,0)(410,62)
\vspace{5mm}
\caption{This is the graph of $c(N)$}
\end{figure}

but it overlaps with the text!

\end{document}

Benutzeravatar
localghost
Forum-Meister
Forum-Meister
Beiträge: 826
Registriert: Di 8. Jul 2008, 15:40
Wohnort: Braunschweig

Passende Umgebung

Beitrag von localghost »

Bitte immer ein komplettes und lauffähiges Beispiel, ein so genanntes Minmalbeispiel, präsentieren. Niemand hat Lust dazu, die nötigen Pakete zusammen zu sammeln, um aus deinen Code-Schnipseln ein komplettes Dokument zu basteln.

Für solche Sachen eignet sich die Umgebung psgraph aus pst-plot ganz gut.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pst-plot,pstricks-add}

\begin{document}
  \section{figura}
    This should be the picture

    \begin{figure}[!htb]
      \centering
      \psset{llx=-1.2cm,lly=-1cm,xAxisLabel={$N$},xAxisLabelPos={c,-8},yAxisLabel={$c(N)$},yAxisLabelPos={-50,c}}
      \begin{psgraph}[Dx=100,Dy=5](0,0)(400,60){10cm}{7cm}
        \savedata{\questi}[{0,0},{100,25},{200,40},{300,50},{400,60}]
        \dataplot[plotstyle=curve,showpoints=true]{\questi}
      \end{psgraph}
      \caption{This is the graph of $c(N)$}
    \end{figure}

    but it overlaps with the text!
\end{document}
Einfacher ginge es allerdings mit pgfplots (basiert auf pgf/tikZ). Ein ganz einfaches Beispiel basierend auf deinem Material.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}

\begin{document}
  \section{figura}
    This should be the picture

    \begin{figure}[!htb]
      \centering
      \begin{tikzpicture}
        \begin{axis}[
          xmin=0,xmax=400,
          xlabel={$N$},
          xlabel near ticks,
          ymin=0,ymax=60,
          ylabel={$c(N)$},
          ylabel near ticks,
          ytick={0,10,...,60}
        ]
          \addplot[smooth,mark=*] coordinates {
            (0,0) (100,25) (200,40) (300,50) (400,60)
          };
        \end{axis}
      \end{tikzpicture}
      \caption{This is the graph of $c(N)$}
    \end{figure}

    but it overlaps with the text!
\end{document}
Kann dann auch direkt mit PDFLaTeX bearbeitet werden.


Thorsten
TeX und LaTeX, Fragen und Antworten – TeXwelt

¹ Es tut mir Leid. Meine Antworten sind begrenzt. Sie müssen die richtigen Fragen stellen.
² System: TeX Live 2024, TeXworks

Antworten