TikZ matrix is skewed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am trying to create an academic calendar for myself.
I am trying to fill the fall semester in orange color
but the edges of the blocks are skewed.
Please help me in positioning the edges either in vertically or horizontally.
I would be happy, if you can help me in simplifying the code if I have some superfluous parts.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument


enter image description here










share|improve this question



















  • 2




    The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
    – Phelype Oleinik
    53 mins ago










  • Is it possible to use 01 instead of 1?
    – bkarpuz
    50 mins ago










  • Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
    – Phelype Oleinik
    19 mins ago














up vote
1
down vote

favorite












I am trying to create an academic calendar for myself.
I am trying to fill the fall semester in orange color
but the edges of the blocks are skewed.
Please help me in positioning the edges either in vertically or horizontally.
I would be happy, if you can help me in simplifying the code if I have some superfluous parts.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument


enter image description here










share|improve this question



















  • 2




    The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
    – Phelype Oleinik
    53 mins ago










  • Is it possible to use 01 instead of 1?
    – bkarpuz
    50 mins ago










  • Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
    – Phelype Oleinik
    19 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to create an academic calendar for myself.
I am trying to fill the fall semester in orange color
but the edges of the blocks are skewed.
Please help me in positioning the edges either in vertically or horizontally.
I would be happy, if you can help me in simplifying the code if I have some superfluous parts.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument


enter image description here










share|improve this question















I am trying to create an academic calendar for myself.
I am trying to fill the fall semester in orange color
but the edges of the blocks are skewed.
Please help me in positioning the edges either in vertically or horizontally.
I would be happy, if you can help me in simplifying the code if I have some superfluous parts.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument


enter image description here







tikz-matrix tikz-calendar






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 mins ago









Phelype Oleinik

17.5k43771




17.5k43771










asked 57 mins ago









bkarpuz

95111123




95111123







  • 2




    The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
    – Phelype Oleinik
    53 mins ago










  • Is it possible to use 01 instead of 1?
    – bkarpuz
    50 mins ago










  • Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
    – Phelype Oleinik
    19 mins ago












  • 2




    The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
    – Phelype Oleinik
    53 mins ago










  • Is it possible to use 01 instead of 1?
    – bkarpuz
    50 mins ago










  • Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
    – Phelype Oleinik
    19 mins ago







2




2




The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
– Phelype Oleinik
53 mins ago




The problem is the 1 narrower than the 31. Add a minimum width to the matrix: matrix[column sep=1em, row sep=1em, minimum width=2em].
– Phelype Oleinik
53 mins ago












Is it possible to use 01 instead of 1?
– bkarpuz
50 mins ago




Is it possible to use 01 instead of 1?
– bkarpuz
50 mins ago












Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
– Phelype Oleinik
19 mins ago




Yes, it is. The calendar library defines some goodies to format the date. See the TikZ manual for some examples.
– Phelype Oleinik
19 mins ago










2 Answers
2






active

oldest

votes

















up vote
4
down vote













The problem is that the first days make a narrower node than the last ones.



The TikZy way of doing this would be to require a minimum width for the nodes:



matrix[column sep=1em, row sep=1em, minimum width = 2em]...


this, of course, requires some trial-and-error to get the width right. No one likes that, right?



So browsing the code of tikzlibrarycalendar.code.tex I found that the calendar printing routine has some hooks before and after the day. The one that we want here is the day text option, which defines some formats for the day (there are equivalents for the month and the year).



The solution that would do (approximately) the same as the minimum width option would be:



matrix[column sep=1em, row sep=1em, day text = %d=]...


This makes the date printed in a constant width box. If you want days less than 10 prepended with a 0, you can use:



matrix[column sep=1em, row sep=1em, day text = %d0]...


With either solution, the filled regions are correct:




enter image description here




Full code:



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture% v---------------v Just added this
matrix[column sep=1em, row sep=1em, day text = %d0]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument





share|improve this answer






















  • Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
    – marmot
    4 mins ago










  • @PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
    – samcarter
    1 min ago

















up vote
1
down vote













Here is a rather clumsy way to fix it. The strategy is that, whenever a 1-digit node is used at the left, I mix its coordinate with the x coordinate of a 2-digit node in the same column. E.g. (m12-2018-12-03.north west) becomes (m12-2018-12-03.north -| m12-2018-12-10.west).



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north -|
m10-2018-10-29.west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north -|
m11-2018-11-26.west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north -|
m12-2018-12-10.west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north -|
m01-2019-01-14.west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


