Placing axis origin at origin for 3D plots

Discussion in 'Mathematica' started by chuck009, Aug 30, 2007.

  1. chuck009

    chuck009 Guest

    Hello guys,

    I'd like to place the axis origin for some of my 3D plots at the origin but do not see a nice way how to do this. I can manually create some lines but then I won't have the tic marks and axis labels support that goes with the standard axes. The code below does what I feel is a poor job of making axes and again, I didn't go through the effort of manually creating tic marks and labels. Can anyone help?

    axes = Graphics3D[{{Thickness[0.004],
    Line[{{-4.5, 0, 0}, {4.5, 0, 0}}]},
    {Thickness[0.004], Line[{{0, -4, 0}, {0, 4, 0}}]},
    {Thickness[0.004], Line[{{0, 0, -5}, {0, 0, 2}}]},
    Text[StyleForm["x", FontSize -> 18, FontWeight -> "Heavy"],
    {4.5, 0, 0}], Text[StyleForm["-y", FontSize -> 18,
    FontWeight -> "Heavy"], {0, -4.5, 0}],
    Text[StyleForm["y", FontSize -> 18, FontWeight -> "Heavy"],
    {0, 4.5, 0}], Text[StyleForm["-z", FontSize -> 18,
    FontWeight -> "Heavy"], {0, 0, -4.5}],
    Text[StyleForm["z", FontSize -> 18, FontWeight -> "Heavy"],
    {0, 0, 2.5}], Text[StyleForm["-x", FontSize -> 18,
    FontWeight -> "Heavy"], {-4.5, 0, 0}]}];
    Show[{Plot3D[Sin[x], {x, -5, 5}, {y, -5, 5}, Axes -> False,
    Boxed -> False], axes}, PlotRange -> All]
     
    chuck009, Aug 30, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.