0

I have received a relative complex matrix made with Tikz. I would like to do some modifications on a few points.

Here the source :

\documentclass[tikz,margin=1mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz, xcolor, scalefnt}
\usetikzlibrary{arrows,shapes.geometric,trees, positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{relsize}

\usepackage{xfakebold}

\newcommand{\fbseries}{\unskip\setBold\aftergroup\unsetBold\aftergroup\ignorespaces}
\makeatletter
\newcommand{\setBoldness}[1]{\def\fake@bold{#1}}
\makeatother
%----------------------------------------------------------
\begin{document}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\definecolor{ffqqqq}{rgb}{1,0,0}
\definecolor{cczzff}{rgb}{0.8,0.6,1}
\definecolor{ffffww}{rgb}{1,1,0.4}
\definecolor{zzffzz}{rgb}{0.6,1,0.6}
\definecolor{bcduew}{rgb}{0.7372549019607844,0.8313725490196079,0.9019607843137255}
\definecolor{ffzzqq}{rgb}{1,0.6,0}
\begin{tikzpicture}[scale = 0.7]
\fill[line width=1.6pt,color=ffzzqq,fill=ffzzqq,fill opacity=0.28] (-3.9889680326169636,4.401999403915503) -- (-4,2) -- (0,2) -- (0.004889672914417752,4.38116188545186) -- cycle;
\fill[line width=2pt,color=bcduew,fill=bcduew,fill opacity=0.45] (0,2) -- (0,0) -- (3,0) -- (3,2) -- cycle;
\fill[line width=2pt,color=zzffzz,fill=zzffzz,fill opacity=0.44] (3,0) -- (5.5,0) -- (5.5,-2) -- (3,-2) -- cycle;
\fill[line width=2pt,color=ffffww,fill=ffffww,fill opacity=0.45] (5.5,-2) -- (5.5,-4) -- (7.622446543428001,-4.014932473190319) -- (7.649966897383555,-1.9627139676675045) -- cycle;
\fill[line width=2pt,color=cczzff,fill=cczzff,fill opacity=0.37] (7.622446543428001,-4.014932473190319) -- (7.597052906560133,-8.992085299292388) -- (13,-9) -- (13,-4) -- cycle;
\draw [line width=1.6pt,color=ffzzqq] (-3.9889680326169636,4.401999403915503)-- (-4,2);
\draw [line width=1.6pt,color=ffzzqq] (-4,2)-- (0,2);
\draw [line width=1.6pt,color=ffzzqq] (0,2)-- (0.004889672914417752,4.38116188545186);
\draw [line width=1.6pt,color=ffzzqq] (0.004889672914417752,4.38116188545186)-- (-3.9889680326169636,4.401999403915503);
\draw [line width=2pt,color=bcduew] (0,2)-- (0,0);
\draw [line width=2pt,color=bcduew] (0,0)-- (3,0);
\draw [line width=2pt,color=bcduew] (3,0)-- (3,2);
\draw [line width=2pt,color=bcduew] (3,2)-- (0,2);
\draw [line width=2pt,color=zzffzz] (3,0)-- (5.5,0);
\draw [line width=2pt,color=zzffzz] (5.5,0)-- (5.5,-2);
\draw [line width=2pt,color=zzffzz] (5.5,-2)-- (3,-2);
\draw [line width=2pt,color=zzffzz] (3,-2)-- (3,0);
\draw [line width=2pt,color=ffffww] (5.5,-2)-- (5.5,-4);
\draw [line width=2pt,color=ffffww] (5.5,-4)-- (7.622446543428001,-4.014932473190319);
\draw [line width=2pt,color=ffffww] (7.622446543428001,-4.014932473190319)-- (7.649966897383555,-1.9627139676675045);
\draw [line width=2pt,color=ffffww] (7.649966897383555,-1.9627139676675045)-- (5.5,-2);
\draw [line width=2pt,color=cczzff] (7.622446543428001,-4.014932473190319)-- (7.597052906560133,-8.992085299292388);
\draw [line width=2pt,color=cczzff] (7.597052906560133,-8.992085299292388)-- (13,-9);
\draw [line width=2pt,color=cczzff] (13,-9)-- (13,-4);
\draw [line width=2pt,color=cczzff] (13,-4)-- (7.622446543428001,-4.014932473190319);
\draw (-3.6,3.9) node[anchor=north west] {\shortstack{\bm{$7\times7$}\\ \textbf{cosmo param}}};
\draw (-0.1,2.1) node[anchor=north west] {\shortstack{\bm{$5\times5$}\\ \textbf{bias spectro}}};
\draw (3.4,-0.3) node[anchor=north west] {\shortstack{\bm{$5\times5$}\\ \textbf{P$_{\textbf{shot}}$}}};
\draw (5.8,-2.4) node[anchor=north west] {\shortstack{\bm{$3\times3$}\\ \textbf{I.A}}};
\draw (9.1,-5.5) node[anchor=north west] {\shortstack{\bm{$11 \times 11$} \\\textbf{bias photo}}};
\draw [line width=2pt] (-4.460513357849706,-9.994562463165211)-- (-5.4826322264884935,-10.009164161288624);
\draw [line width=2pt] (14,-10)-- (12.977881131361215,-10.014601698123412);
\draw [line width=2pt] (14.007084672527233,4.785070169271532)-- (12.993609515251185,4.797912254724703);
\draw [line width=2pt] (-4.493367178627381,4.817923990049208)-- (-5.515486047266167,4.803322291925796);
\draw [line width=2pt] (-5.515486047266167,4.803322291925796)-- (-5.4826322264884935,-10.009164161288624);
\draw [line width=2pt] (14,-10)-- (14.000418558780272,4.785154637846578);
\draw [line width=2pt] (10.604542109871408,4.5248478029740395)-- (10.580442621705167,1.4004721316746256);
\draw [line width=2pt] (1.5901203468644618,-7.3314334586139)-- (1.5237172386414934,-9.747252274283294);
\draw (-5.917619183528533,-12) node[anchor=north west] {\bm{$F[7+i,7+i] = F[7+i,7+i] + C_{00}$}};
\draw (-1.0432312316260273,-10.389231296495183) node[anchor=north west] {\bm{$F[25+i,7+i] = F[25+i,7+i] + C_{10}$}};
\draw (2.9205567732177684,6) node[anchor=north west] {\bm{$F[7+i,25+i] = F[7+i,25+i] + C_{01}$}};
\draw (3.590115557819761,-13.2) node[anchor=north west] {\bm{$F[25+i,25+i] = F[25+i,25+i] + C_{11}$}};
\draw [shift={(-58.27706376491269,15.519996579460745)},line width=2pt]  plot[domain=5.825732351019411:6.031277023379088,variable=\t]({1*61.3814031943808*cos(\t r)+0*61.3814031943808*sin(\t r)},{0*61.3814031943808*cos(\t r)+1*61.3814031943808*sin(\t r)});
\draw [shift={(3.8,-8)},line width=2pt]  plot[domain=-0.8511778320660293:0.0861746394516815,variable=\t]({1*6.5859837516263235*cos(\t r)+0*6.5859837516263235*sin(\t r)},{0*6.5859837516263235*cos(\t r)+1*6.5859837516263235*sin(\t r)});
\draw [line width=2pt,dash pattern=on 3pt off 1pt] (-3.5995625932969295,1.6682719831703405)-- (-3.6239203207161172,-8.154457534536574);
\draw (-3.3,-8) node[anchor=north west] {\bm{$F_{30,0}$}};
\draw [line width=2pt,dash pattern=on 3pt off 1pt] (-1.339432884578692,-8.594108272555605)-- (7.107327748196611,-8.598793429321976);
\draw [line width=2pt,dash pattern=on 3pt off 1pt] (12.645679320017997,-3.702365541683961)-- (12.654324456818385,3.0947358918642);
\draw [line width=2pt,dash pattern=on 3pt off 1pt] (12,4)-- (0.4085772595325554,3.978047491580542);
\draw (11.4,-7.9) node[anchor=north west] {\bm{$F_{30,30}$}};
\draw (11.78551508134815,4) node[anchor=north west] {\bm{$F_{0,30}$}};
\draw (-3.8,4.3) node[anchor=north west] {\bm{$F_{0,0}$}};
\draw [line width=2pt,dotted] (1.841125022717117,-7.158251757187386)-- (10.141023533796332,-7.186724822405498);
\draw [line width=2pt,dotted] (1.581837717642849,-6.783679416624932)-- (1.651036479690521,0.6897868845235751);
\draw [line width=2pt,dotted] (10.164911093537606,0.9926765325987955)-- (2.0000122864095315,0.9856740464863375);
\draw [line width=2pt,dotted] (10.441106835113134,0.5810006685643927)-- (10.373330191856859,-6.772765124741283);
\draw [color=ffqqqq](1.3483501837473617,1.4) node[anchor=north west] {\large{\bm{$\displaystyle \times$}}};
\draw [color=ffqqqq](1.1,-6.6) node[anchor=north west] {\large{\bm{$\displaystyle \times$}}};
\draw [color=ffqqqq](10,1.4) node[anchor=north west] {\large{\bm{$\displaystyle \times$}}};
\draw [color=ffqqqq](9.990547117115293,-6.6) node[anchor=north west] {\large{\bm{$\displaystyle \times$}}};
\begin{scriptsize}
\draw [fill=ududff,shift={(10.604542109871408,4.5248478029740395)}] (0,0) ++(0 pt,6pt) -- ++(5.196152422706632pt,-9pt)--++(-10.392304845413264pt,0 pt) -- ++(5.196152422706632pt,9pt);
\draw [fill=ududff,shift={(1.5237172386414934,-9.747252274283294)},rotate=180] (0,0) ++(0 pt,6pt) -- ++(5.196152422706632pt,-9pt)--++(-10.392304845413264pt,0 pt) -- ++(5.196152422706632pt,9pt);
\draw [fill=ududff,shift={(-3.2068752669835625,-11.589983075893043)},rotate=270] (0,0) ++(0 pt,6pt) -- ++(5.196152422706632pt,-9pt)--++(-10.392304845413264pt,0 pt) -- ++(5.196152422706632pt,9pt);
\draw [fill=ududff,shift={(8.2,-12.9)},rotate=270] (0,0) ++(0 pt,6pt) -- ++(5.196152422706632pt,-9pt)--++(-10.392304845413264pt,0 pt) -- ++(5.196152422706632pt,9pt);
\draw [fill=black] (12.635718248347523,-4.231629291141428) circle (1.5pt);
\draw [fill=black] (12.636800539351324,-7.57083005047046) circle (1.5pt);
\draw [fill=black] (11.679065808287241,-8.596069520534554) circle (1.5pt);
\draw [fill=black] (-0.3010667528589086,3.9624930510918492) circle (1.5pt);
\draw [fill=black] (-2.710381685328957,3.986377828225564) circle (1.5pt);
\draw [fill=black] (-3.605372373467905,3.793610603087946) circle (1.5pt);
\draw [fill=black] (-3.6089348841175433,2.1750609515582267) circle (1.5pt);
\draw [fill=black] (8.33807909606156,-8.59947608901317) circle (1.5pt);
\draw [fill=black] (8.676244295359405,-8.599131285813481) circle (1.5pt);
\draw [fill=black] (8.993690318277086,-8.598807608496424) circle (1.5pt);
\draw [fill=black] (9.412697837028288,-8.598380376086174) circle (1.5pt);
\draw [fill=black] (9.86980871751748,-8.597914292365754) circle (1.5pt);
\draw [fill=black] (10.212570674682693,-8.597564802176322) circle (1.5pt);
\draw [fill=black] (10.55541030806792,-8.597215232785928) circle (1.5pt);
\draw [fill=black] (11.366699452972995,-8.596388018472872) circle (1.5pt);
\draw [fill=black] (-3.6067967704955475,3.146466625296727) circle (1.5pt);
\draw [fill=black] (-3.607671716191231,2.7489539747730274) circle (1.5pt);
\draw [fill=black] (12.636678791654719,-7.195200945614188) circle (1.5pt);
\draw [fill=black] (12.636523730787035,-6.716790457778029) circle (1.5pt);
\draw [fill=black] (12.636377048871235,-6.26423161464287) circle (1.5pt);
\draw [fill=black] (12.636201032473926,-5.721166870048644) circle (1.5pt);
\draw [fill=black] (12.63606692713587,-5.307410638970552) circle (1.5pt);
\draw [fill=black] (12.6359453943006,-4.932444447446744) circle (1.5pt);
\draw [fill=black] (12.635840624802379,-4.60919830866198) circle (1.5pt);
\draw [fill=black] (12.634549814372313,-7.919278259229274) circle (1.5pt);
\draw [fill=black] (-1.264769568315113,3.9720467323728212) circle (1.5pt);
\draw [fill=black] (-1.7324630796571368,3.9766832185103294) circle (1.5pt);
\draw [fill=black] (-2.242232709994738,3.9863778282255593) circle (1.5pt);
\draw [fill=black] (-0.7138639964036116,3.986377828225564) circle (1.5pt);
\draw [fill=black] (-3.605372373467905,2.4580091146344496) circle (1.5pt);
\draw [fill=black] (-3.619141460977735,3.504459765381519) circle (1.5pt);
\draw [fill=black] (10.934226111965524,-8.596828981032205) circle (1.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}

which produces the following rendering :

matrix

Modifications to apply :

  1. I have marked in red the 2 sections to modify : I need the same size for the text $F_{0,O}$ $F_{30,30}$, $F_{0,30}$ and $F_{30,0}$. But on the upper left, $F_{0,0}$ is overlapped with the dots and is not seen. for this 7x7 block, I need 6 dots line besides to the right inside and 6 dots column below also inside this block. I would like to avoid the overlapping between $F_{0,0}$ and the line/columns of 6 dots.

  2. for red marked area on bottom right, I would like to align vertically $F_{30,30}$ with the 10 dots horizontally placed : these 10 dots are too much shifted to the right, so there is a little space between the left side of this 11x11 block and the begin of the 10 dots line. If we could remove this space, then, I could have a good alignment for $F_{30,30}$.

  3. and Finally, the blue marked area corresponds to an issue of overlapping also : I would like that the text "bias spectro" to be a little bit higher, above the red cross in order to avoid having an overlap between this text and the red cross.

All these modifications are minor but necessary and I have not enough Tikz skills to solve it by myself.

So any help would be fine.

1
  • Hello. The code you provide is clearly coming from an automatic export from some external software. It's really redundant and it could be interesting to clean it a bit. All the dots are drawn in the end with lines starting with \draw [fill=black]. It's possible to delete some of them. For the rest, a close look at the code should be self explanatory if you want to drag some text. Maybe you could give a try.
    – SebGlav
    May 11, 2021 at 11:54

1 Answer 1

1

Your code is from a tool, so it's difficult to modify.

I did it completely new, hoping to meet your needs:

\documentclass[tikz,margin=1cm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\usepackage{xcolor}
\definecolor{myblue}{rgb}{0.30196078431372547,0.30196078431372547,1}
\definecolor{myviolet}{rgb}{0.8,0.6,1}
\definecolor{myyellow}{rgb}{1,1,0.4}
\definecolor{mygreen}{rgb}{0.6,1,0.6}
\definecolor{mygray}{rgb}{0.7372549019607844,0.8313725490196079,0.9019607843137255}
\definecolor{myorange}{rgb}{1,0.6,0}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}
\usetikzlibrary{bbox}

\tikzset{
    mynode/.style n args={3}{
        draw=#1,  fill=#1!#2, 
        text width=#3, minimum height=#3,very thick, text centered, text=black, font=\bfseries, 
        line width=2pt, inner sep=0pt,
        anchor=north west
        },
    mydotline/.style={dotted, line width=2pt},
    myline/.style={line width=2pt},
    myarrow/.style={-{Triangle[fill=myblue,line width=1pt]},myline}
    }

\begin{document}
\begin{tikzpicture}[bezier bounding box]
    \node[mynode={myorange}{28}{28mm}] (cosmo) {$\boldsymbol{7\times7}$\\cosmo\\ param};
    \node[mynode={mygray}{45}{20mm}] (spectro) at (cosmo.south east) {$\boldsymbol{5\times5}$\\bias spectro};
    \node[mynode={mygreen}{45}{20mm}] (P) at (spectro.south east) {$\boldsymbol{5\times5}$\\$\mathbf{P_{shot}}$};
    \node[mynode={myyellow}{44}{12mm}] (IA) at (P.south east) {$\boldsymbol{3\times3}$\\I.A};
    \node[mynode={myviolet}{37}{44mm}] (photo) at (IA.south east) {$\boldsymbol{11\times11}$\\bias photo};
    \node[red, anchor=south] (Xspectro) at (spectro.south) {$\boldsymbol{\times}$};
    \node[red, anchor=south] (Xphoto) at ([yshift=2.7cm]photo.south) {$\boldsymbol{\times}$};
    \draw[mydotline] (Xspectro) -| node[fill=white, text=red] (XsXp) {$\boldsymbol{\times}$}  (Xphoto);
    \draw[mydotline] (Xspectro) |- node[fill=white, text=red] (XpXs)  {$\boldsymbol{\times}$}  (Xphoto);
    \node[anchor=north west, inner sep=4pt] (Fcosmo) at (cosmo.north west) {$\boldsymbol{F_{0,0}}$};
    \node[anchor=south east, inner sep=4pt] (Fphoto) at (photo.south east) {$\boldsymbol{F_{30,30}}$};
    \draw[mydotline] (Fcosmo) -| node[fill=white] (FNE) {$\boldsymbol{F_{0,30}}$}  (Fphoto);
    \draw[mydotline] (Fcosmo) |- node[fill=white] (FSW) {$\boldsymbol{F_{30,0}}$}  (Fphoto);
    \draw[myarrow] (Xspectro.west) -- +(-3,-11.5) node[anchor=170] {$\boldsymbol{F[7+i,7+i] = F[7+i,7+i] + C_{00}}$};
    \draw[myarrow] (XpXs) -- +(0,-4cm) node[anchor=170] {$\boldsymbol{F[25+i,7+i] = F[25+i,7+i] + C_{10}}$};
    \draw[myarrow] (XsXp) -- +(0,5.5) node[anchor=-10] {$\boldsymbol{F[7+i,25+i] = F[7+i,25+i] + C_{01}}$};
    \draw[myarrow] (Xphoto.east) to[out=-10, in=0] +(1.5, -5.5) node[anchor=east] {$\boldsymbol{F[25+i,25+i] = F[25+i,25+i] + C_{11}}$};
    \draw[myline] ([shift={(-.4,.6)}]Fcosmo.center) -- ([shift={(-.9,.6)}]Fcosmo.center) -- ([shift={(-.9,-.6)}]FSW.center) -- +(.5,0) ;
    \draw[myline] ([shift={(.4,.6)}]FNE.center) -- ([shift={(.9,.6)}]FNE.center) -- ([shift={(.9,-.6)}]Fphoto.center) -- +(-.5,0) ;
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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