TransWikia.com

How to align pspictures two on a row and the third on the second row

TeX - LaTeX Asked on December 12, 2020

how can I align these three pspictures so the first two are on the same line and the third is under them, aligned to the left?

Here is my current code:

begin{figure}[ht!]
psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
begin{pspicture}(0,-2.425)(4.9971156,2.425)
definecolor{colour0}{rgb}{1.0,0.0,0.2}
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm         3.28,arrowlength=1.44,arrowinset=0.0]{->}(0.09855774,0.0)(0.09855774,-1.6) (0.09855774,-0.8)
psline[linecolor=colour0, linewidth=0.05](0.09855774,-1.6)(1.6985577,-1.6)(1.6985577,-0.8)
psline[linecolor=colour0, linewidth=0.05](4.8985577,1.6)(3.2985578,1.6)(3.2985578,1.6)
psline[linecolor=colour0, linewidth=0.05](3.2985578,-0.8)(3.2985578,-1.6)
psline[linecolor=colour0, linewidth=0.05](3.2985578,-1.6)(4.8985577,-1.6)
psline[linecolor=colour0, linewidth=0.05](3.2985578,1.6)(3.2985578,0.8)
psline[linecolor=colour0, linewidth=0.05](1.6985577,0.8)(1.6985577,1.6)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(1.6985577,0.8)(3.2985578,0.8)(2.4985578,0.8)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(4.8985577,1.6)(4.8985577,0.0)(4.8985577,0.8)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(4.8985577,-1.6)(4.8985577,0.0)(4.8985577,-0.8)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(1.6985577,-0.8)(3.2985578,-0.8)(2.4985578,-0.8)
psline[linecolor=black, linewidth=0.05](1.6985577,-1.6)(1.6985577,-2.4)
psline[linecolor=black, linewidth=0.05](3.2985578,-1.6)(3.2985578,-2.4)
psline[linecolor=black, linewidth=0.05](3.2985578,1.6)(3.2985578,2.4)
psline[linecolor=black, linewidth=0.05](1.6985577,1.6)(1.6985577,2.4)
psline[linecolor=black, linewidth=0.05](1.6985577,1.6)(0.09855774,1.6)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(3.2985578,-2.4)(1.6985577,-2.4)(2.4985578,-2.4)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.282,arrowlength=1.44,arrowinset=0.0]{->}(4.8985577,0.0)(0.09855774,0.0)(3.6985579,0.0)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(0.09855774,0.0)(0.09855774,1.6)(0.09855774,0.8)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(1.6985577,2.4)(3.2985578,2.4)(2.4985578,2.4)
psdots[linecolor=black, dotsize=0.2](3.2985578,1.6)
psdots[linecolor=black, dotsize=0.2](4.8985577,0.0)
psdots[linecolor=black, dotsize=0.2](0.09855774,0.0)
psdots[linecolor=black, dotsize=0.2](1.6985577,-1.6)
psdots[linecolor=black, dotsize=0.2](3.2985578,-1.6)
psdots[linecolor=black, dotsize=0.2](1.6985577,1.6)
end{pspicture}
}

psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
begin{pspicture}(0,-3.145)(7.11,3.145)
definecolor{colour0}{rgb}{1.0,0.0,0.2}
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm   3.28,arrowlength=1.44,arrowinset=0.0]{->}(1.6,0.055)(1.6,-1.545)(1.6,-0.745)
psline[linecolor=colour0, linewidth=0.05](1.6,-1.545)(3.2,-1.545)(3.2,-0.745)
psline[linecolor=colour0, linewidth=0.05](6.4,1.655)(4.8,1.655)(4.8,1.655)
psline[linecolor=colour0, linewidth=0.05](4.8,-0.745)(4.8,-1.545)
psline[linecolor=colour0, linewidth=0.05](4.8,-1.545)(6.4,-1.545)
psline[linecolor=colour0, linewidth=0.05](4.8,1.655)(4.8,0.855)
psline[linecolor=colour0, linewidth=0.05](3.2,0.855)(3.2,1.655)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(3.2,0.855)(4.8,0.855)(4.0,0.855)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(6.4,1.655)(6.4,0.055)(6.4,0.855)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(6.4,-1.545)(6.4,0.055)(6.4,-0.745)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(3.2,-0.745)(4.8,-0.745)(4.0,-0.745)
psline[linecolor=black, linewidth=0.05](3.2,-1.545)(3.2,-2.345)
psline[linecolor=black, linewidth=0.05](4.8,-1.545)(4.8,-2.345)
psline[linecolor=black, linewidth=0.05](4.8,1.655)(4.8,2.455)
psline[linecolor=black, linewidth=0.05](3.2,1.655)(3.2,2.455)
psline[linecolor=black, linewidth=0.05](3.2,1.655)(1.6,1.655)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(4.8,-2.345)(3.2,-2.345)(4.0,-2.345)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(6.4,0.055)(1.6,0.055)(5.2,0.055)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(1.6,0.055)(1.6,1.655)(1.6,0.855)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(3.2,2.455)(4.8,2.455)(4.0,2.455)
psdots[linecolor=black, dotsize=0.2](4.8,1.655)
psdots[linecolor=black, dotsize=0.2](6.4,0.055)
psdots[linecolor=black, dotsize=0.2](1.6,0.055)
psdots[linecolor=black, dotsize=0.2](3.2,-1.545)
psdots[linecolor=black, dotsize=0.2](4.8,-1.545)
psdots[linecolor=black, dotsize=0.2](3.2,1.655)
rput[bl](0.0,0.855){$I_1$=5 A}
rput[bl](0.8,-0.745){$I_2$}
rput[bl](3.6,-3.145){$I_4$=5 A}
rput[bl](3.6,2.855){$I_7$=5 A}
rput[bl](2.0,0.455){$I_9$=20 A}
rput[bl](6.8,0.855){$I_6$}
rput[bl](6.8,-0.745){$I_5$}
rput[bl](3.6,-1.145){$I_3$}
rput[bl](3.6,1.255){$I_8$}
end{pspicture}
}



    psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
begin{pspicture}(0,-3.145)(9.14,3.145)
definecolor{colour0}{rgb}{1.0,0.0,0.2}
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.05291cm 3.28,arrowlength=1.44,arrowinset=0.0]{->}(2.0,0.055)(2.0,-1.545)(2.0,-0.745)
psline[linecolor=colour0, linewidth=0.05](2.0,-1.545)(3.6,-1.545)(3.6,-0.745)
psline[linecolor=colour0, linewidth=0.05](6.8,1.655)(5.2,1.655)(5.2,1.655)
psline[linecolor=colour0, linewidth=0.05](5.2,-0.745)(5.2,-1.545)
psline[linecolor=colour0, linewidth=0.05](5.2,-1.545)(6.8,-1.545)
psline[linecolor=colour0, linewidth=0.05](5.2,1.655)(5.2,0.855)
psline[linecolor=colour0, linewidth=0.05](3.6,0.855)(3.6,1.655)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28     ,arrowlength=1.44,arrowinset=0.0]{->}(3.6,0.855)(5.2,0.855)(4.4,0.855)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28     ,arrowlength=1.44,arrowinset=0.0]{->}(6.8,1.655)(6.8,0.055)(6.8,0.855)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(6.8,-1.545)(6.8,0.055)(6.8,-0.745)
psline[linecolor=colour0, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(3.6,-0.745)(5.2,-0.745)(4.4,-0.745)
psline[linecolor=black, linewidth=0.05](3.6,-1.545)(3.6,-2.345)
psline[linecolor=black, linewidth=0.05](5.2,-1.545)(5.2,-2.345)
psline[linecolor=black, linewidth=0.05](5.2,1.655)(5.2,2.455)
psline[linecolor=black, linewidth=0.05](3.6,1.655)(3.6,2.455)
psline[linecolor=black, linewidth=0.05](3.6,1.655)(2.0,1.655)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(5.2,-2.345)(3.6,-2.345)(4.4,-2.345)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(6.8,0.055)(2.0,0.055)(5.6,0.055)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(2.0,0.055)(2.0,1.655)(2.0,0.855)
psline[linecolor=black, linewidth=0.05, arrowsize=0.0529cm 3.28 ,arrowlength=1.44,arrowinset=0.0]{->}(3.6,2.455)(5.2,2.455)(4.4,2.455)
psdots[linecolor=black, dotsize=0.2](5.2,1.655)
psdots[linecolor=black, dotsize=0.2](6.8,0.055)
psdots[linecolor=black, dotsize=0.2](2.0,0.055)
psdots[linecolor=black, dotsize=0.2](3.6,-1.545)
psdots[linecolor=black, dotsize=0.2](5.2,-1.545)
psdots[linecolor=black, dotsize=0.2](3.6,1.655)
rput[bl](0.0,-0.745){$U_2=-100V$}
rput(4.0,-0.345){$U_3=-150V$}
rput[bl](7.2,-0.745){$U_4=-100V$}
rput[bl](7.2,0.455){$U_6=100V$}
rput[bl](3.6,0.855){$U_8=50V$}
rput[bl](4.0,2.855){$U_7$}
rput[bl](4.0,-3.145){$U_4$}
rput[bl](0.4,0.855){$U_1$}
rput[bl](2.4,0.455){$U_9$}
end{pspicture}
}
    caption{Graful initial, cel de curenti si cel de tensiuni}
    end{figure}

One Answer

I compiled your code and thought simpler to rewrite it without having to use the extravagant values of coordinates provided by LatexDraw (7 decimal digits!). For the alignment of the different figures, I used the subfigure environment, from the subcaption package.

You can adapt it to your needs relatively easily, and psscalebox isn't useful, as it is enough to change the value of the unit. The main draback of scaling via '(ps)scalebox is that it also scales the text within the graph. Any details about the commands used here are found in the documentation of pst-node.

documentclass[pdf, a4paper, x11names]{article}
usepackage{geometry}
usepackage{pstricks-add}
usepackage{subcaption}
usepackage{siunitx}

definecolor{colour0}{rgb}{1.0,0.0,0.2}

begin{document}

begin{figure}[!ht]
    footnotesize
    psset{unit=1.333,linewidth=0.05, arrowsize=0.0529cm 3.28, arrowlength=1.44, arrowinset=0,dotsize=0.2,
        colsep=1.5, rowsep=1.2, linearc=0.05, ArrowInsidePos =0.52}
    begin{subfigure}{0.45textwidth}
        begin{pspicture}(-.5,-3)(5,5)
            begin{psmatrix}%
                [name=A0] {} & [name=A1] & [name=A2] & [name=A3]
                [name=B0] & & & [name=B3] 
                [name=C0] & [name=C1] & [name=C2] & [name=C3]
            end{psmatrix}
            psset{linecolor=colour0}
            ncbar[angle=-90, armA=0.6, ArrowInside=->]{A2}{A1}
            ncangle[angleA=90, angleB=180]{B3}{A2}nbput[npos=1]{$I_1 =SI{5}{A}$}
            ncangle[angleA=90, angleB=180]{B3}{C2}
            ncbar[angle=90, armA=0.6]{C2}{C1}
            ncangle[angleA=180, angleB=-90]{C1}{B0}
            %% Add arrows
            psset{arrows=-, linestyle=none, ArrowInside=->, ArrowInsidePos =0.52}
            ncline[offset = 0.6]{A2}{A1}
            ncline[offset = -0.6]{C2}{C1}
            ncline{B3}{A3}
            ncline{B3}{C3}
            ncline{C0}{B0}%
            %% Black lines
            psset{linestyle=solid, linecolor=black, arrows=*-*, ArrowInside=->}%
            ncbar[angle=90, armA=0.6]{A2}{A1}nbput{color{white}$ I_ 7$}
            ncangle[nodesep=0pt, angleA=90, angleB=180]{B0}{A1}
            ncline[ArrowInsidePos=0.8]{B0}{B3}
            ncbar[angle=-90, armA=0.6]{C1}{C2}nbput{color{white}$ I_4 $}
            %% Add arrows
            psset{arrows=-, linestyle=none}
            ncline[offset = -0.6]{A2}{A1}
            ncline[offset = 0.6]{C2}{C1}
            ncline{A0}{B0}
        end{pspicture}
        caption{A first figure}label{1st}
    end{subfigure}
    %%%%%%%%%%%%%%%%%%%
    hfill
    %%%%%%%%%%%%%%%%%%%
    begin{subfigure}{0.45textwidth}
        begin{pspicture}(-.5,-3)(5,5)
            begin{psmatrix}%
                [name=A0] {} & [name=A1] & [name=A2] & [name=A3]
                [name=B0] & & & [name=B3] 
                [name=C0] & [name=C1] & [name=C2] & [name=C3]
                %%%%%%%%%%%%%%%%%%%%
                psset{linecolor=colour0}
                ncbar[angle=-90, armA=0.6, ArrowInside=->]{A2}{A1}nbput[npos = 1.7]{$I_8$}
                ncangle[angleA=90, angleB=180,]{B3}{A2}nbput[npos=0.5]{$ I_6quad U_1 $}
                ncangle[angleA=90, angleB=180,]{B3}{C2}naput[npos=0.5]{$ I_5quad U_2=SI{-100}{V}$}
                ncbar[angle=90, armA=0.6]{C2}{C1}naput[npos=1.7]{$I_3$}
                ncangle[angleA=180, angleB=-90]{C1}{B0}naput{$ I_2 $}
                % Add arrows
                psset{arrows=-, linestyle=none, ArrowInside=->, ArrowInsidePos=0.52}
                ncline[offset = 0.6]{A2}{A1}
                ncline[offset = -0.6]{C2}{C1}
                ncline{B3}{A3}
                ncline{B3}{C3}
                ncline{C0}{B0}%
                % Black lines
                psset{linestyle=solid, linecolor=black, arrows=*-*, ArrowInside=->}%
                ncbar[angle=90, armA=0.6]{A2}{A1}nbput{$ I_7=SI{5}{A} $}%
                ncangle[angleA=180, angleB=90]{A1}{B0}naput[npos=1.8]{$ I_9=SI{20}{A} $}
                ncline[ArrowInsidePos=0.8]{B0}{B3}nbput{ $U_3 =-SI{150}{V}$}
                ncbar[angle=-90, armA=0.6]{C1}{C2}nbput{$ I_4=SI{5}{A}$}
                % Add arrows
                psset{arrows=-, linestyle=none}
                ncline[offset = -0.6]{A2}{A1}
                ncline[offset = -0.6]{C1}{C2}
                ncline{A0}{B0}
            end{psmatrix}
        end{pspicture}
        caption{A second figure}label{2nd}
    end{subfigure}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%
    [2baselineskip]
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    begin{subfigure}{0.45textwidth}
        begin{pspicture}(-.5,-3)(5,5)
            begin{psmatrix}%[mnode=dot]
                [name=A0] {} & [name=A1] & [name=A2] & [name=A3]
                [name=B0] & & & [name=B3] 
                [name=C0] & [name=C1] & [name=C2] & [name=C3]
            end{psmatrix}
            psset{linecolor=colour0}
            ncbar[angle=-90, armA=0.6, ArrowInside=->]{A2}{A1}nbput{$U_8 = SI{50}{V}$}
            ncangle[angleA=90, angleB=180,]{B3}{A2}nbput[npos=0.5]{$U_6 =SI{100}{V}$}
            ncangle[angleA=90, angleB=180,]{B3}{C2}naput[npos=0.5]{$U_4$}
            ncbar[angle=90, armA=0.6]{C1}{C2}
            ncangle[angleA=180, angleB=-90]{C1}{B0}
            %% Add arrows
            psset{arrows=-, linestyle=none, ArrowInside=->, ArrowInsidePos =0.52}
            ncline[offset = 0.6]{A2}{A1}
            ncline[offset = -0.6]{C2}{C1}
            ncline{B3}{A3}
            ncline{B3}{C3}
            ncline{C0}{B0}%
            %% Black lines
            psset{linestyle=solid, linecolor=black, arrows=*-*, ArrowInside=->}%
            ncbar[angle=90, armA=0.6]{A2}{A1}nbput{$U_7$}
            ncangle[angleA=180, angleB=90]{A1}{B0}naput[npos=1.8]{$U_9$}
            ncline[ArrowInsidePos=0.8]{B0}{B3}
            ncbar[angle=-90, armA=0.6]{C1}{C2}nbput{$U_4$}
            %% Add arrows
            psset{arrows=-, linestyle=none}
            ncline[offset=-0.6]{A2}{A1}
            ncline[offset= -0.6]{C1}{C2}
            ncline{A0}{B0}
        end{pspicture}
        caption{A third figure}label{3rd}
    end{subfigure}
    caption{Graful initial, cel de curenti si cel de tensiuni}
end{figure}

end{document} 

enter image description here

Correct answer by Bernard on December 12, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP