Hey Ben,

Here is the code I am using to generate this plot, in addition to an
example input. It's basicaIlly a list of lists, where each inner list is a
time series. Plotting a 3D time series as a 3D surface rectangle is
probably a pretty common problem. It would be awesome if I didn't have to
switch to using rpy + ggplot or even worse, mlabwrap. Thank for any ideas
that anyone has!

def ThreeDSurfacePlot(list_of_lists):
    plt.clf()
    fig = plt.figure()
    list_of_lists = Smooth(list_of_lists)
    xs = numpy.arange(0,list_of_lists.shape[1],1)
    zs = numpy.arange(0,len(list_of_lists),1)
    ax = p3.Axes3D(fig)
    X = numpy.meshgrid(xs,zs)[0]
    Y = numpy.meshgrid(xs,zs)[1]
    Z = list_of_lists
    ax.plot_surface(X, Y, Z, cmap=cm.jet, cstride=1, rstride=1)
    ax.set_xlabel("Sequence Elements")
    ax.set_ylabel("Trial")
    ax.set_zlabel("Inter-Key-Interval")
    ax.set_xscale

    # Set up x ticks


    tick_locs_x = range(20)
    tick_lbls_x = ['d', 'j', 'k', 'f', 'j', 'd', 'f', 'k', 'd', 'f', 'k',
'j', 'd', 'f', 'k', 'f', 'j', 'd', 'k', 'j']
    plt.xticks(tick_locs_x, tick_lbls_x)

    # Set up y (or z?) ticks


    tick_locs_y = range(len(list_of_lists))
    tick_lbls_y = []

    for day in range(len(data["keylog"])):
        day_trial_ctr = 0
        for trial in range(len(data["keylog"][day])):
            if len(data["keylog"][day][trial]) == 20:
                if day_trial_ctr % 20 == 0:
                    tick_lbls_y.append("Day:" + str(day) + ", Trial: " +
str(day_trial_ctr))
                else:
                    tick_lbls_y.append("")

                    day_trial_ctr += 1

    plt.yticks(tick_locs_y, tick_lbls_y, fontsize=10)

    ax.auto_scale_xyz([0,20],[0,50],[0,1])
    ax.view_init(20,45)

    ax.axis('tight')
    plt.savefig(subject + "_3d_surface.png")

    if show: plt.show()

>>> print accurateseries[:3]
[[ 0.5         0.5         0.49699092  0.5         0.68226504  0.48422813
   0.42276716  0.46813011  0.42340088  0.40479589  0.41090202  0.31301808
   0.30782294  0.27784109  0.36982799  0.48932219  0.38784313  0.33056998
   0.40356588  0.32964206]
 [ 0.5         0.57195497  0.30683708  0.46926498  0.44043994  0.46917915
   0.32043695  0.41017413  0.40825605  0.28631306  0.40151811  0.31961489
   0.35328102  0.22550416  0.36752486  0.55106211  0.39073801  0.38961005
   0.36436582  0.34787703]
 [ 0.4480989   0.49201202  0.25450802  0.39503598  0.32998705  0.33187294
   0.35646415  0.36470699  0.3162992   0.28596401  0.39307094  0.4239881
   0.32525587  0.30294204  0.38540196  0.296211    0.35584903  0.31555796
   0.35734415  0.36554003]]


On Thu, Sep 20, 2012 at 7:46 PM, Benjamin Root <ben.r...@ou.edu> wrote:

>
>
> On Thursday, September 20, 2012, Brian J Mingus wrote:
>
>> Hi all,
>>
>> I have managed to create a 3d plot with uneven aspect ratio via
>> auto_scale_xyz but I haven't yet figured out how to fix the grid. If you
>> could give me a pointer I would appreciate it.
>>
>> http://imagebin.org/index.php?mode=image&id=229196
>>
>> Thanks,
>>
>>
> Brian,
>
> Just today, I submitted a PR that involved extensive fixes to autoscaling
> in mplot3d.  I don't have the PR number on me, but it should be easy to
> find on the github page.  While I don't think it will fix much for you, I
> would be interested to know if it breaks your code.
>
> As for your issues, it is hard to help out without a code sample to see
> how you got to where you are.  Did you happen to use my experimental
> daspect branch?
>
> Cheers!
> Ben Root
>
>>
>>


-- 
Brian Mingus
Graduate student
Computational Cognitive Neuroscience Lab
University of Colorado at Boulder
http://grey.colorado.edu/mingus
1-720-587-9482
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to