Changing Color in Coordinate Plot in Tikz
I want to change the color in alternates of red and blue. So far I only have:
documentclass{article}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}[scale=.8]
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [right] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [above] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
draw [red,thick,-] (start) to[out=-30,in=180] (1) to[out=0,in=180]
(2) to[out=0,in=110] (3) to[out=45,in=225] (end);
% show the points
foreach n in {start,1,2,3,end} fill [black] (n)
circle (2pt) node [below] {};
end{tikzpicture}
end{center}
end{document}
This outputs:
Any advice how to make the color alternative between red and blue with one color between each point?
tikz-pgf
add a comment |
I want to change the color in alternates of red and blue. So far I only have:
documentclass{article}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}[scale=.8]
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [right] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [above] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
draw [red,thick,-] (start) to[out=-30,in=180] (1) to[out=0,in=180]
(2) to[out=0,in=110] (3) to[out=45,in=225] (end);
% show the points
foreach n in {start,1,2,3,end} fill [black] (n)
circle (2pt) node [below] {};
end{tikzpicture}
end{center}
end{document}
This outputs:
Any advice how to make the color alternative between red and blue with one color between each point?
tikz-pgf
add a comment |
I want to change the color in alternates of red and blue. So far I only have:
documentclass{article}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}[scale=.8]
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [right] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [above] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
draw [red,thick,-] (start) to[out=-30,in=180] (1) to[out=0,in=180]
(2) to[out=0,in=110] (3) to[out=45,in=225] (end);
% show the points
foreach n in {start,1,2,3,end} fill [black] (n)
circle (2pt) node [below] {};
end{tikzpicture}
end{center}
end{document}
This outputs:
Any advice how to make the color alternative between red and blue with one color between each point?
tikz-pgf
I want to change the color in alternates of red and blue. So far I only have:
documentclass{article}
usepackage{tikz}
begin{document}
begin{center}
begin{tikzpicture}[scale=.8]
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [right] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [above] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
draw [red,thick,-] (start) to[out=-30,in=180] (1) to[out=0,in=180]
(2) to[out=0,in=110] (3) to[out=45,in=225] (end);
% show the points
foreach n in {start,1,2,3,end} fill [black] (n)
circle (2pt) node [below] {};
end{tikzpicture}
end{center}
end{document}
This outputs:
Any advice how to make the color alternative between red and blue with one color between each point?
tikz-pgf
tikz-pgf
asked Dec 27 '18 at 15:25
MathScholar
6508
6508
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Some improvements in the code.
standalone
class to produce a single draw.- You can
scope
the lines to set the line width once. - You don't need to insert
node
in the bullets.
black
is the default color, don't need to pass it tofill
.
documentclass[tikz,margin=2mm]{standalone}
begin{document}
begin{tikzpicture}
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [below] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [left] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
begin{scope}[thick]
draw [red] (start) to[out=-30,in=180] (1);
draw [red!60!blue] (1) to[out=0,in=180] (2);
draw [red!30!blue] (2) to[out=0,in=110] (3);
draw [blue] (3) to[out=45,in=225] (end);
end{scope}
% show the points
foreach n in {start,1,2,3,end}{%
fill (n) circle (2pt);
}
end{tikzpicture}
end{document}
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
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
});
}
});
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%2f467553%2fchanging-color-in-coordinate-plot-in-tikz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Some improvements in the code.
standalone
class to produce a single draw.- You can
scope
the lines to set the line width once. - You don't need to insert
node
in the bullets.
black
is the default color, don't need to pass it tofill
.
documentclass[tikz,margin=2mm]{standalone}
begin{document}
begin{tikzpicture}
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [below] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [left] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
begin{scope}[thick]
draw [red] (start) to[out=-30,in=180] (1);
draw [red!60!blue] (1) to[out=0,in=180] (2);
draw [red!30!blue] (2) to[out=0,in=110] (3);
draw [blue] (3) to[out=45,in=225] (end);
end{scope}
% show the points
foreach n in {start,1,2,3,end}{%
fill (n) circle (2pt);
}
end{tikzpicture}
end{document}
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
add a comment |
Some improvements in the code.
standalone
class to produce a single draw.- You can
scope
the lines to set the line width once. - You don't need to insert
node
in the bullets.
black
is the default color, don't need to pass it tofill
.
documentclass[tikz,margin=2mm]{standalone}
begin{document}
begin{tikzpicture}
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [below] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [left] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
begin{scope}[thick]
draw [red] (start) to[out=-30,in=180] (1);
draw [red!60!blue] (1) to[out=0,in=180] (2);
draw [red!30!blue] (2) to[out=0,in=110] (3);
draw [blue] (3) to[out=45,in=225] (end);
end{scope}
% show the points
foreach n in {start,1,2,3,end}{%
fill (n) circle (2pt);
}
end{tikzpicture}
end{document}
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
add a comment |
Some improvements in the code.
standalone
class to produce a single draw.- You can
scope
the lines to set the line width once. - You don't need to insert
node
in the bullets.
black
is the default color, don't need to pass it tofill
.
documentclass[tikz,margin=2mm]{standalone}
begin{document}
begin{tikzpicture}
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [below] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [left] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
begin{scope}[thick]
draw [red] (start) to[out=-30,in=180] (1);
draw [red!60!blue] (1) to[out=0,in=180] (2);
draw [red!30!blue] (2) to[out=0,in=110] (3);
draw [blue] (3) to[out=45,in=225] (end);
end{scope}
% show the points
foreach n in {start,1,2,3,end}{%
fill (n) circle (2pt);
}
end{tikzpicture}
end{document}
Some improvements in the code.
standalone
class to produce a single draw.- You can
scope
the lines to set the line width once. - You don't need to insert
node
in the bullets.
black
is the default color, don't need to pass it tofill
.
documentclass[tikz,margin=2mm]{standalone}
begin{document}
begin{tikzpicture}
% Axes
draw [-latex] (-1,0) -- (12,0) node (xaxis) [below] {$x$};
draw [-latex] (0,-1) -- (0,6.5) node [left] {$y$};
% Origin
node at (0,0) [below left] {$0$};
% Points
coordinate (start) at (1,1.5);
coordinate (1) at (3,.5);
coordinate (2) at (5.5,4.5);
coordinate (3) at (7.5,2.75);
coordinate (end) at (9,6);
% Plot
begin{scope}[thick]
draw [red] (start) to[out=-30,in=180] (1);
draw [red!60!blue] (1) to[out=0,in=180] (2);
draw [red!30!blue] (2) to[out=0,in=110] (3);
draw [blue] (3) to[out=45,in=225] (end);
end{scope}
% show the points
foreach n in {start,1,2,3,end}{%
fill (n) circle (2pt);
}
end{tikzpicture}
end{document}
edited Dec 27 '18 at 15:44
answered Dec 27 '18 at 15:40
Sigur
24k355137
24k355137
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
add a comment |
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
you broke it up in parts and then redefined the color. Thanks, for some reason I kept thinking that it wasn't possible.
– MathScholar
Dec 27 '18 at 15:44
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
@MathScholar, welcomed.
– Sigur
Dec 27 '18 at 15:49
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f467553%2fchanging-color-in-coordinate-plot-in-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