# Plotting Surface Graph from Excel Data Import to Mathematica [duplicate]

I am trying to make a surface graph on Mathematica using Excel Data. My x-axis should be the "A" Column and my y-axis should be the "1" Row. The box of data in between the x-axis and the y-axis should be my z-values. I'm not familiar with data importing Excel data to make these types of 3-D graphs. I was wondering if someone could help me out? Thanks!

• Have you tried Import[]? What did you get? What problems did you find? Please try that your questions here don't resemble a "please do that for me" thing. – Dr. belisarius Dec 10 '13 at 4:43
• Tried Import[], got nothing. "File not found during import." If you're unwilling to help, can you at least point me towards the right direction? I am not an experienced Mathematica user. – user11063 Dec 10 '13 at 4:58
• I am trying to do that. Store your Excel file on the root directory of your local disk and execute in Mathematica Import["c:\\test.xlsx"] – Dr. belisarius Dec 10 '13 at 5:26
• Trying to use mathematica just to do one plot is useless, as the learning curve is too steep. Care to do it only if you plan to use Mathematica for a long time – Dr. belisarius Dec 10 '13 at 5:29
• – Yves Klett Dec 10 '13 at 8:02

Given an excel file that resides in the same directory as your notebook you import the data with

data = Import[NotebookDirectory[] <> "data.xls"][[1]]


where "[[1]]" selects the first excel sheet.

Then you check the dimensions of your data

dims = Dimensions[data]

{25, 9}


and extract the values for the axes.

axisx = Transpose[data][[1]][[2 ;; dims[[1]]]]

{-2.4*10^-6, -2.36*10^-6, -2.32*10^-6, -2.28*10^-6, -2.24*10^-6, \
-2.2*10^-6, -2.16*10^-6, -2.12*10^-6, -2.08*10^-6, -2.04*10^-6, \
-2.*10^-6, -1.96*10^-6, -1.92*10^-6, -1.88*10^-6, -1.84*10^-6, \
-1.8*10^-6, -1.76*10^-6, -1.72*10^-6, -1.68*10^-6, -1.64*10^-6, \
-1.6*10^-6, -1.56*10^-6, -1.52*10^-6, -1.48*10^-6}

axisy = data[[1]][[2 ;; dims[[2]]]]

{400., 402., 404., 406., 408., 410., 412., 414.}


Then you extract the data for plotting by removing values for x- and y-axes.

plotdata = Take[data, -dims[[1]] + 1, -dims[[2]] + 1];


And finally you plot the data with specified axes values and ranges

ListPlot3D[plotdata, InterpolationOrder -> 3,
DataRange -> {{First[axisx], Last[axisx]}, {First[axisy],
Last[axisy]}, Automatic}]