Message Boards Message Boards

Create contour/density plots from imported data?

I do not know how to create more arguments from my import file and I need to create a contour plot and a density plot. Attached is my notebook with the work I have done so far.

Attachments:
POSTED BY: Leon Tran
10 Replies
Posted 4 years ago

Hi Leon,

Please attach mystery2.xlsx to your post.

POSTED BY: Rohit Namjoshi

Updated with mystery 2

POSTED BY: Leon Tran
Posted 4 years ago

I don't think ContourPlot is the right way to visualize that data. Try

data = Import["~/Downloads/mystery2_-73182571.xlsx", "Data"] // First;

MatrixPlot[data]

To change the orientation

MatrixPlot[Reverse@data]
POSTED BY: Rohit Namjoshi

I have to make it into a contour plot, is there a way I can convert the file data into a function or another code that has contour plot?

POSTED BY: Leon Tran
Posted 4 years ago

Take a look at ListContourPlot and ListDensityPlot.

POSTED BY: Rohit Namjoshi

I have taken a look at those and I tried, but my arguments do not work. What would you suggest be in the command? Because I tried setting it up like any other plot that involves an import, but it still won't work.

POSTED BY: Leon Tran
Posted 4 years ago

Hi Leon,

Not sure what you tried, but this should work

data = Import["~/Downloads/mystery2_-73182571.xlsx", "Data"] // First;

ListContourPlot[data]
ListDensityPlot[data]
POSTED BY: Rohit Namjoshi

Did it actually produce a graph for you? Because I didn't get anything.

POSTED BY: Leon Tran
Posted 4 years ago

"I didn't get anything" is not helpful, it would be great if you posted the code you tried. What version of Mathematica are you using?

data = Import["~/Downloads/mystery2_-73182571.xlsx", "Data"] // First;
ListContourPlot[data]

enter image description here

POSTED BY: Rohit Namjoshi

I am sorry for the late response. I used the command flatten and that caused my code to fail. Thank you for your help. Also, can you tell me what //First does?

POSTED BY: Leon Tran
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract