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














3












$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]


Sphere with arrow



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?










share|improve this question











$endgroup$
















    3












    $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]


    Sphere with arrow



    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?










    share|improve this question











    $endgroup$














      3












      3








      3


      1



      $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]


      Sphere with arrow



      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?










      share|improve this question











      $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]


      Sphere with arrow



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 8 hours ago







      David G. Stork

















      asked 8 hours ago









      David G. StorkDavid G. Stork

      25.2k22256




      25.2k22256




















          2 Answers
          2






          active

          oldest

          votes


















          2












          $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:



          Mathematica graphics



          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.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Bravo. Excellent solution ($checkmark$). I will use this a lot.
            $endgroup$
            – David G. Stork
            7 hours ago


















          2












          $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
          ]


          enter image description here



          However, the gap in the arrow does not scale with the length of the text or its font size.






          share|improve this answer









          $endgroup$













            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
            );



            );













            draft saved

            draft discarded


















            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









            2












            $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:



            Mathematica graphics



            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.






            share|improve this answer









            $endgroup$












            • $begingroup$
              Bravo. Excellent solution ($checkmark$). I will use this a lot.
              $endgroup$
              – David G. Stork
              7 hours ago















            2












            $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:



            Mathematica graphics



            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.






            share|improve this answer









            $endgroup$












            • $begingroup$
              Bravo. Excellent solution ($checkmark$). I will use this a lot.
              $endgroup$
              – David G. Stork
              7 hours ago













            2












            2








            2





            $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:



            Mathematica graphics



            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.






            share|improve this answer









            $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:



            Mathematica graphics



            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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
















            • $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











            2












            $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
            ]


            enter image description here



            However, the gap in the arrow does not scale with the length of the text or its font size.






            share|improve this answer









            $endgroup$

















              2












              $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
              ]


              enter image description here



              However, the gap in the arrow does not scale with the length of the text or its font size.






              share|improve this answer









              $endgroup$















                2












                2








                2





                $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
                ]


                enter image description here



                However, the gap in the arrow does not scale with the length of the text or its font size.






                share|improve this answer









                $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
                ]


                enter image description here



                However, the gap in the arrow does not scale with the length of the text or its font size.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 5 hours ago









                Henrik SchumacherHenrik Schumacher

                63.2k587176




                63.2k587176



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Log på Navigationsmenu

                    Creating second map without labels using QGIS?How to lock map labels for inset map in Print Composer?How to Force the Showing of Labels of a Vector File in QGISQGIS Valmiera, Labels only show for part of polygonsRemoving duplicate point labels in QGISLabeling every feature using QGIS?Show labels for point features outside map canvasAbbreviate Road Labels in QGIS only when requiredExporting map from composer in QGIS - text labels have moved in output?How to make sure labels in qgis turn up in layout map?Writing label expression with ArcMap and If then Statement?

                    Nuuk Indholdsfortegnelse Etyomologi | Historie | Geografi | Transport og infrastruktur | Politik og administration | Uddannelsesinstitutioner | Kultur | Venskabsbyer | Noter | Eksterne henvisninger | Se også | Navigationsmenuwww.sermersooq.gl64°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.75064°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.750DMI - KlimanormalerSalmonsen, s. 850Grønlands Naturinstitut undersøger rensdyr i Akia og Maniitsoq foråret 2008Grønlands NaturinstitutNy vej til Qinngorput indviet i dagAntallet af biler i Nuuk må begrænsesNy taxacentral mødt med demonstrationKøreplan. Rute 1, 2 og 3SnescootersporNuukNord er for storSkoler i Kommuneqarfik SermersooqAtuarfik Samuel KleinschmidtKangillinguit AtuarfiatNuussuup AtuarfiaNuuk Internationale FriskoleIlinniarfissuaq, Grønlands SeminariumLedelseÅrsberetning for 2008Kunst og arkitekturÅrsberetning for 2008Julie om naturenNuuk KunstmuseumSilamiutGrønlands Nationalmuseum og ArkivStatistisk ÅrbogGrønlands LandsbibliotekStore koncerter på stribeVandhund nummer 1.000.000Kommuneqarfik Sermersooq – MalikForsidenVenskabsbyerLyngby-Taarbæk i GrønlandArctic Business NetworkWinter Cities 2008 i NuukDagligt opdaterede satellitbilleder fra NuukområdetKommuneqarfik Sermersooqs hjemmesideTurist i NuukGrønlands Statistiks databankGrønlands Hjemmestyres valgresultaterrrWorldCat124325457671310-5