Draw one function, varying color by (gradient) using another function's valueRotate a node but not its...
What kind of hardware implements Fourier transform?
In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?
We are very unlucky in my court
How to avoid Replace substituting subscripts?
Why zero tolerance on nudity in space?
Strange blocking on readable secondary after reboot
Cryptic with missing capitals
Citing paywalled articles accessed via illegal web sharing
How to prevent cleaner from hanging my lock screen in Ubuntu 16.04
Why doesn't "auto ch = unsigned char{'p'}" compile under C++ 17?
Which password policy is more secure: one password of length 9 vs. two passwords each of length 8?
Can an insurance company drop you after receiving a bill and refusing to pay?
Why is "points exist" not an axiom in geometry?
Why don't American passenger airlines still operate dedicated cargo flights?
A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?
What is this metal M-shaped device for?
Is there some relative to Dutch word "kijken" in German?
Why are the books in the Game of Thrones citadel library shelved spine inwards?
What makes the Forgotten Realms "forgotten"?
Is every normal subgroup the kernel of some self-homomorphism?
If I sold a PS4 game I owned the disc for, can I reinstall it digitally?
Cookies - Should the toggles be on?
Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?
What is the purpose of easy combat scenarios that don't need resource expenditure?
Draw one function, varying color by (gradient) using another function's value
Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?Sine function in pgfplots and MATLAB. Why are different results obtained?Compound Pathway Problem with holes
I'm trying to draw something in TikZ where I want to vary the draw color.
E.g. I'm drawing this line
documentclass[tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw plot[variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{tikzpicture}
end{document}
But now I want the color to indicate the value of a function, e.g. c = x2.
Edit:
With x2 this could then look like:
tikz-pgf color
add a comment |
I'm trying to draw something in TikZ where I want to vary the draw color.
E.g. I'm drawing this line
documentclass[tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw plot[variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{tikzpicture}
end{document}
But now I want the color to indicate the value of a function, e.g. c = x2.
Edit:
With x2 this could then look like:
tikz-pgf color
add a comment |
I'm trying to draw something in TikZ where I want to vary the draw color.
E.g. I'm drawing this line
documentclass[tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw plot[variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{tikzpicture}
end{document}
But now I want the color to indicate the value of a function, e.g. c = x2.
Edit:
With x2 this could then look like:
tikz-pgf color
I'm trying to draw something in TikZ where I want to vary the draw color.
E.g. I'm drawing this line
documentclass[tikz]{standalone}
usetikzlibrary{intersections}
begin{document}
begin{tikzpicture}
draw plot[variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{tikzpicture}
end{document}
But now I want the color to indicate the value of a function, e.g. c = x2.
Edit:
With x2 this could then look like:
tikz-pgf color
tikz-pgf color
edited 3 hours ago
sheß
asked 4 hours ago
sheßsheß
1,73311328
1,73311328
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Something like this may be:
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
I just changed the draw
environment with addplot
within an axis
environment. This will give you:
Update Fix with colormaps
. By utilising the colormaps
tikz library you can set the desired color map and obtain what you desire. As in:
documentclass[tikz]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{colormaps}
% Note that this is the colormap definition. You can play with this however you want. Fun fact: this color map also includes 8bit color code definition. Which can be defined using rgb255 = {value,value,value}.
pgfplotsset{colormap={CM}{rgb=(0,0,1) color=(red) rgb=(0,0,1)}}
begin{document}
begin{tikzpicture}
begin{axis}[point meta = y, colormap name={CM}]
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
which will give you:
Update Credits goes to @marmot
.
You can an inline function in point meta
definition to customise your colormap implicitly using an explicit function (see @marmot's comments).
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[ colormap/hot] addplot [point meta = x*x*x,mesh, samples=100,domain=-10:10] {sin(deg(x))+0.6*x};
end{axis}
end{tikzpicture}
end{document}
Here, I used cubic function for manipulating the color map. This will give
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
@sheß OOps, in that case, I will wait for some our in houseTikZperts
to answer your question ;)
– Raaja
3 hours ago
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
|
show 6 more comments
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%2f477270%2fdraw-one-function-varying-color-by-gradient-using-another-functions-value%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
Something like this may be:
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
I just changed the draw
environment with addplot
within an axis
environment. This will give you:
Update Fix with colormaps
. By utilising the colormaps
tikz library you can set the desired color map and obtain what you desire. As in:
documentclass[tikz]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{colormaps}
% Note that this is the colormap definition. You can play with this however you want. Fun fact: this color map also includes 8bit color code definition. Which can be defined using rgb255 = {value,value,value}.
pgfplotsset{colormap={CM}{rgb=(0,0,1) color=(red) rgb=(0,0,1)}}
begin{document}
begin{tikzpicture}
begin{axis}[point meta = y, colormap name={CM}]
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
which will give you:
Update Credits goes to @marmot
.
You can an inline function in point meta
definition to customise your colormap implicitly using an explicit function (see @marmot's comments).
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[ colormap/hot] addplot [point meta = x*x*x,mesh, samples=100,domain=-10:10] {sin(deg(x))+0.6*x};
end{axis}
end{tikzpicture}
end{document}
Here, I used cubic function for manipulating the color map. This will give
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
@sheß OOps, in that case, I will wait for some our in houseTikZperts
to answer your question ;)
– Raaja
3 hours ago
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
|
show 6 more comments
Something like this may be:
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
I just changed the draw
environment with addplot
within an axis
environment. This will give you:
Update Fix with colormaps
. By utilising the colormaps
tikz library you can set the desired color map and obtain what you desire. As in:
documentclass[tikz]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{colormaps}
% Note that this is the colormap definition. You can play with this however you want. Fun fact: this color map also includes 8bit color code definition. Which can be defined using rgb255 = {value,value,value}.
pgfplotsset{colormap={CM}{rgb=(0,0,1) color=(red) rgb=(0,0,1)}}
begin{document}
begin{tikzpicture}
begin{axis}[point meta = y, colormap name={CM}]
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
which will give you:
Update Credits goes to @marmot
.
You can an inline function in point meta
definition to customise your colormap implicitly using an explicit function (see @marmot's comments).
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[ colormap/hot] addplot [point meta = x*x*x,mesh, samples=100,domain=-10:10] {sin(deg(x))+0.6*x};
end{axis}
end{tikzpicture}
end{document}
Here, I used cubic function for manipulating the color map. This will give
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
@sheß OOps, in that case, I will wait for some our in houseTikZperts
to answer your question ;)
– Raaja
3 hours ago
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
|
show 6 more comments
Something like this may be:
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
I just changed the draw
environment with addplot
within an axis
environment. This will give you:
Update Fix with colormaps
. By utilising the colormaps
tikz library you can set the desired color map and obtain what you desire. As in:
documentclass[tikz]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{colormaps}
% Note that this is the colormap definition. You can play with this however you want. Fun fact: this color map also includes 8bit color code definition. Which can be defined using rgb255 = {value,value,value}.
pgfplotsset{colormap={CM}{rgb=(0,0,1) color=(red) rgb=(0,0,1)}}
begin{document}
begin{tikzpicture}
begin{axis}[point meta = y, colormap name={CM}]
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
which will give you:
Update Credits goes to @marmot
.
You can an inline function in point meta
definition to customise your colormap implicitly using an explicit function (see @marmot's comments).
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[ colormap/hot] addplot [point meta = x*x*x,mesh, samples=100,domain=-10:10] {sin(deg(x))+0.6*x};
end{axis}
end{tikzpicture}
end{document}
Here, I used cubic function for manipulating the color map. This will give
Something like this may be:
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
I just changed the draw
environment with addplot
within an axis
environment. This will give you:
Update Fix with colormaps
. By utilising the colormaps
tikz library you can set the desired color map and obtain what you desire. As in:
documentclass[tikz]{standalone}
usepackage{pgfplots}
usepgfplotslibrary{colormaps}
% Note that this is the colormap definition. You can play with this however you want. Fun fact: this color map also includes 8bit color code definition. Which can be defined using rgb255 = {value,value,value}.
pgfplotsset{colormap={CM}{rgb=(0,0,1) color=(red) rgb=(0,0,1)}}
begin{document}
begin{tikzpicture}
begin{axis}[point meta = y, colormap name={CM}]
addplot [mesh, variable=x, samples=100,domain=-10:10] ({x},{sin(deg(x))+0.6*x});
end{axis}
end{tikzpicture}
end{document}
which will give you:
Update Credits goes to @marmot
.
You can an inline function in point meta
definition to customise your colormap implicitly using an explicit function (see @marmot's comments).
documentclass[tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[ colormap/hot] addplot [point meta = x*x*x,mesh, samples=100,domain=-10:10] {sin(deg(x))+0.6*x};
end{axis}
end{tikzpicture}
end{document}
Here, I used cubic function for manipulating the color map. This will give
edited 45 mins ago
answered 4 hours ago
RaajaRaaja
4,28121138
4,28121138
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
@sheß OOps, in that case, I will wait for some our in houseTikZperts
to answer your question ;)
– Raaja
3 hours ago
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
|
show 6 more comments
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
@sheß OOps, in that case, I will wait for some our in houseTikZperts
to answer your question ;)
– Raaja
3 hours ago
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
2
2
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
Thanks, but I think this misses the bit that the color gradient should depict this a function, (in my question i used the example of x^2)
– sheß
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
@sheß Nice that it is close, but could you please explain me the last part? I will try to help you with that :) may be you can draw a small rough sketch on what you would like to get out of it?
– Raaja
3 hours ago
1
1
clear thanks I will try to cook up something
– Raaja
3 hours ago
clear thanks I will try to cook up something
– Raaja
3 hours ago
1
1
@sheß OOps, in that case, I will wait for some our in house
TikZperts
to answer your question ;)– Raaja
3 hours ago
@sheß OOps, in that case, I will wait for some our in house
TikZperts
to answer your question ;)– Raaja
3 hours ago
1
1
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
Done adding, lately, falcons are going well together with @marmot.
– Raaja
44 mins ago
|
show 6 more comments
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%2f477270%2fdraw-one-function-varying-color-by-gradient-using-another-functions-value%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