A simpler solution derives from the fact that anyway every other coordinate in your contour is unnecessary. So by making your code shorter you automatically fix the problem.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-07.north east)
|- (m10-2018-10-24.south east) |- (m10-2018-10-29.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-08.north west)
|- (m11-2018-11-04.north east) |- (m11-2018-11-23.south east)
|- (m11-2018-11-26.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-08.north west)
|- (m12-2018-12-02.north east) |- (m12-2018-12-24.south east) |- (m12-2018-12-31.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-08.north west)
|- (m01-2019-01-06.north east) |- (m01-2019-01-24.south east)
|- (m01-2019-01-28.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • requires enddocument
    – bkarpuz
    13 mins ago










  • @bkarpuz Yes, thanks, fixed.
    – marmot
    6 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453937%2ftikz-matrix-is-skewed%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote













The problem is that the first days make a narrower node than the last ones.



The TikZy way of doing this would be to require a minimum width for the nodes:



matrix[column sep=1em, row sep=1em, minimum width = 2em]...


this, of course, requires some trial-and-error to get the width right. No one likes that, right?



So browsing the code of tikzlibrarycalendar.code.tex I found that the calendar printing routine has some hooks before and after the day. The one that we want here is the day text option, which defines some formats for the day (there are equivalents for the month and the year).



The solution that would do (approximately) the same as the minimum width option would be:



matrix[column sep=1em, row sep=1em, day text = %d=]...


This makes the date printed in a constant width box. If you want days less than 10 prepended with a 0, you can use:



matrix[column sep=1em, row sep=1em, day text = %d0]...


With either solution, the filled regions are correct:




enter image description here




Full code:



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture% v---------------v Just added this
matrix[column sep=1em, row sep=1em, day text = %d0]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument





share|improve this answer






















  • Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
    – marmot
    4 mins ago










  • @PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
    – samcarter
    1 min ago














up vote
4
down vote













The problem is that the first days make a narrower node than the last ones.



The TikZy way of doing this would be to require a minimum width for the nodes:



matrix[column sep=1em, row sep=1em, minimum width = 2em]...


this, of course, requires some trial-and-error to get the width right. No one likes that, right?



So browsing the code of tikzlibrarycalendar.code.tex I found that the calendar printing routine has some hooks before and after the day. The one that we want here is the day text option, which defines some formats for the day (there are equivalents for the month and the year).



The solution that would do (approximately) the same as the minimum width option would be:



matrix[column sep=1em, row sep=1em, day text = %d=]...


This makes the date printed in a constant width box. If you want days less than 10 prepended with a 0, you can use:



matrix[column sep=1em, row sep=1em, day text = %d0]...


With either solution, the filled regions are correct:




enter image description here




Full code:



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture% v---------------v Just added this
matrix[column sep=1em, row sep=1em, day text = %d0]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument





share|improve this answer






















  • Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
    – marmot
    4 mins ago










  • @PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
    – samcarter
    1 min ago












up vote
4
down vote










up vote
4
down vote









The problem is that the first days make a narrower node than the last ones.



The TikZy way of doing this would be to require a minimum width for the nodes:



matrix[column sep=1em, row sep=1em, minimum width = 2em]...


this, of course, requires some trial-and-error to get the width right. No one likes that, right?



So browsing the code of tikzlibrarycalendar.code.tex I found that the calendar printing routine has some hooks before and after the day. The one that we want here is the day text option, which defines some formats for the day (there are equivalents for the month and the year).



The solution that would do (approximately) the same as the minimum width option would be:



matrix[column sep=1em, row sep=1em, day text = %d=]...


This makes the date printed in a constant width box. If you want days less than 10 prepended with a 0, you can use:



matrix[column sep=1em, row sep=1em, day text = %d0]...


With either solution, the filled regions are correct:




enter image description here




Full code:



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture% v---------------v Just added this
matrix[column sep=1em, row sep=1em, day text = %d0]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument





share|improve this answer














The problem is that the first days make a narrower node than the last ones.



The TikZy way of doing this would be to require a minimum width for the nodes:



matrix[column sep=1em, row sep=1em, minimum width = 2em]...


this, of course, requires some trial-and-error to get the width right. No one likes that, right?



So browsing the code of tikzlibrarycalendar.code.tex I found that the calendar printing routine has some hooks before and after the day. The one that we want here is the day text option, which defines some formats for the day (there are equivalents for the month and the year).



The solution that would do (approximately) the same as the minimum width option would be:



matrix[column sep=1em, row sep=1em, day text = %d=]...


This makes the date printed in a constant width box. If you want days less than 10 prepended with a 0, you can use:



matrix[column sep=1em, row sep=1em, day text = %d0]...


With either solution, the filled regions are correct:




enter image description here




Full code:



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar

begindocument

begintikzpicture% v---------------v Just added this
matrix[column sep=1em, row sep=1em, day text = %d0]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endtikzpicture

enddocument






share|improve this answer














share|improve this answer



share|improve this answer








edited 15 mins ago

























answered 23 mins ago









Phelype Oleinik

17.5k43771




17.5k43771











  • Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
    – marmot
    4 mins ago










  • @PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
    – samcarter
    1 min ago
















  • Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
    – marmot
    4 mins ago










  • @PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
    – samcarter
    1 min ago















Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
– marmot
4 mins ago




Note that every other coordinate is redundant (I also noticed that just now) if you switch to the -| and |- syntax instead of --.
– marmot
4 mins ago












@PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
– samcarter
1 min ago




@PhelypeOleinik Sorry for having the same idea for the ContinuedFloat question! I also have a second approach, if you would undelete your nice answer I can simply remove the part about ContinuedFloat from my answer.
– samcarter
1 min ago










up vote
1
down vote













Here is a rather clumsy way to fix it. The strategy is that, whenever a 1-digit node is used at the left, I mix its coordinate with the x coordinate of a 2-digit node in the same column. E.g. (m12-2018-12-03.north west) becomes (m12-2018-12-03.north -| m12-2018-12-10.west).



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north -|
m10-2018-10-29.west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north -|
m11-2018-11-26.west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north -|
m12-2018-12-10.west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north -|
m01-2019-01-14.west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


A simpler solution derives from the fact that anyway every other coordinate in your contour is unnecessary. So by making your code shorter you automatically fix the problem.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-07.north east)
|- (m10-2018-10-24.south east) |- (m10-2018-10-29.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-08.north west)
|- (m11-2018-11-04.north east) |- (m11-2018-11-23.south east)
|- (m11-2018-11-26.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-08.north west)
|- (m12-2018-12-02.north east) |- (m12-2018-12-24.south east) |- (m12-2018-12-31.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-08.north west)
|- (m01-2019-01-06.north east) |- (m01-2019-01-24.south east)
|- (m01-2019-01-28.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • requires enddocument
    – bkarpuz
    13 mins ago










  • @bkarpuz Yes, thanks, fixed.
    – marmot
    6 mins ago














up vote
1
down vote













Here is a rather clumsy way to fix it. The strategy is that, whenever a 1-digit node is used at the left, I mix its coordinate with the x coordinate of a 2-digit node in the same column. E.g. (m12-2018-12-03.north west) becomes (m12-2018-12-03.north -| m12-2018-12-10.west).



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north -|
m10-2018-10-29.west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north -|
m11-2018-11-26.west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north -|
m12-2018-12-10.west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north -|
m01-2019-01-14.west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


A simpler solution derives from the fact that anyway every other coordinate in your contour is unnecessary. So by making your code shorter you automatically fix the problem.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-07.north east)
|- (m10-2018-10-24.south east) |- (m10-2018-10-29.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-08.north west)
|- (m11-2018-11-04.north east) |- (m11-2018-11-23.south east)
|- (m11-2018-11-26.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-08.north west)
|- (m12-2018-12-02.north east) |- (m12-2018-12-24.south east) |- (m12-2018-12-31.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-08.north west)
|- (m01-2019-01-06.north east) |- (m01-2019-01-24.south east)
|- (m01-2019-01-28.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • requires enddocument
    – bkarpuz
    13 mins ago










  • @bkarpuz Yes, thanks, fixed.
    – marmot
    6 mins ago












up vote
1
down vote










up vote
1
down vote









Here is a rather clumsy way to fix it. The strategy is that, whenever a 1-digit node is used at the left, I mix its coordinate with the x coordinate of a 2-digit node in the same column. E.g. (m12-2018-12-03.north west) becomes (m12-2018-12-03.north -| m12-2018-12-10.west).



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north -|
m10-2018-10-29.west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north -|
m11-2018-11-26.west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north -|
m12-2018-12-10.west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north -|
m01-2019-01-14.west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


A simpler solution derives from the fact that anyway every other coordinate in your contour is unnecessary. So by making your code shorter you automatically fix the problem.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-07.north east)
|- (m10-2018-10-24.south east) |- (m10-2018-10-29.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-08.north west)
|- (m11-2018-11-04.north east) |- (m11-2018-11-23.south east)
|- (m11-2018-11-26.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-08.north west)
|- (m12-2018-12-02.north east) |- (m12-2018-12-24.south east) |- (m12-2018-12-31.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-08.north west)
|- (m01-2019-01-06.north east) |- (m01-2019-01-24.south east)
|- (m01-2019-01-28.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


enter image description here






share|improve this answer














Here is a rather clumsy way to fix it. The strategy is that, whenever a 1-digit node is used at the left, I mix its coordinate with the x coordinate of a 2-digit node in the same column. E.g. (m12-2018-12-03.north west) becomes (m12-2018-12-03.north -| m12-2018-12-10.west).



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-01.north -|
m10-2018-10-29.west) -- (m10-2018-10-07.north east)
-- (m10-2018-10-28.south east) -- (m10-2018-10-24.south east) -- (m10-2018-10-31.south east) -- (m10-2018-10-29.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-05.north -|
m11-2018-11-26.west) -- (m11-2018-11-08.north west) -- (m11-2018-11-01.north west)
-- (m11-2018-11-04.north east) -- (m11-2018-11-25.south east) -- (m11-2018-11-23.south east) -- (m11-2018-11-30.south east)
-- (m11-2018-11-26.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-03.north -|
m12-2018-12-10.west) -- (m12-2018-12-08.north west) -- (m12-2018-12-01.north west)
-- (m12-2018-12-02.north east) -- (m12-2018-12-30.south east) -- (m12-2018-12-24.south east) -- (m12-2018-12-31.south east)
-- (m12-2018-12-31.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-07.north -|
m01-2019-01-14.west) -- (m01-2019-01-08.north west) -- (m01-2019-01-01.north west)
-- (m01-2019-01-06.north east) -- (m01-2019-01-27.south east) -- (m01-2019-01-24.south east) -- (m01-2019-01-31.south east)
-- (m01-2019-01-28.south west)-- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


