Specifying background color seen through semi-transparent surface
Can a British citizen living in France vote in both France and Britain in the European Elections?
Best material to absorb as much light as possible
Should one buy new hardware after a system compromise?
Count Even Digits In Number
Why most published works in medical imaging try reducing false positives?
The art of clickbait captions
First Match - awk
Popcorn is the only acceptable snack to consume while watching a movie
NIntegrate doesn't evaluate
How did NASA Langley end up with the first 737?
I know that there is a preselected candidate for a position to be filled at my department. What should I do?
Count rotary dial pulses in a phone number (including letters)
Parallel fifths in the orchestra
Can the product of any two aperiodic functions which are defined on the entire number line be periodic?
What is a fully qualified name?
Is there a simple example that empirical evidence is misleading?
Defining the standard model of PA so that a space alien could understand
Why did Jon Snow do this immoral act if he is so honorable?
Construct a word ladder
Is it possible to remotely hack the GPS system and disable GPS service worldwide?
How to respond to upset student?
Why isn't 'chemically-strengthened glass' made with potassium carbonate to begin with?
Website returning plaintext password
USPS Back Room - Trespassing?
Specifying background color seen through semi-transparent surface
$begingroup$
I would like to plot a Sphere with an arrow, in which the label obscures part of the arrow, as shown here:
Graphics3D[{Thickness[0.01],
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}],
Text[Style[Rotate["r", [Pi]/4], 32, Background -> Yellow],
{-1/(2 Sqrt[2]), 0, 1/(2 Sqrt[2])}],
Opacity[0.2], Yellow, Sphere[]},
ViewPoint -> {0, 10, 0}]
The problem is, of course, that the Background color for the letter is not correct, so the background rectangle of the letter is (inappropriately) visible. I could adjust this background color by hand to match as well as possible the color of the sphere. I've even tried specifying the background color itself with Opacity. Alternatively, I could create an arrow in two parts so there is no need for a background dropout for the letter. None of these approaches is particularly satisfactory in the general case (where the overlapping surface may have a gradient in color, or other problems).
Is there a way to plot what I seek?
background opacity
$endgroup$
add a comment |
$begingroup$
I would like to plot a Sphere with an arrow, in which the label obscures part of the arrow, as shown here:
Graphics3D[{Thickness[0.01],
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}],
Text[Style[Rotate["r", [Pi]/4], 32, Background -> Yellow],
{-1/(2 Sqrt[2]), 0, 1/(2 Sqrt[2])}],
Opacity[0.2], Yellow, Sphere[]},
ViewPoint -> {0, 10, 0}]
The problem is, of course, that the Background color for the letter is not correct, so the background rectangle of the letter is (inappropriately) visible. I could adjust this background color by hand to match as well as possible the color of the sphere. I've even tried specifying the background color itself with Opacity. Alternatively, I could create an arrow in two parts so there is no need for a background dropout for the letter. None of these approaches is particularly satisfactory in the general case (where the overlapping surface may have a gradient in color, or other problems).
Is there a way to plot what I seek?
background opacity
$endgroup$
add a comment |
$begingroup$
I would like to plot a Sphere with an arrow, in which the label obscures part of the arrow, as shown here:
Graphics3D[{Thickness[0.01],
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}],
Text[Style[Rotate["r", [Pi]/4], 32, Background -> Yellow],
{-1/(2 Sqrt[2]), 0, 1/(2 Sqrt[2])}],
Opacity[0.2], Yellow, Sphere[]},
ViewPoint -> {0, 10, 0}]
The problem is, of course, that the Background color for the letter is not correct, so the background rectangle of the letter is (inappropriately) visible. I could adjust this background color by hand to match as well as possible the color of the sphere. I've even tried specifying the background color itself with Opacity. Alternatively, I could create an arrow in two parts so there is no need for a background dropout for the letter. None of these approaches is particularly satisfactory in the general case (where the overlapping surface may have a gradient in color, or other problems).
Is there a way to plot what I seek?
background opacity
$endgroup$
I would like to plot a Sphere with an arrow, in which the label obscures part of the arrow, as shown here:
Graphics3D[{Thickness[0.01],
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}],
Text[Style[Rotate["r", [Pi]/4], 32, Background -> Yellow],
{-1/(2 Sqrt[2]), 0, 1/(2 Sqrt[2])}],
Opacity[0.2], Yellow, Sphere[]},
ViewPoint -> {0, 10, 0}]
The problem is, of course, that the Background color for the letter is not correct, so the background rectangle of the letter is (inappropriately) visible. I could adjust this background color by hand to match as well as possible the color of the sphere. I've even tried specifying the background color itself with Opacity. Alternatively, I could create an arrow in two parts so there is no need for a background dropout for the letter. None of these approaches is particularly satisfactory in the general case (where the overlapping surface may have a gradient in color, or other problems).
Is there a way to plot what I seek?
background opacity
background opacity
edited 7 hours ago
David G. Stork
asked 8 hours ago
David G. StorkDavid G. Stork
25.2k22256
25.2k22256
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Changing the last four lines in the graphics list to this:
Opacity[0.2],
Yellow,
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}, {0.35, 0.25}],
Sphere[]
Gives this:
The idea is that the arrow shaft is a tube, a 3D graphics primitive, so it will be colored similarly to the sphere since it will be subject to the same lighting. One problem is that if you move the graphics, the black will come through. I would rather expect the black to show through since the tube has opacity, but for some reason, it doesn't on my copy of Mathematica 12, until we move the graphics.
This idea cannot be extended to gradient surfaces, unfortunately.
$endgroup$
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
add a comment |
$begingroup$
Another possibility is to invent your own arrow primitive:
textarrow[{p_, q_}, text_, opts : OptionsPattern[]] :=
With[{t = 0.4},
{
Line[{p, (1 - t) p + t q}],
Arrow[{t p + (1 - t) q, q}],
Inset[Graphics[Text[text, {0, 0}, opts]], (p + q)/2]
}
];
Graphics3D[{
Thickness[0.01],
textarrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}},
Style[Rotate["r", [Pi]/4], 32]],
Opacity[0.6],
Yellow,
Specularity[White, 30],
Sphere[]
},
ViewPoint -> {0, 10, 0}
]
However, the gap in the arrow does not scale with the length of the text or its font size.
$endgroup$
add a comment |
Your Answer
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%2f198971%2fspecifying-background-color-seen-through-semi-transparent-surface%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
$begingroup$
Changing the last four lines in the graphics list to this:
Opacity[0.2],
Yellow,
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}, {0.35, 0.25}],
Sphere[]
Gives this:
The idea is that the arrow shaft is a tube, a 3D graphics primitive, so it will be colored similarly to the sphere since it will be subject to the same lighting. One problem is that if you move the graphics, the black will come through. I would rather expect the black to show through since the tube has opacity, but for some reason, it doesn't on my copy of Mathematica 12, until we move the graphics.
This idea cannot be extended to gradient surfaces, unfortunately.
$endgroup$
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
add a comment |
$begingroup$
Changing the last four lines in the graphics list to this:
Opacity[0.2],
Yellow,
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}, {0.35, 0.25}],
Sphere[]
Gives this:
The idea is that the arrow shaft is a tube, a 3D graphics primitive, so it will be colored similarly to the sphere since it will be subject to the same lighting. One problem is that if you move the graphics, the black will come through. I would rather expect the black to show through since the tube has opacity, but for some reason, it doesn't on my copy of Mathematica 12, until we move the graphics.
This idea cannot be extended to gradient surfaces, unfortunately.
$endgroup$
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
add a comment |
$begingroup$
Changing the last four lines in the graphics list to this:
Opacity[0.2],
Yellow,
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}, {0.35, 0.25}],
Sphere[]
Gives this:
The idea is that the arrow shaft is a tube, a 3D graphics primitive, so it will be colored similarly to the sphere since it will be subject to the same lighting. One problem is that if you move the graphics, the black will come through. I would rather expect the black to show through since the tube has opacity, but for some reason, it doesn't on my copy of Mathematica 12, until we move the graphics.
This idea cannot be extended to gradient surfaces, unfortunately.
$endgroup$
Changing the last four lines in the graphics list to this:
Opacity[0.2],
Yellow,
Arrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}}, {0.35, 0.25}],
Sphere[]
Gives this:
The idea is that the arrow shaft is a tube, a 3D graphics primitive, so it will be colored similarly to the sphere since it will be subject to the same lighting. One problem is that if you move the graphics, the black will come through. I would rather expect the black to show through since the tube has opacity, but for some reason, it doesn't on my copy of Mathematica 12, until we move the graphics.
This idea cannot be extended to gradient surfaces, unfortunately.
answered 6 hours ago
C. E.C. E.
52.2k3102209
52.2k3102209
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
add a comment |
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
6 hours ago
add a comment |
$begingroup$
Another possibility is to invent your own arrow primitive:
textarrow[{p_, q_}, text_, opts : OptionsPattern[]] :=
With[{t = 0.4},
{
Line[{p, (1 - t) p + t q}],
Arrow[{t p + (1 - t) q, q}],
Inset[Graphics[Text[text, {0, 0}, opts]], (p + q)/2]
}
];
Graphics3D[{
Thickness[0.01],
textarrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}},
Style[Rotate["r", [Pi]/4], 32]],
Opacity[0.6],
Yellow,
Specularity[White, 30],
Sphere[]
},
ViewPoint -> {0, 10, 0}
]
However, the gap in the arrow does not scale with the length of the text or its font size.
$endgroup$
add a comment |
$begingroup$
Another possibility is to invent your own arrow primitive:
textarrow[{p_, q_}, text_, opts : OptionsPattern[]] :=
With[{t = 0.4},
{
Line[{p, (1 - t) p + t q}],
Arrow[{t p + (1 - t) q, q}],
Inset[Graphics[Text[text, {0, 0}, opts]], (p + q)/2]
}
];
Graphics3D[{
Thickness[0.01],
textarrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}},
Style[Rotate["r", [Pi]/4], 32]],
Opacity[0.6],
Yellow,
Specularity[White, 30],
Sphere[]
},
ViewPoint -> {0, 10, 0}
]
However, the gap in the arrow does not scale with the length of the text or its font size.
$endgroup$
add a comment |
$begingroup$
Another possibility is to invent your own arrow primitive:
textarrow[{p_, q_}, text_, opts : OptionsPattern[]] :=
With[{t = 0.4},
{
Line[{p, (1 - t) p + t q}],
Arrow[{t p + (1 - t) q, q}],
Inset[Graphics[Text[text, {0, 0}, opts]], (p + q)/2]
}
];
Graphics3D[{
Thickness[0.01],
textarrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}},
Style[Rotate["r", [Pi]/4], 32]],
Opacity[0.6],
Yellow,
Specularity[White, 30],
Sphere[]
},
ViewPoint -> {0, 10, 0}
]
However, the gap in the arrow does not scale with the length of the text or its font size.
$endgroup$
Another possibility is to invent your own arrow primitive:
textarrow[{p_, q_}, text_, opts : OptionsPattern[]] :=
With[{t = 0.4},
{
Line[{p, (1 - t) p + t q}],
Arrow[{t p + (1 - t) q, q}],
Inset[Graphics[Text[text, {0, 0}, opts]], (p + q)/2]
}
];
Graphics3D[{
Thickness[0.01],
textarrow[{{0, 0, 0}, {-1/Sqrt[2], 0, 1/Sqrt[2]}},
Style[Rotate["r", [Pi]/4], 32]],
Opacity[0.6],
Yellow,
Specularity[White, 30],
Sphere[]
},
ViewPoint -> {0, 10, 0}
]
However, the gap in the arrow does not scale with the length of the text or its font size.
answered 5 hours ago
Henrik SchumacherHenrik Schumacher
63.2k587176
63.2k587176
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%2f198971%2fspecifying-background-color-seen-through-semi-transparent-surface%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