How to have a different style for edges of a triangleWhat is the precedence of FrameStyle, FrameTicksStyle,...
A dragon's soul trapped in a ring of mind shielding wants a new body; what magic could enable her to do so?
How to play song that contains one guitar when we have two guitarists (or more)?
Pictures from Mars
Can a rabbi conduct a marriage if the bride is already pregnant from the groom?
Fix some problems with a nice frame using tcolorbox
Which was the first story to feature helmets which reads your mind to control a machine?
Coworker is trying to get me to sign his petition to run for office. How to decline politely?
What happens to someone who dies before their clone has matured?
How bad is a Computer Science course that doesn't teach Design Patterns?
How can a kingdom keep the secret of a missing monarchy from the public?
Workplace intimidation due to child's chronic health condition
How should I ship cards?
Python 3.7 UltimateBruteforcer
Why did Shae (falsely) implicate Sansa?
Why is it a problem for Freddie if the guys from Munich did what he wanted?
Why would you use 2 alternate layout buttons instead of 1, when only one can be selected at once
Are there any rules or guidelines about the order of saving throws?
The totem pole can be grouped into
Would life expectancy increase if we replaced healthy organs with artificial ones?
Bitcoin automatically diverted to bech32 address
Tikz - highlight text in an image
Rigorous Geometric Proof That dA=rdrdθ?
Is there a technology capable of disabling the whole of Earth's satellitle network?
Identical projects by students at two different colleges: still plagiarism?
How to have a different style for edges of a triangle
What is the precedence of FrameStyle, FrameTicksStyle, and LabelStyle? How to have a LabelStyle different from FrameStyleHow can I display a multigraph with different colored edges?In version 9 PlotLegends, how can I remove the strange edges that appear around LegendMarkers?Assigning weights to edges of a hypercube based on the Gray code labels for vertices being connectedHow do I make the color of arrowheads in a graph different from the colors of the arrows?Specifying the style of edges in directed graphsStyling the edges of a graph according to the multiplicities of the edgesBarChart EdgeForm not producing correct colorsHow can I put a sign for “angle alpha 40°” into a Graphics[Triangle ..]] like in Mathworld “Triangle”?Setting graphics options back to default
$begingroup$
Consider the following triangle.
Graphics[{EdgeForm[Directive[Thick, Red]], Gray, Triangle[]}]
The EdgeForm is defining the edges style for all three edges of the triangle.
How can I give separate Directive for each edge of the Triangle.
graphics
$endgroup$
add a comment |
$begingroup$
Consider the following triangle.
Graphics[{EdgeForm[Directive[Thick, Red]], Gray, Triangle[]}]
The EdgeForm is defining the edges style for all three edges of the triangle.
How can I give separate Directive for each edge of the Triangle.
graphics
$endgroup$
1
$begingroup$
By usingLinefor each edge of the triangle separately.
$endgroup$
– Henrik Schumacher
6 hours ago
2
$begingroup$
You mean have three separateLineobjects that connect to give an illusion of aTriangle?
$endgroup$
– user13892
6 hours ago
1
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a trueTriangleobject with specifiedFaceFormandEdgeForm[None]; theLineobjects have to appear in the list afterwards (so that theLineobjects are plotted after theTriangleobject).
$endgroup$
– Henrik Schumacher
6 hours ago
add a comment |
$begingroup$
Consider the following triangle.
Graphics[{EdgeForm[Directive[Thick, Red]], Gray, Triangle[]}]
The EdgeForm is defining the edges style for all three edges of the triangle.
How can I give separate Directive for each edge of the Triangle.
graphics
$endgroup$
Consider the following triangle.
Graphics[{EdgeForm[Directive[Thick, Red]], Gray, Triangle[]}]
The EdgeForm is defining the edges style for all three edges of the triangle.
How can I give separate Directive for each edge of the Triangle.
graphics
graphics
asked 7 hours ago
user13892user13892
1,054514
1,054514
1
$begingroup$
By usingLinefor each edge of the triangle separately.
$endgroup$
– Henrik Schumacher
6 hours ago
2
$begingroup$
You mean have three separateLineobjects that connect to give an illusion of aTriangle?
$endgroup$
– user13892
6 hours ago
1
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a trueTriangleobject with specifiedFaceFormandEdgeForm[None]; theLineobjects have to appear in the list afterwards (so that theLineobjects are plotted after theTriangleobject).
$endgroup$
– Henrik Schumacher
6 hours ago
add a comment |
1
$begingroup$
By usingLinefor each edge of the triangle separately.
$endgroup$
– Henrik Schumacher
6 hours ago
2
$begingroup$
You mean have three separateLineobjects that connect to give an illusion of aTriangle?
$endgroup$
– user13892
6 hours ago
1
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a trueTriangleobject with specifiedFaceFormandEdgeForm[None]; theLineobjects have to appear in the list afterwards (so that theLineobjects are plotted after theTriangleobject).
$endgroup$
– Henrik Schumacher
6 hours ago
1
1
$begingroup$
By using
Line for each edge of the triangle separately.$endgroup$
– Henrik Schumacher
6 hours ago
$begingroup$
By using
Line for each edge of the triangle separately.$endgroup$
– Henrik Schumacher
6 hours ago
2
2
$begingroup$
You mean have three separate
Line objects that connect to give an illusion of a Triangle?$endgroup$
– user13892
6 hours ago
$begingroup$
You mean have three separate
Line objects that connect to give an illusion of a Triangle?$endgroup$
– user13892
6 hours ago
1
1
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a true
Triangle object with specified FaceForm and EdgeForm[None]; the Line objects have to appear in the list afterwards (so that the Line objects are plotted after the Triangle object).$endgroup$
– Henrik Schumacher
6 hours ago
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a true
Triangle object with specified FaceForm and EdgeForm[None]; the Line objects have to appear in the list afterwards (so that the Line objects are plotted after the Triangle object).$endgroup$
– Henrik Schumacher
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You can construct lines from the input Triangle and add them to your list of primitives in Graphics:
ClearAll[triangleToLines]
triangleToLines[Triangle[]] := Line /@ Partition[{{0, 0}, {1, 0}, {0, 1}, {0, 0}}, 2, 1]
triangleToLines[Triangle[a_]] := Line /@ Partition[Append[a, a[[1]]], 2, 1]
Examples:
Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[]] }]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
MapThread[# /. Line[x_] :> Line[x, VertexColors -> #2] &, {triangleToLines[
Triangle[]] , Partition[{Red, Green, Blue}, 2, 1, 1]}]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[{{0, 0}, {1, 1}, {2, 0}}],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[{{0, 0}, {1, 1}, {2, 0}}]] }]}]

t3d = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[{EdgeForm[Directive[Thick]], Gray, t3d,
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, Tube[#, .1] & @@@ triangleToLines[t3d] }]}]

$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
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%2fmathematica.stackexchange.com%2fquestions%2f191828%2fhow-to-have-a-different-style-for-edges-of-a-triangle%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
$begingroup$
You can construct lines from the input Triangle and add them to your list of primitives in Graphics:
ClearAll[triangleToLines]
triangleToLines[Triangle[]] := Line /@ Partition[{{0, 0}, {1, 0}, {0, 1}, {0, 0}}, 2, 1]
triangleToLines[Triangle[a_]] := Line /@ Partition[Append[a, a[[1]]], 2, 1]
Examples:
Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[]] }]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
MapThread[# /. Line[x_] :> Line[x, VertexColors -> #2] &, {triangleToLines[
Triangle[]] , Partition[{Red, Green, Blue}, 2, 1, 1]}]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[{{0, 0}, {1, 1}, {2, 0}}],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[{{0, 0}, {1, 1}, {2, 0}}]] }]}]

t3d = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[{EdgeForm[Directive[Thick]], Gray, t3d,
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, Tube[#, .1] & @@@ triangleToLines[t3d] }]}]

$endgroup$
add a comment |
$begingroup$
You can construct lines from the input Triangle and add them to your list of primitives in Graphics:
ClearAll[triangleToLines]
triangleToLines[Triangle[]] := Line /@ Partition[{{0, 0}, {1, 0}, {0, 1}, {0, 0}}, 2, 1]
triangleToLines[Triangle[a_]] := Line /@ Partition[Append[a, a[[1]]], 2, 1]
Examples:
Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[]] }]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
MapThread[# /. Line[x_] :> Line[x, VertexColors -> #2] &, {triangleToLines[
Triangle[]] , Partition[{Red, Green, Blue}, 2, 1, 1]}]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[{{0, 0}, {1, 1}, {2, 0}}],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[{{0, 0}, {1, 1}, {2, 0}}]] }]}]

t3d = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[{EdgeForm[Directive[Thick]], Gray, t3d,
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, Tube[#, .1] & @@@ triangleToLines[t3d] }]}]

$endgroup$
add a comment |
$begingroup$
You can construct lines from the input Triangle and add them to your list of primitives in Graphics:
ClearAll[triangleToLines]
triangleToLines[Triangle[]] := Line /@ Partition[{{0, 0}, {1, 0}, {0, 1}, {0, 0}}, 2, 1]
triangleToLines[Triangle[a_]] := Line /@ Partition[Append[a, a[[1]]], 2, 1]
Examples:
Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[]] }]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
MapThread[# /. Line[x_] :> Line[x, VertexColors -> #2] &, {triangleToLines[
Triangle[]] , Partition[{Red, Green, Blue}, 2, 1, 1]}]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[{{0, 0}, {1, 1}, {2, 0}}],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[{{0, 0}, {1, 1}, {2, 0}}]] }]}]

t3d = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[{EdgeForm[Directive[Thick]], Gray, t3d,
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, Tube[#, .1] & @@@ triangleToLines[t3d] }]}]

$endgroup$
You can construct lines from the input Triangle and add them to your list of primitives in Graphics:
ClearAll[triangleToLines]
triangleToLines[Triangle[]] := Line /@ Partition[{{0, 0}, {1, 0}, {0, 1}, {0, 0}}, 2, 1]
triangleToLines[Triangle[a_]] := Line /@ Partition[Append[a, a[[1]]], 2, 1]
Examples:
Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[]] }]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[],
Opacity[.5], CapForm["Round"], Thickness[.05],
MapThread[# /. Line[x_] :> Line[x, VertexColors -> #2] &, {triangleToLines[
Triangle[]] , Partition[{Red, Green, Blue}, 2, 1, 1]}]}]

Graphics[{EdgeForm[Directive[Thick]], Gray, Triangle[{{0, 0}, {1, 1}, {2, 0}}],
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, triangleToLines[Triangle[{{0, 0}, {1, 1}, {2, 0}}]] }]}]

t3d = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[{EdgeForm[Directive[Thick]], Gray, t3d,
Opacity[.5], CapForm["Round"], Thickness[.05],
Thread[{{Red, Green, Blue}, Tube[#, .1] & @@@ triangleToLines[t3d] }]}]

edited 5 hours ago
answered 5 hours ago
kglrkglr
184k10202420
184k10202420
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica 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.
Use MathJax to format equations. MathJax reference.
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%2fmathematica.stackexchange.com%2fquestions%2f191828%2fhow-to-have-a-different-style-for-edges-of-a-triangle%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
1
$begingroup$
By using
Linefor each edge of the triangle separately.$endgroup$
– Henrik Schumacher
6 hours ago
2
$begingroup$
You mean have three separate
Lineobjects that connect to give an illusion of aTriangle?$endgroup$
– user13892
6 hours ago
1
$begingroup$
Yes. And in order to obtain a filled triangle, you may use a true
Triangleobject with specifiedFaceFormandEdgeForm[None]; theLineobjects have to appear in the list afterwards (so that theLineobjects are plotted after theTriangleobject).$endgroup$
– Henrik Schumacher
6 hours ago