A simpler solution derives from the fact that anyway every other coordinate in your contour is unnecessary. So by making your code shorter you automatically fix the problem.



documentclass[10pt]standalone

usepackagetikz

usetikzlibrarycalendar,backgrounds

begindocument

begintikzpicture
matrix[column sep=1em, row sep=1em]
calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; \
calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; &
calendar (m04) [dates=2019-04-01 to 2019-04-last,week list,month label above centered]; \
;
beginscope[on background layer]
draw[red,thick,fill=orange,opacity=0.5] (m09-2018-09-17.north west) -- (m09-2018-09-23.north east)
-- (m09-2018-09-30.south east) -- (m09-2018-09-24.south west) -- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m10-2018-10-07.north east)
|- (m10-2018-10-24.south east) |- (m10-2018-10-29.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m11-2018-11-08.north west)
|- (m11-2018-11-04.north east) |- (m11-2018-11-23.south east)
|- (m11-2018-11-26.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m12-2018-12-08.north west)
|- (m12-2018-12-02.north east) |- (m12-2018-12-24.south east) |- (m12-2018-12-31.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m01-2019-01-08.north west)
|- (m01-2019-01-06.north east) |- (m01-2019-01-24.south east)
|- (m01-2019-01-28.south west) |- cycle;
draw[red,thick,fill=orange,opacity=0.5] (m02-2019-02-01.north west) -- (m02-2019-02-03.north east) -- (m02-2019-02-03.south east)
-- (m02-2019-02-01.south west)-- cycle;
endscope
endtikzpicture
enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 mins ago

























answered 27 mins ago









marmot

62.8k468135




62.8k468135











  • requires enddocument
    – bkarpuz
    13 mins ago










  • @bkarpuz Yes, thanks, fixed.
    – marmot
    6 mins ago
















  • requires enddocument
    – bkarpuz
    13 mins ago










  • @bkarpuz Yes, thanks, fixed.
    – marmot
    6 mins ago















requires enddocument
– bkarpuz
13 mins ago




requires enddocument
– bkarpuz
13 mins ago












@bkarpuz Yes, thanks, fixed.
– marmot
6 mins ago




@bkarpuz Yes, thanks, fixed.
– marmot
6 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453937%2ftikz-matrix-is-skewed%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery