1

I'm having a conceptual problem with my data constraining boundary conditions for a wireframe plot in python. Could anyone explain to me where I have gone wrong?

I would like the boundaries to be constrained between -1.0 < x < 1.2, 0 < y < 0.25 and -0.6 < z < 0.2

    fig = plt.figure()

    ax = plt.subplot(111, projection='3d')

    def log_OIII_Hb_NII(log_NII_Ha, eps=0):
        return 1.19 + eps + 0.61 / (log_NII_Ha - eps - 0.47)
    def log_OIII_Hb_OI(log_OI_Ha, eps=0):
        return 1.33 + eps + 0.73 / (log_OI_Ha - eps + 0.59)
    def log_OIII_Hb_SII(log_SII_Ha, eps=0):
        return 1.30 + eps + 0.72 / (log_SII_Ha - eps - 0.32)

    NII = np.linspace(-2.0, 0.35)

    ax.set_xlim3d(-1.0, 1.2)
    ax.set_ylim3d( 0.0, 0.25)
    ax.set_zlim3d(-0.6, 0.2)

    ax.plot_wireframe(NII, 0, log_OIII_Hb_NII(NII))
    ax.plot_wireframe(NII, 0, log_OIII_Hb_NII(NII,  0.1))
    ax.plot_wireframe(NII, 0, log_OIII_Hb_NII(NII, -0.1))

    ax.plot_wireframe(NII, 0.1, log_OIII_Hb_NII(NII))
    ax.plot_wireframe(NII, 0.1, log_OIII_Hb_NII(NII,  0.1))
    ax.plot_wireframe(NII, 0.1, log_OIII_Hb_NII(NII, -0.1))

    ax.plot_wireframe(NII, 0.2, log_OIII_Hb_NII(NII))
    ax.plot_wireframe(NII, 0.2, log_OIII_Hb_NII(NII,  0.1))
    ax.plot_wireframe(NII, 0.2, log_OIII_Hb_NII(NII, -0.1))

    plt.show()

1 Answers1

0

If I interpret your question correct I think that you finding that using the ax.set_xlim3d only restricts the axis and not the actual data itself. This is contrary to what occurs with matplotlibs normal 2D plots where setting the limits also restricts the actual data that is displayed.

Here is an example:

enter image description here

On the left I restrict the data using ax1.set_xlim3d(0.0, 10.0) which limits the axes but not the actual data. On the right I restrict the actual data itself.

If this is your problem then how you fix it will depend what exactly NII, log_OIII_Hb_NII(NII),... is (if in future you can, provide some test data people can use) and how you generate it.

This post seems to contain a relevant method.

Community
  • 1
  • 1
Greg
  • 11,654
  • 3
  • 44
  • 50
  • Hey Greg. That is exactly the problem I am having. I have updated my first post to contain the information you feel you might need e.g. NII, log_OIII_Hb_NII etc... –  Jan 21 '14 at 14:40