Specifying background color seen through semi-transparent surface
Specific alignment within beginalign environment
My players want to grind XP but we're using milestone advancement
Is the Unsullied name meant to be ironic? How did it come to be?
How to ignore kerning of underbrace in math mode
How to reverse input order?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Can I tell a prospective employee that everyone in the team is leaving?
How to let other coworkers know that I don't share my coworker's political views?
Construct a word ladder
What was the idiom for something that we take without a doubt?
What is the function of the corrugations on a section of the Space Shuttle's external tank?
How to cut a climbing rope?
Who decides how to classify a novel?
In the 3D Zeldas, is it faster to roll or to simply walk?
Why aren't space telescopes put in GEO?
Defining the standard model of PA so that a space alien could understand
Should one buy new hardware after a system compromise?
Compaq Portable vs IBM 5155 Portable PC
My employer faked my resume to acquire projects
Why did Theresa May offer a vote on a second Brexit referendum?
Is the field of q-series 'dead'?
Is it legal to have an abortion in another state or abroad?
Count rotary dial pulses in a phone number (including letters)
Where have Brexit voters gone?
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 8 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
7 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
7 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
7 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 7 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
7 hours ago
add a comment |
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
7 hours ago
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
7 hours ago
$begingroup$
Bravo. Excellent solution ($checkmark$). I will use this a lot.
$endgroup$
– David G. Stork
7 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