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.

Two Part Question

Part 1: As you can see from the data and plot below, the plot does not accurately display the data sets but adds lines beyond and in different dimensions. Both u and v datasets are in {0,1} range, but v doesn't plot correctly. Why this strange behavior? What did I miss here?

Part 2: How can I fill the lines to the Axis to make a 3D form from the correctly plotted lines making a more elegant looking plot? Thanks!

u = {{0, -0.44331262664448756`}, {0.0196`, -0.9779703843580401`},{0.0392`, -0.761419676160835`}, 
{0.0588`, -0.7410082141786067`},{0.0784`, -1.1337733424705565`}, {0.102`, -1.0486362396635585`},
{0.149`, -0.2251024797836343`}, {0.2`, -1.2871097065127457`},{0.251`, -0.9511305495415456`}, 
{0.302`, -0.8164066459261932`},{0.349`, -0.7856901292758733`}, {0.4`, -0.8996334304312015`},
{0.451`, -0.6566406380705825`}, {0.498`, -0.27392146117227734`},{0.549`, -0.2943716563989507`},
{0.6`, -0.005103507205728164`}, {0.651`, 0.1514427552803399`}, {0.698`, 0.5919523857004505`}, 
{0.749`, 1.485852053899006`}, {0.8`, 1.1930387245891183`}, {0.851`, 0.771890328176178`}, 
{0.898`, 0.13245346840587424`}, {0.949`, -0.06005129796635145`}, {0.9804`,-0.6909201620317884`},
 {1, -2.886054510422592`}};

v = {{0, 1.7277993371975775`}, {0.0196`,0.7046147676309067`}, {0.0392`,-0.14324752873255964`}, 
{0.0588`,-0.278024151638645`}, {0.0784`, -0.2257145006115291`}, {0.102`,-0.8323709054502082`}, 
{0.149`, -0.0840232633295912`}, {0.2`,-0.8432031344867141`}, {0.251`, -1.052961606965508`}, 
{0.302`,-1.0016400464038844`}, {0.349`, -0.47166441886878907`}, {0.4`,-0.5634900663427977`}, 
{0.451`, -0.8219157180967107`}, {0.498`,-0.599958880780993`}, {0.549`, -0.1889940612199048`}, 
{0.6`,-0.3952379660987937`}, {0.651`, -0.26706893123602526`}, {0.698`,0.5833238256280904`},
 {0.749`, 0.9884089479900493`}, {0.8`, 0.721317446974723`}, {0.851`,-0.07891186493267366`}, 
{0.898`, -1.202139489716314`}, {0.949`, -1.4943329078699996`}, {0.9804`,-2.3465771005766967`}, 
{1, -2.852635384504043`}};

results = ListPointPlot3D[{v /. {x_, y_} :> {x, y, 0}, u}, PlotStyle -> {Blue, Orange},AxesOrigin -> 
{0, 0, 0}, Boxed -> True, BoxRatios -> {1, 1}, Ticks -> Automatic, AxesStyle -> Black, 
PlotRange -> All, ImageSize -> 280] /. Point -> Line

3D Plot Error

share|improve this question

1 Answer 1

up vote 5 down vote accepted

What you are plotting is:

 v /. {x_, y_} :> {x, y, 0}, u}

If you look at this, it is a collection of points in 3D followed by a collection of points in 2D. You need o have purely a list of 3D points in order for ListPointPlot3D to work. For example,

{v /. {x_, y_} :> {x, y, 0}, u /. {x_, y_} :> {x, y, 1}}

will work fine, putting v on one plane and u on another.

enter image description here

But looking back, maybe what you are after is to take the first two coordinates from v and the third from u? If so, you can do that by plotting

q = Table[{v[[i, 1]], v[[i, 2]], u[[i, 2]]}, {i, 1, Length[v]}];

which gives a nice squiggle

enter image description here

But in any case, the point is that you have to plot a list of 3D points in order to make use of ListPointPlot3D. In the comments, the OP gave a link to the kind of plot he wanted. Here is how to do exactly that same thing here, and I've even added in part 2 about how to get the filling:

results =  ListPointPlot3D[{v /. {x_?NumericQ, y_?NumericQ} :> {x, y, 0}, 
                u /. {x_?NumericQ, y_?NumericQ} :> {x, 0, y}}, 
         PlotStyle -> {Blue, Orange}, Filling -> Axis, 
         AxesOrigin -> {0, 0, 0}, Boxed -> True, BoxRatios -> {1, 1}, 
         Ticks -> Automatic, AxesStyle -> Black, PlotRange -> All, 
         ImageSize -> 280] /. Point -> Line

This time it looks like this:

enter image description here

share|improve this answer
    
Thanks for the solution although it's not quite what I'm after. My implementation is based on the answer to this question: mathematica.stackexchange.com/questions/23362/… Where this type of plot actually does work well. In fact it does work when combined with a second plot in Show[] but not individually. –  R Hall May 16 '13 at 18:43
    
In that reference, the data has the form of 3-tuples. The data you are trying to plot does not have that form. That's why it fails. –  bill s May 16 '13 at 19:23
    
ah I see that now! Thanks! –  R Hall May 16 '13 at 19:55
    
How do I fill both lines? –  R Hall May 16 '13 at 22:11
    
There might be a slick way, but here's what I'd do: graph a third function that is just the axis you want to fill to. Then you can fill from object i to object p (see Details section in the Filling help). This provides a completely general solution. –  bill s May 17 '13 at 5:28

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.