Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to make a filled Ellipsoid, but it seems Filling options doesn't work in Graphics options. I have a matrix

matrix1={{1,4},{6,8}}

thus I plot en ellipse from his Eigenvalues and Eigenvectors

valmat = Eigenvalues@matrix1;
vecmat = Eigenvectors@matrix1;
pair = {0.5, 0.5}
ellips1 = 
Ellipsoid[pair, {Abs[valmat[[1]]], Abs[valmat[[2]]]}, {vecmat[[1]], vecmat[[2]]}];
plot1 = Graphics[{Red, ellips1}, GridLines -> Automatic, 
GridLinesStyle -> Directive[Gray, Dotted]];
partot1 = 
Show[plot1, Frame -> True, 
FrameLabel -> {Style["x", 18], Style["y", 18]}, AspectRatio -> 1, 
FrameTicks -> {Automatic, Automatic, None, None}, 
LabelStyle -> Directive[13], ImageSize -> 500]

enter image description here

The question is how to filled this ellipse with an specific color??..and also (if it's possible) the transparency on that. Thanks

share|improve this question
    
What's Ellipsoid, what pacage is required? –  Kuba Sep 20 '13 at 13:38
    
@Kuba Needs["MultivariateStatistics`"] –  ybeltukov Sep 20 '13 at 13:38
1  
Perhaps use Disk? –  bobthechemist Sep 20 '13 at 13:39
    
Use a disk, scale the axis and rotate. –  rm -rf Sep 20 '13 at 13:40
2  
Also, ellipsoid is a graphics, so you need to use faceform/edgeform. See this answer where I use an ellipsoid. –  rm -rf Sep 20 '13 at 13:42

1 Answer 1

up vote 8 down vote accepted

If there is nothing else:

partot1 /. Line -> Polygon

enter image description here

partot1 /. Line[x_] -> {Green, EdgeForm@Thick, FaceForm[Opacity@.5], Polygon[x]}

enter image description here


Fortunatelly Elipsoid is not ReadProtected so you can use ?? to se the UpValues related to it. (I suggest to Ctrl+F and replace/delete all contexts: MultivariateStatistics`Private so the code will be transparent)

Really quick and not elegant fix for 2d case:

style[opts__, x_Ellipsoid] := Graphics[x] /. Line[y_] :> {opts, Polygon[y]} // First

ellips1 = Ellipsoid[{0.5`, 0.5`}, {10., 1.52}, {{0.4, 1.}, {-1.58, 1.}}];

Graphics[{
          style[Red, ellips1],
          Rotate[style[Green, EdgeForm@Thick, Opacity@.5, ellips1]
                 , Pi/2]
         }, Frame -> True ]

You can use ?? like I said before to create more general solution, unfortunatelly I'm run out of time now :/. Good luck.

enter image description here

share|improve this answer
    
@AlejandroGuarnizo I'm glad you like it. It is good habit to hold on with an accept a little bit. It can discourage otheres. Here for example might be some easy fix I don't know because I'm not familiar with this package :) –  Kuba Sep 20 '13 at 14:00
    
Thanks @Kuba for your answer, it works. But now I have other one. What if instead one ellipse, I have two. It seems there is no way to show somehow one behind the other? –  Alejandro Guarnizo Sep 20 '13 at 14:06
    
@AlejandroGuarnizo The overlap problem is much harder and has been discussed a number of time in this site. A quick search shows this mathematica.stackexchange.com/questions/28997/…. Id suggest if you cant find a satisfactory existing answer you should post that as a new question. –  george2079 Sep 20 '13 at 14:27
    
another link: mathematica.stackexchange.com/questions/11146/… –  george2079 Sep 20 '13 at 14:32
    
@AlejandroGuarnizo Take a look at my edit, does it work for you? –  Kuba Sep 20 '13 at 19:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.