Drawing color tiles using TikzDrawing a Cube Using TikzBeginner: Drawing using Tikzdrawing a plane and orthonormal system using tikzDrawing a flag in Tikz!Drawing arrows using tikz libraryTikZ: Drawing an arc from an intersection to an intersectiondrawing a picture using tikzDrawing a Cylinder on a plane using tikzDrawing similar picture with tikzDrawing parabola shape using Tikz
Referring to different instances of the same character in time travel
What does "it kind of works out" mean?
Book where the stars go black due to aliens stopping human observation collapsing quantum possibilities
Can fluent English speakers distinguish “steel”, “still” and “steal”?
If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?
Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?
What are some examples of special things about Russian?
What's the maximum time an interrupt service routine can take to execute on atmega328p?
Cubic programming and beyond?
In Parshas Chukas, why is first mention of Parah Adumah "פָרָה" instead of "פָּרָה"?
Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?
Why would guns not work in the dungeon?
Are randomly-generated passwords starting with "a" less secure?
Why do Americans say "less than five people"?
How to achieve this rough borders and stippled illustration look?
For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?
How were Martello towers supposed to work?
How do Windows version numbers work?
Extract an attribute value from XML
What's an appropriate title for a person who deals with conflicts of an Empire?
Why isn't pressure filtration popular compared to vacuum filtration?
How can an advanced civilization forget how to manufacture its technology?
How can I deal with a player trying to insert real-world mythology into my homebrew setting?
Drawing color tiles using Tikz
Drawing color tiles using Tikz
Drawing a Cube Using TikzBeginner: Drawing using Tikzdrawing a plane and orthonormal system using tikzDrawing a flag in Tikz!Drawing arrows using tikz libraryTikZ: Drawing an arc from an intersection to an intersectiondrawing a picture using tikzDrawing a Cylinder on a plane using tikzDrawing similar picture with tikzDrawing parabola shape using Tikz
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Hi good people of StackExchange, I want to draw a colored tile using Tikz. Roughly to represent the percentage three kind of things have in comparison to their total. The picture I want can be produced using the following.
usepackagetikz
newcommandcolorTiles[1]
begintikzpicture
draw[ultra thick](0,0) rectangle (1,0.5);
draw[fill = red](0, 0) rectangle (0.3, 0.5);
draw[fill = green](0.3, 0) rectangle (0.7, 0.5);
draw[fill = purple](0.7, 0) rectangle(1, 0.5);
endtikzpicture
colorTiles
Now my question is, how can I define the new command so that I don't have to adjust the proportions every time? Ideally, I just need to use
colorTile0.3, 0.5, 0.2
And I should get a tile with 30% red, 50% green, and 20% purple. I'm not familiar with Tikz so please help me.
Thanks in advance!
tikz-pgf tikz-arrows technical-drawing tikz-graphdrawing
New contributor
add a comment |
Hi good people of StackExchange, I want to draw a colored tile using Tikz. Roughly to represent the percentage three kind of things have in comparison to their total. The picture I want can be produced using the following.
usepackagetikz
newcommandcolorTiles[1]
begintikzpicture
draw[ultra thick](0,0) rectangle (1,0.5);
draw[fill = red](0, 0) rectangle (0.3, 0.5);
draw[fill = green](0.3, 0) rectangle (0.7, 0.5);
draw[fill = purple](0.7, 0) rectangle(1, 0.5);
endtikzpicture
colorTiles
Now my question is, how can I define the new command so that I don't have to adjust the proportions every time? Ideally, I just need to use
colorTile0.3, 0.5, 0.2
And I should get a tile with 30% red, 50% green, and 20% purple. I'm not familiar with Tikz so please help me.
Thanks in advance!
tikz-pgf tikz-arrows technical-drawing tikz-graphdrawing
New contributor
add a comment |
Hi good people of StackExchange, I want to draw a colored tile using Tikz. Roughly to represent the percentage three kind of things have in comparison to their total. The picture I want can be produced using the following.
usepackagetikz
newcommandcolorTiles[1]
begintikzpicture
draw[ultra thick](0,0) rectangle (1,0.5);
draw[fill = red](0, 0) rectangle (0.3, 0.5);
draw[fill = green](0.3, 0) rectangle (0.7, 0.5);
draw[fill = purple](0.7, 0) rectangle(1, 0.5);
endtikzpicture
colorTiles
Now my question is, how can I define the new command so that I don't have to adjust the proportions every time? Ideally, I just need to use
colorTile0.3, 0.5, 0.2
And I should get a tile with 30% red, 50% green, and 20% purple. I'm not familiar with Tikz so please help me.
Thanks in advance!
tikz-pgf tikz-arrows technical-drawing tikz-graphdrawing
New contributor
Hi good people of StackExchange, I want to draw a colored tile using Tikz. Roughly to represent the percentage three kind of things have in comparison to their total. The picture I want can be produced using the following.
usepackagetikz
newcommandcolorTiles[1]
begintikzpicture
draw[ultra thick](0,0) rectangle (1,0.5);
draw[fill = red](0, 0) rectangle (0.3, 0.5);
draw[fill = green](0.3, 0) rectangle (0.7, 0.5);
draw[fill = purple](0.7, 0) rectangle(1, 0.5);
endtikzpicture
colorTiles
Now my question is, how can I define the new command so that I don't have to adjust the proportions every time? Ideally, I just need to use
colorTile0.3, 0.5, 0.2
And I should get a tile with 30% red, 50% green, and 20% purple. I'm not familiar with Tikz so please help me.
Thanks in advance!
tikz-pgf tikz-arrows technical-drawing tikz-graphdrawing
tikz-pgf tikz-arrows technical-drawing tikz-graphdrawing
New contributor
New contributor
New contributor
asked 8 hours ago
skyphantasyskyphantasy
333 bronze badges
333 bronze badges
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Welcome to TeX-SE! The following produces such bars. The syntax is as simple as
piccolor tile=0.3, 0.5, 0.2;
The colors are stored in a list and can be adjusted, as illustrated in the following example. The width is stored in a pgf key and can also be adjusted.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/color tile/.style=code=
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=5mm]
edefLstCols"red","green","purple","blue" %< adjust and extent if needed
path piccolor tile=0.3, 0.5, 0.2 (3,0) piccolor tile=0.3,0.6,0.4, 0.5;
edefLstCols"orange","purple","yellow","red","blue" %< adjusted and extended list
path (1,-2) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
tikzsetcolor tile/width=1cm
path (1,-4) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
endtikzpicture
enddocument
As for your comment on a command: here is a proposal.
documentclassarticle
usepackagetikz
tikzsetpics/color tile/.style=code=
edefLstColspgfkeysvalueof/tikz/color tile/colors
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=1em,
colors/.initial="red","green","purple","blue"
newcommandColorTile[2][]tikzpic[color tile/.cd,#1]color tile=#2;
begindocument
begintabularll
ColorTile0.3, 0.5, 0.2 & ABC \
ColorTile0.1, 0.2, 0.7 & UVW \
ColorTile[colors="red","green","blue"]0.3, 0.5, 0.2 & XYZ\
endtabular
enddocument
P.S. If you want to "stretch" the tile, usexscale
, e.g.path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.
– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
add a comment |
Answering this just in case someone would need it:
newcommandcolorTiles[3]
begintikzpicture
draw[ultra thick](0,0) rectangle (2,0.5);
draw[fill = red](0, 0) rectangle (#1 * 2, 0.5);
draw[fill = green](#1 * 2, 0) rectangle (#2 * 2 + #1 * 2, 0.5);
draw[fill = purple](#2 * 2 + #1 * 2, 0) rectangle(#3 * 2 + #2 * 2 + #1 * 2, 0.5);
draw[fill = gray](#3 * 2 + #2 * 2 + #1 * 2, 0) rectangle(2, 0.5);
endtikzpicture
Then we can put colorTiles0.20.50.1
inline.
New contributor
add a comment |
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
skyphantasy is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f499549%2fdrawing-color-tiles-using-tikz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Welcome to TeX-SE! The following produces such bars. The syntax is as simple as
piccolor tile=0.3, 0.5, 0.2;
The colors are stored in a list and can be adjusted, as illustrated in the following example. The width is stored in a pgf key and can also be adjusted.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/color tile/.style=code=
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=5mm]
edefLstCols"red","green","purple","blue" %< adjust and extent if needed
path piccolor tile=0.3, 0.5, 0.2 (3,0) piccolor tile=0.3,0.6,0.4, 0.5;
edefLstCols"orange","purple","yellow","red","blue" %< adjusted and extended list
path (1,-2) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
tikzsetcolor tile/width=1cm
path (1,-4) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
endtikzpicture
enddocument
As for your comment on a command: here is a proposal.
documentclassarticle
usepackagetikz
tikzsetpics/color tile/.style=code=
edefLstColspgfkeysvalueof/tikz/color tile/colors
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=1em,
colors/.initial="red","green","purple","blue"
newcommandColorTile[2][]tikzpic[color tile/.cd,#1]color tile=#2;
begindocument
begintabularll
ColorTile0.3, 0.5, 0.2 & ABC \
ColorTile0.1, 0.2, 0.7 & UVW \
ColorTile[colors="red","green","blue"]0.3, 0.5, 0.2 & XYZ\
endtabular
enddocument
P.S. If you want to "stretch" the tile, usexscale
, e.g.path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.
– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
add a comment |
Welcome to TeX-SE! The following produces such bars. The syntax is as simple as
piccolor tile=0.3, 0.5, 0.2;
The colors are stored in a list and can be adjusted, as illustrated in the following example. The width is stored in a pgf key and can also be adjusted.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/color tile/.style=code=
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=5mm]
edefLstCols"red","green","purple","blue" %< adjust and extent if needed
path piccolor tile=0.3, 0.5, 0.2 (3,0) piccolor tile=0.3,0.6,0.4, 0.5;
edefLstCols"orange","purple","yellow","red","blue" %< adjusted and extended list
path (1,-2) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
tikzsetcolor tile/width=1cm
path (1,-4) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
endtikzpicture
enddocument
As for your comment on a command: here is a proposal.
documentclassarticle
usepackagetikz
tikzsetpics/color tile/.style=code=
edefLstColspgfkeysvalueof/tikz/color tile/colors
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=1em,
colors/.initial="red","green","purple","blue"
newcommandColorTile[2][]tikzpic[color tile/.cd,#1]color tile=#2;
begindocument
begintabularll
ColorTile0.3, 0.5, 0.2 & ABC \
ColorTile0.1, 0.2, 0.7 & UVW \
ColorTile[colors="red","green","blue"]0.3, 0.5, 0.2 & XYZ\
endtabular
enddocument
P.S. If you want to "stretch" the tile, usexscale
, e.g.path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.
– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
add a comment |
Welcome to TeX-SE! The following produces such bars. The syntax is as simple as
piccolor tile=0.3, 0.5, 0.2;
The colors are stored in a list and can be adjusted, as illustrated in the following example. The width is stored in a pgf key and can also be adjusted.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/color tile/.style=code=
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=5mm]
edefLstCols"red","green","purple","blue" %< adjust and extent if needed
path piccolor tile=0.3, 0.5, 0.2 (3,0) piccolor tile=0.3,0.6,0.4, 0.5;
edefLstCols"orange","purple","yellow","red","blue" %< adjusted and extended list
path (1,-2) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
tikzsetcolor tile/width=1cm
path (1,-4) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
endtikzpicture
enddocument
As for your comment on a command: here is a proposal.
documentclassarticle
usepackagetikz
tikzsetpics/color tile/.style=code=
edefLstColspgfkeysvalueof/tikz/color tile/colors
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=1em,
colors/.initial="red","green","purple","blue"
newcommandColorTile[2][]tikzpic[color tile/.cd,#1]color tile=#2;
begindocument
begintabularll
ColorTile0.3, 0.5, 0.2 & ABC \
ColorTile0.1, 0.2, 0.7 & UVW \
ColorTile[colors="red","green","blue"]0.3, 0.5, 0.2 & XYZ\
endtabular
enddocument
Welcome to TeX-SE! The following produces such bars. The syntax is as simple as
piccolor tile=0.3, 0.5, 0.2;
The colors are stored in a list and can be adjusted, as illustrated in the following example. The width is stored in a pgf key and can also be adjusted.
documentclass[tikz,border=3.14mm]standalone
begindocument
begintikzpicture[pics/color tile/.style=code=
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=5mm]
edefLstCols"red","green","purple","blue" %< adjust and extent if needed
path piccolor tile=0.3, 0.5, 0.2 (3,0) piccolor tile=0.3,0.6,0.4, 0.5;
edefLstCols"orange","purple","yellow","red","blue" %< adjusted and extended list
path (1,-2) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
tikzsetcolor tile/width=1cm
path (1,-4) piccolor tile=0.3,0.6,0.4, 0.5,0.8;
endtikzpicture
enddocument
As for your comment on a command: here is a proposal.
documentclassarticle
usepackagetikz
tikzsetpics/color tile/.style=code=
edefLstColspgfkeysvalueof/tikz/color tile/colors
path (0,0) coordinate (aux);
foreach XX [count=YY starting from 0] in #1
pgfmathsetmacromycolLstCols[YY]
draw[line width=pgfkeysvalueof/tikz/color tile/width,color=mycol]
(aux) -- ++(XX,0) coordinate (aux);
draw[thick] (0,-pgfkeysvalueof/tikz/color tile/width/2) rectangle
(aux,color tile/.cd,width/.initial=1em,
colors/.initial="red","green","purple","blue"
newcommandColorTile[2][]tikzpic[color tile/.cd,#1]color tile=#2;
begindocument
begintabularll
ColorTile0.3, 0.5, 0.2 & ABC \
ColorTile0.1, 0.2, 0.7 & UVW \
ColorTile[colors="red","green","blue"]0.3, 0.5, 0.2 & XYZ\
endtabular
enddocument
edited 2 hours ago
answered 7 hours ago
marmotmarmot
144k6 gold badges187 silver badges346 bronze badges
144k6 gold badges187 silver badges346 bronze badges
P.S. If you want to "stretch" the tile, usexscale
, e.g.path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.
– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
add a comment |
P.S. If you want to "stretch" the tile, usexscale
, e.g.path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.
– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
P.S. If you want to "stretch" the tile, use
xscale
, e.g. path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.– marmot
7 hours ago
P.S. If you want to "stretch" the tile, use
xscale
, e.g. path pic[xscale=5]color tile=0.3,0.2,0.5;
. You can also rotate it etc.– marmot
7 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
Thanks a lot for the answer! Is it possible to use this inline with texts? In fact I was going to put these in tables. Can your answer be adapted for that? Thanks again!
– skyphantasy
5 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
@skyphantasy Of course, I added a proposal.
– marmot
2 hours ago
add a comment |
Answering this just in case someone would need it:
newcommandcolorTiles[3]
begintikzpicture
draw[ultra thick](0,0) rectangle (2,0.5);
draw[fill = red](0, 0) rectangle (#1 * 2, 0.5);
draw[fill = green](#1 * 2, 0) rectangle (#2 * 2 + #1 * 2, 0.5);
draw[fill = purple](#2 * 2 + #1 * 2, 0) rectangle(#3 * 2 + #2 * 2 + #1 * 2, 0.5);
draw[fill = gray](#3 * 2 + #2 * 2 + #1 * 2, 0) rectangle(2, 0.5);
endtikzpicture
Then we can put colorTiles0.20.50.1
inline.
New contributor
add a comment |
Answering this just in case someone would need it:
newcommandcolorTiles[3]
begintikzpicture
draw[ultra thick](0,0) rectangle (2,0.5);
draw[fill = red](0, 0) rectangle (#1 * 2, 0.5);
draw[fill = green](#1 * 2, 0) rectangle (#2 * 2 + #1 * 2, 0.5);
draw[fill = purple](#2 * 2 + #1 * 2, 0) rectangle(#3 * 2 + #2 * 2 + #1 * 2, 0.5);
draw[fill = gray](#3 * 2 + #2 * 2 + #1 * 2, 0) rectangle(2, 0.5);
endtikzpicture
Then we can put colorTiles0.20.50.1
inline.
New contributor
add a comment |
Answering this just in case someone would need it:
newcommandcolorTiles[3]
begintikzpicture
draw[ultra thick](0,0) rectangle (2,0.5);
draw[fill = red](0, 0) rectangle (#1 * 2, 0.5);
draw[fill = green](#1 * 2, 0) rectangle (#2 * 2 + #1 * 2, 0.5);
draw[fill = purple](#2 * 2 + #1 * 2, 0) rectangle(#3 * 2 + #2 * 2 + #1 * 2, 0.5);
draw[fill = gray](#3 * 2 + #2 * 2 + #1 * 2, 0) rectangle(2, 0.5);
endtikzpicture
Then we can put colorTiles0.20.50.1
inline.
New contributor
Answering this just in case someone would need it:
newcommandcolorTiles[3]
begintikzpicture
draw[ultra thick](0,0) rectangle (2,0.5);
draw[fill = red](0, 0) rectangle (#1 * 2, 0.5);
draw[fill = green](#1 * 2, 0) rectangle (#2 * 2 + #1 * 2, 0.5);
draw[fill = purple](#2 * 2 + #1 * 2, 0) rectangle(#3 * 2 + #2 * 2 + #1 * 2, 0.5);
draw[fill = gray](#3 * 2 + #2 * 2 + #1 * 2, 0) rectangle(2, 0.5);
endtikzpicture
Then we can put colorTiles0.20.50.1
inline.
New contributor
New contributor
answered 4 hours ago
skyphantasyskyphantasy
333 bronze badges
333 bronze badges
New contributor
New contributor
add a comment |
add a comment |
skyphantasy is a new contributor. Be nice, and check out our Code of Conduct.
skyphantasy is a new contributor. Be nice, and check out our Code of Conduct.
skyphantasy is a new contributor. Be nice, and check out our Code of Conduct.
skyphantasy is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f499549%2fdrawing-color-tiles-using-tikz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown