Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two problems and sincerely I am trying to resolve them, but unfortunately I am not able...That is why I will appreciate very much your help.

1) My article architecture consists of two columns each page. That is why, in the beginning of my code, I wrote \begin{multicols}{2}. Now, and in a specific part of my article, I am interested to draw multiple graphs. Let us consider 4 graphs. I need that the first two graphs be drawn next to each other in the same line, then the two last must be drawn below the previous graphs and next to each other in the same line. To make that, firstly, I wrote \end{multicols}, but although that, when I draw my 4 graphs, they are drawn each one below the other...

2) My second problem is that in each graph, they are a huge number of points, that is why, when the graph is drawn, it is not being clear. In other words, all the points being very small and the user needs to zoom in the article in order to show clearly the points. So how can I make the graph more clear and visible.

Let us consider my graphs that contains in this example a few points (they contains a huge number of points in my article. Here is just a simple example):

    \documentclass{article}
    \usepackage{pgfplots}
    \begin{document}


    \begin{tikzpicture}
    \begin{axis}[
        axis lines=middle,
        xmax=20,
        ymax=20,
        xtick=\empty, ytick=\empty
]
    \addplot [only marks] table {
    -10 -4
    -8  2
    -5  5   
};
    \end{axis}
    \end{tikzpicture}



    \begin{tikzpicture}
    \begin{axis}[
        axis lines=middle,
        xmax=20,
        ymax=20,
        xtick=\empty, ytick=\empty
]
    \addplot [only marks] table {
    -12 -4
    -5  2
    -5  4   
};
    \end{axis}
    \end{tikzpicture}



\begin{tikzpicture}
    \begin{axis}[
        axis lines=middle,
        xmax=20,
        ymax=20,
        xtick=\empty, ytick=\empty
]
    \addplot [only marks] table {
    -13 -4
    -1  2
    -8  4   
};
    \end{axis}
    \end{tikzpicture}




\begin{tikzpicture}
    \begin{axis}[
        axis lines=middle,
        xmax=20,
        ymax=20,
        xtick=\empty, ytick=\empty
]
    \addplot [only marks] table {
    -12 -4
    -1  11
    -8  4   
};
    \end{axis}
    \end{tikzpicture}


    \end{document}
share|improve this question
    
I'm getting errors when compiling the MWE. Is it pasted correctly? –  remus Apr 2 at 15:56
    
Do you want the to organize the graphs 2x2 in one column? Or to break the columns and let them occupy all space from left to right margin of the page? –  remus Apr 2 at 16:04
    
@remus the second choice of your question is what I need (break the columns...) –  Christina Apr 2 at 16:16
1  
To solve problem 2: you could reduce the number of points if you prefer to plot with marks (in this way they won't overlap); if you need to put most of the points on the plot then why not drawing a line with no marks? –  remus Apr 2 at 16:33
1  
Have you taken (for the second part) a look at different stylings of the marks, e.g. \addplot [only marks,mark=o]... ? –  Ronny Apr 2 at 16:51

1 Answer 1

up vote 3 down vote accepted

Here is a solution based on groupplots and figure*:

  1. first 2x2 figures are fit within a single column: 1 column

  2. and the next 2x2 group spans over the page: 2 columns

MWE:

\documentclass[twocolumn, a4paper, 10pt]{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\usepackage{lipsum}

\begin{document}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2}, width=0.25\textwidth]
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -10 -4
        -8  2
        -5  5  
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -3 -4
        -5  2
        -12  5
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -7 -15
        -8  3
        -12  5
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -8 -2
        -6  1
        -12  5
    };
\end{groupplot}
\end{tikzpicture}
\caption{My figure.}
\end{figure}

\begin{figure*}[htbp]
\centering
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2}, width=0.4\textwidth]
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -10 -4
        -8  2
        -5  5  
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -3 -4
        -5  2
        -12  5
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -7 -15
        -8  3
        -12  5
    };
    \nextgroupplot[
    axis lines=middle,
    xmax=20,
    ymax=20,
    xtick=\empty, ytick=\empty]
    \addplot [only marks] table {
        -8 -2
        -6  1
        -12  5
    };
\end{groupplot}
\end{tikzpicture}
\caption{My figure.}
\end{figure*}

\lipsum[2-10]
\end{document}
share|improve this answer
    
Another possibility would be, to use subfigure to place the different tikzpictures from the OP, though I didn't get the figure on the same page as the text then. –  Ronny Apr 2 at 16:52
    
Thank you dear remus:) beautiful answer :) –  Christina Apr 2 at 18:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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